-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #136 from bcgov/yj
chore: artifactory CI/CD
- Loading branch information
Showing
6 changed files
with
297 additions
and
307 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 |
---|---|---|
@@ -1,156 +1,156 @@ | ||
# name: Build and Push | ||
|
||
# on: | ||
# workflow_dispatch: | ||
# push: | ||
# branches: | ||
# - main | ||
# paths-ignore: | ||
# - database/** | ||
# - package.json | ||
# - package-lock.json | ||
# - CHANGELOG.md | ||
# - .conventional-changelog.mjs | ||
# - .release-it.json | ||
|
||
# env: | ||
# JFROG_REGISTRY: artifacts.developer.gov.bc.ca | ||
# IMAGE_NAME_FRONTEND: sf4a-strdss/strdss-frontend | ||
# IMAGE_NAME_BACKEND: sf4a-strdss/strdss-backend | ||
|
||
# jobs: | ||
# build-backend: | ||
# runs-on: ubuntu-22.04 | ||
# timeout-minutes: 10 | ||
|
||
# steps: | ||
# - name: Checkout Repository | ||
# uses: actions/checkout@v4 | ||
|
||
# - name: Setup .NET | ||
# uses: actions/setup-dotnet@v3 | ||
# with: | ||
# dotnet-version: '7.0.400' | ||
|
||
# - uses: actions/cache@v3 | ||
# with: | ||
# path: ~/.nuget/packages | ||
# key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | ||
# restore-keys: | | ||
# ${{ runner.os }}-nuget | ||
|
||
# - name: Setup Tools | ||
# uses: ./.github/actions/setup-tools | ||
|
||
# - name: Build backend | ||
# run: | | ||
# pwd | ||
# dotnet build ./server/server.sln | ||
|
||
# - name: Test backend | ||
# run: dotnet test ./server/server.sln --no-build | ||
|
||
# # SonarQube integration for backend | ||
# - name: SonarQube Scan Backend | ||
# uses: sonarsource/sonarcloud-github-action@v2 | ||
# env: | ||
# SONAR_HOST_URL: https://sonarcloud.io | ||
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_TEST }} | ||
|
||
# build-frontend: | ||
# runs-on: ubuntu-22.04 | ||
# timeout-minutes: 10 | ||
# permissions: | ||
# contents: read | ||
# packages: write | ||
|
||
# steps: | ||
# - name: Checkout Repository | ||
# uses: actions/checkout@v4 | ||
|
||
# - name: Setup Node.js | ||
# uses: actions/setup-node@v3 | ||
# with: | ||
# node-version: '18' | ||
|
||
# - name: Install Angular CLI | ||
# run: | | ||
# cd ./frontend | ||
# npm install -g @angular/cli | ||
|
||
# - name: Install project dependencies | ||
# run: | | ||
# cd ./frontend | ||
# npm install | ||
|
||
# - name: Build frontend | ||
# run: | | ||
# cd ./frontend | ||
# ng build --configuration=production | ||
|
||
# - name: Run frontend tests | ||
# run: | | ||
# cd ./frontend | ||
# ng test --watch=false --progress=false --browsers=ChromeHeadless --code-coverage --source-map=false | ||
# continue-on-error: true | ||
|
||
# # SonarQube integration frontend | ||
# - name: SonarQube Scan | ||
# uses: sonarsource/sonarcloud-github-action@v2 | ||
# env: | ||
# SONAR_HOST_URL: https://sonarcloud.io | ||
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_TEST }} | ||
|
||
# Docker-build-backend: | ||
# needs: [build-backend] | ||
# runs-on: ubuntu-22.04 | ||
# timeout-minutes: 10 | ||
# permissions: | ||
# contents: read | ||
# packages: write | ||
|
||
# steps: | ||
# - uses: actions/checkout@v4 | ||
|
||
# - name: Setup Tools | ||
# uses: ./.github/actions/setup-tools | ||
|
||
# - name: Build Docker image | ||
# run: cd server && docker build -t strdss-backend -f Dockerfile . | ||
|
||
# - name: Tag Docker image | ||
# run: docker tag strdss-backend artifacts.developer.gov.bc.ca/sf4a-strdss/strdss-backend:latest | ||
|
||
# - name: Push Docker image to Artifactory | ||
# run: | | ||
# docker login artifacts.developer.gov.bc.ca -u ${{ secrets.JFROG_USERNAME }} -p ${{ secrets.JFROG_PASSWORD }} | ||
# docker push artifacts.developer.gov.bc.ca/sf4a-strdss/strdss-backend:latest | ||
|
||
# Docker-build-frontend: | ||
# needs: [build-frontend] | ||
# runs-on: ubuntu-22.04 | ||
# timeout-minutes: 10 | ||
# permissions: | ||
# contents: read | ||
# packages: write | ||
|
||
# steps: | ||
# - uses: actions/checkout@v4 | ||
|
||
# - name: Setup Tools | ||
# uses: ./.github/actions/setup-tools | ||
|
||
# - name: Render style_nonce | ||
# id: render_style_nonce | ||
# run: echo "::set-output name=style_nonce::$(echo -n ${{ github.sha }} | base64)" | ||
|
||
# - name: Build Docker image | ||
# run: cd server && docker build -t strdss-frontend -f Dockerfile . | ||
|
||
# - name: Tag Docker image | ||
# run: docker tag strdss-frontend artifacts.developer.gov.bc.ca/sf4a-strdss/strdss-frontend:latest | ||
|
||
# - name: Push Docker image to Artifactory | ||
# run: | | ||
# docker login artifacts.developer.gov.bc.ca -u ${{ secrets.JFROG_USERNAME }} -p ${{ secrets.JFROG_PASSWORD }} | ||
# docker push artifacts.developer.gov.bc.ca/sf4a-strdss/strdss-frontend:latest | ||
name: Build and Push | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
paths-ignore: | ||
- database/** | ||
- package.json | ||
- package-lock.json | ||
- CHANGELOG.md | ||
- .conventional-changelog.mjs | ||
- .release-it.json | ||
|
||
env: | ||
JFROG_REGISTRY: artifacts.developer.gov.bc.ca | ||
IMAGE_NAME_FRONTEND: sf4a-strdss/strdss-frontend | ||
IMAGE_NAME_BACKEND: sf4a-strdss/strdss-backend | ||
|
||
jobs: | ||
build-backend: | ||
runs-on: ubuntu-22.04 | ||
timeout-minutes: 10 | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: '7.0.400' | ||
|
||
- uses: actions/cache@v3 | ||
with: | ||
path: ~/.nuget/packages | ||
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-nuget | ||
- name: Setup Tools | ||
uses: ./.github/actions/setup-tools | ||
|
||
- name: Build backend | ||
run: | | ||
pwd | ||
dotnet build ./server/server.sln | ||
- name: Test backend | ||
run: dotnet test ./server/server.sln --no-build | ||
|
||
# SonarQube integration for backend | ||
- name: SonarQube Scan Backend | ||
uses: sonarsource/sonarcloud-github-action@v2 | ||
env: | ||
SONAR_HOST_URL: https://sonarcloud.io | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_TEST }} | ||
|
||
build-frontend: | ||
runs-on: ubuntu-22.04 | ||
timeout-minutes: 10 | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18' | ||
|
||
- name: Install Angular CLI | ||
run: | | ||
cd ./frontend | ||
npm install -g @angular/cli | ||
- name: Install project dependencies | ||
run: | | ||
cd ./frontend | ||
npm install | ||
- name: Build frontend | ||
run: | | ||
cd ./frontend | ||
ng build --configuration=production | ||
- name: Run frontend tests | ||
run: | | ||
cd ./frontend | ||
ng test --watch=false --progress=false --browsers=ChromeHeadless --code-coverage --source-map=false | ||
continue-on-error: true | ||
|
||
# SonarQube integration frontend | ||
- name: SonarQube Scan | ||
uses: sonarsource/sonarcloud-github-action@v2 | ||
env: | ||
SONAR_HOST_URL: https://sonarcloud.io | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_TEST }} | ||
|
||
Docker-build-backend: | ||
needs: [build-backend] | ||
runs-on: ubuntu-22.04 | ||
timeout-minutes: 10 | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Tools | ||
uses: ./.github/actions/setup-tools | ||
|
||
- name: Build Docker image | ||
run: cd server && docker build -t strdss-backend -f Dockerfile . | ||
|
||
- name: Tag Docker image | ||
run: docker tag strdss-backend artifacts.developer.gov.bc.ca/sf4a-strdss/strdss-backend:latest | ||
|
||
- name: Push Docker image to Artifactory | ||
run: | | ||
docker login artifacts.developer.gov.bc.ca -u ${{ secrets.JFROG_USERNAME }} -p ${{ secrets.JFROG_PASSWORD }} | ||
docker push artifacts.developer.gov.bc.ca/sf4a-strdss/strdss-backend:latest | ||
Docker-build-frontend: | ||
needs: [build-frontend] | ||
runs-on: ubuntu-22.04 | ||
timeout-minutes: 10 | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Tools | ||
uses: ./.github/actions/setup-tools | ||
|
||
- name: Render style_nonce | ||
id: render_style_nonce | ||
run: echo "::set-output name=style_nonce::$(echo -n ${{ github.sha }} | base64)" | ||
|
||
- name: Build Docker image | ||
run: cd server && docker build -t strdss-frontend -f Dockerfile . | ||
|
||
- name: Tag Docker image | ||
run: docker tag strdss-frontend artifacts.developer.gov.bc.ca/sf4a-strdss/strdss-frontend:latest | ||
|
||
- name: Push Docker image to Artifactory | ||
run: | | ||
docker login artifacts.developer.gov.bc.ca -u ${{ secrets.JFROG_USERNAME }} -p ${{ secrets.JFROG_PASSWORD }} | ||
docker push artifacts.developer.gov.bc.ca/sf4a-strdss/strdss-frontend:latest |
Oops, something went wrong.