-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add continuous integration and deployment (#1)
* chore: add continuous integration * ci: fix tooling * test: fix unit tests
- Loading branch information
Showing
14 changed files
with
148 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: continuous deployment | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
deployment: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Checkout source files | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Build project | ||
run: npm exec nx build --prod | ||
|
||
- name: Find new product version | ||
uses: arwynfr/actions-conventional-versioning/get-newVersion@v3 | ||
id: next-version | ||
with: | ||
allow-additional-modifiers: true | ||
feat-upgrades-minor: false | ||
strict-types: true | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and publish docker image | ||
run: > | ||
docker build --push | ||
--file build/Dockerfile | ||
--tag ghcr.io/team-gsri/apps-admin-client:${{ steps.next-version.outputs.next-version }} | ||
dist/gsri-admin | ||
- name: Publish GitHub release | ||
uses: arwynfr/actions-conventional-versioning@v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: continuous integration | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
integration: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Checkout source files | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Lint sources | ||
run: npm exec nx lint | ||
|
||
- name: Run unit tests | ||
run: npm exec nx test | ||
|
||
- name: Build project | ||
run: npm exec nx build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
FROM nginx:1.25.0-alpine | ||
COPY . /srv/www |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[CmdletBinding()] | ||
param ( | ||
[Parameter()] | ||
[ValidateScript({ $_ | Test-Path -PathType Container }, ErrorMessage = 'Path must be a valid directory')] | ||
[string] | ||
$Path = (Join-Path $PSScriptRoot ../dist/gsri-admin | Convert-Path), | ||
|
||
[Parameter()] | ||
[string] | ||
$Image = 'ghcr.io/team-gsri/apps-admin-client', | ||
|
||
[Parameter()] | ||
[semver] | ||
$Tag, | ||
|
||
[Parameter()] | ||
[ValidateScript({ $_ | Test-Path -PathType Leaf }, ErrorMessage = 'Path must be a valid file')] | ||
[string] | ||
$Dockerfile = (Join-Path $PSScriptRoot Dockerfile | Convert-Path) | ||
) | ||
|
||
if ($null -eq $Tag) { | ||
Import-Module -Force StepSemVer | ||
$Tag = [semver]$(git describe --tags 2>&1) | Step-SemVer -BumpType patch -PreRelease 'SNAPSHOT' | ||
Write-Verbose "Docker tag: $Tag" | ||
} | ||
|
||
docker build --file "$Dockerfile" --tag "${Image}:${Tag}" "${Path}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import { Route } from '@angular/router'; | ||
import { JoueursComponent } from './joueurs/joueurs-list/joueurs-list.component'; | ||
import { JoueursListComponent } from './joueurs/joueurs-list/joueurs-list.component'; | ||
import { JoueursDetailsComponent } from './joueurs/joueurs-details/joueurs-details.component'; | ||
|
||
export const appRoutes: Route[] = [ | ||
{ path: '', redirectTo: '/joueurs', pathMatch: 'full' }, | ||
{ path: 'joueurs/:id', component: JoueursDetailsComponent }, | ||
{ path: 'joueurs', component: JoueursComponent }, | ||
{ path: 'joueurs', component: JoueursListComponent }, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 7 additions & 1 deletion
8
src/app/joueurs/joueurs-details/joueurs-details.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 6 additions & 5 deletions
11
src/app/joueurs/joueurs-list/joueurs-list.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters