-
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 #2 from bcgov/dev
Dev
- Loading branch information
Showing
269 changed files
with
29,455 additions
and
0 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,41 @@ | ||
export default { | ||
options: { | ||
preset: { | ||
name: 'conventionalcommits', | ||
types: [ | ||
{ | ||
type: 'feat', | ||
section: 'Features', | ||
}, | ||
{ | ||
type: 'fix', | ||
section: 'Bug Fixes', | ||
}, | ||
{ | ||
type: 'docs', | ||
section: 'Docs', | ||
}, | ||
{ | ||
type: 'refactor', | ||
section: 'Refactors', | ||
}, | ||
{ | ||
type: 'chore', | ||
hidden: true, | ||
}, | ||
{ | ||
type: 'style', | ||
hidden: true, | ||
}, | ||
{ | ||
type: 'perf', | ||
hidden: true, | ||
}, | ||
{ | ||
type: 'test', | ||
hidden: true, | ||
}, | ||
], | ||
}, | ||
}, | ||
}; |
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,16 @@ | ||
# https://github.com/desktop/desktop/issues/5323 | ||
# Set the default behavior, in case people don't have core.autocrlf set. | ||
* text=auto | ||
|
||
# Denote all files that are truly binary and should not be modified. | ||
*.png binary | ||
*.jpg binary | ||
*.woff binary | ||
*.woff2 binary | ||
*.eot binary | ||
*.ttf binary | ||
*.exe binary | ||
*.apk binary | ||
|
||
# https://stackoverflow.com/questions/38905135/why-wont-my-docker-entrypoint-sh-execute | ||
*.sh text eol=lf |
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,20 @@ | ||
name: Setup NPM Packages | ||
description: Setup required NPM packages | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- uses: actions/cache@67b839edb68371cc5014f6cea11c9aa77238de78 | ||
with: | ||
path: | | ||
**/node_modules | ||
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.lock') }} | ||
|
||
- name: Install Root NPM packages | ||
run: npm install | ||
shell: bash | ||
|
||
- name: Install Frontend NPM packages | ||
run: npm install | ||
working-directory: ./frontend | ||
shell: bash |
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,29 @@ | ||
name: Setup Tools | ||
description: Setup required tools in the workspace | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Install asdf | ||
uses: asdf-vm/actions/setup@8b8467c5522bb0aea4977082037e4f2956d67e52 | ||
|
||
- name: Cache tools | ||
uses: actions/cache@67b839edb68371cc5014f6cea11c9aa77238de78 | ||
with: | ||
path: /home/runner/.asdf | ||
key: ${{ runner.os }}-${{ hashFiles('**/.tool-versions') }} | ||
|
||
- name: Install required tools | ||
run: | | ||
cat .tool-versions | cut -f 1 -d ' ' | xargs -n 1 asdf plugin-add || true | ||
asdf plugin-add docker-compose https://github.com/virtualstaticvoid/asdf-docker-compose.git || true | ||
asdf plugin-update --all | ||
asdf install | ||
asdf reshim | ||
shell: bash | ||
|
||
- name: Install python tools | ||
run: | | ||
pip install -r requirements.txt | ||
asdf reshim | ||
shell: bash |
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,109 @@ | ||
name: Create Version Tag with Changelog PR | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
type: string | ||
description: Tag Version (exclude prefix; e.g. 1.2.3) | ||
required: true | ||
|
||
jobs: | ||
tag-changelog: | ||
runs-on: ubuntu-22.04 | ||
timeout-minutes: 10 | ||
permissions: | ||
contents: write | ||
issues: write | ||
pull-requests: write | ||
|
||
steps: | ||
- name: Fail on tags | ||
run: exit 1 | ||
if: ${{ !startsWith(github.ref, 'refs/heads/') }} | ||
|
||
- name: Validate Tag Input | ||
id: input | ||
run: | | ||
vtag=${{ github.event.inputs.tag }} | ||
echo "tag=${vtag//v}" >> $GITHUB_OUTPUT | ||
- uses: hmarr/debug-action@a701ed95a46e6f2fb0df25e1a558c16356fae35a | ||
- uses: actions/checkout@96f53100ba2a5449eb71d2e6604bbcd94b9449b5 | ||
with: | ||
fetch-depth: 0 # fetch all history for all branches and tags | ||
# https://medium.com/prompt/trigger-another-github-workflow-without-using-a-personal-access-token-f594c21373ef | ||
ssh-key: "${{ secrets.COMMIT_KEY }}" | ||
|
||
- name: Setup Tools | ||
uses: ./.github/actions/setup-tools | ||
|
||
- name: Setup NPM Packages | ||
uses: ./.github/actions/setup-npm | ||
|
||
- name: Create a tag and update changelog | ||
run: | | ||
git config user.name "$GITHUB_ACTOR" | ||
git config user.email "[email protected]" | ||
git config commit.gpgsign false | ||
branch=changelog/${{ steps.input.outputs.tag }} | ||
git checkout -b "$branch" | ||
git push --set-upstream origin "$branch" | ||
echo "git status - 0" | ||
git status | ||
echo "git status - 1" | ||
git reset --hard | ||
./node_modules/.bin/release-it ${{ steps.input.outputs.tag }} --only-version | ||
- name: Set output variables | ||
id: vars | ||
run: | | ||
pr_title="chore: release candidate v${{ steps.input.outputs.tag }}" | ||
pr_body=$(git tag -l --format='%(contents)' v${{ steps.input.outputs.tag }}) | ||
echo "pr_title=$pr_title" >> $GITHUB_OUTPUT | ||
echo "base=$GITHUB_REF_NAME" >> $GITHUB_OUTPUT | ||
# See https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings | ||
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) | ||
echo "pr_body<<$EOF" >> "$GITHUB_OUTPUT" | ||
echo "$pr_body" >> $GITHUB_OUTPUT | ||
echo "$EOF" >> "$GITHUB_OUTPUT" | ||
- name: Create Pull Request | ||
uses: actions/github-script@6f00a0b667f9463337970371ccda9072ee86fb27 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const { repo, owner } = context.repo; | ||
const result = await github.rest.pulls.create({ | ||
owner, | ||
repo, | ||
head: 'changelog/${{ steps.input.outputs.tag }}', | ||
base: '${{ steps.vars.outputs.base }}', | ||
title: '${{ steps.vars.outputs.pr_title }}', | ||
body: `### Commits | ||
${{ steps.vars.outputs.pr_body }} | ||
### GitHub Action | ||
- [Build and deploy Apps in Test Environment](https://github.com/strdss/actions/workflows/deploy-test.yml) | ||
`, | ||
}); | ||
github.rest.issues.addLabels({ | ||
owner, | ||
repo, | ||
issue_number: result.data.number, | ||
labels: ['changelog', 'v${{ steps.input.outputs.tag }}'] | ||
}); | ||
github.rest.pulls.merge({ | ||
owner, | ||
repo, | ||
pull_number: result.data.number, | ||
merge_method: 'merge' | ||
}); | ||
- name: Delete Changelog Branch | ||
run: | | ||
git push origin -d changelog/${{ steps.input.outputs.tag }} |
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,143 @@ | ||
name: Deploy Dev Environment | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths-ignore: | ||
- database/** | ||
- package.json | ||
- package-lock.json | ||
- CHANGELOG.md | ||
- .conventional-changelog.mjs | ||
- .release-it.json | ||
|
||
env: | ||
GITHUB_REGISTRY: ghcr.io | ||
IMAGE_NAME_FRONTEND: bcgov/strdss-frontend | ||
IMAGE_NAME_BACKEND: bcgov/strdss-backend | ||
|
||
jobs: | ||
test-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 | ||
# Look to see if there is a cache hit for the corresponding requirements file | ||
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-nuget | ||
- name: Build | ||
run: | | ||
pwd | ||
dotnet build ./server/server.sln | ||
- name: Test | ||
run: dotnet test ./server/server.sln --no-build | ||
|
||
build-frontend: | ||
needs: [test-backend] | ||
runs-on: ubuntu-22.04 | ||
timeout-minutes: 10 | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- uses: hmarr/debug-action@a701ed95a46e6f2fb0df25e1a558c16356fae35a | ||
- uses: actions/checkout@96f53100ba2a5449eb71d2e6604bbcd94b9449b5 | ||
|
||
- 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 and Push | ||
uses: egose/actions/docker-build-push@04830c07edee3c552f2c5a0330a674ff0d366c66 | ||
with: | ||
registry-url: ${{ env.GITHUB_REGISTRY }} | ||
registry-username: ${{ github.actor }} | ||
registry-password: ${{ secrets.GITHUB_TOKEN }} | ||
image-name: ${{ env.IMAGE_NAME_FRONTEND }} | ||
docker-context: frontend | ||
docker-file: frontend/Dockerfile | ||
docker-args: | | ||
generate_sourcemap=true | ||
style_nonce=${{ steps.render_style_nonce.outputs.style_nonce }} | ||
metadata-tags: | | ||
type=ref,event=branch | ||
type=sha,format=long,prefix=,suffix= | ||
build-backend: | ||
needs: [test-backend] | ||
runs-on: ubuntu-22.04 | ||
timeout-minutes: 10 | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- uses: hmarr/debug-action@a701ed95a46e6f2fb0df25e1a558c16356fae35a | ||
- uses: actions/checkout@96f53100ba2a5449eb71d2e6604bbcd94b9449b5 | ||
|
||
- name: Setup Tools | ||
uses: ./.github/actions/setup-tools | ||
|
||
- name: Build and Push | ||
uses: egose/actions/docker-build-push@04830c07edee3c552f2c5a0330a674ff0d366c66 | ||
with: | ||
registry-url: ${{ env.GITHUB_REGISTRY }} | ||
registry-username: ${{ github.actor }} | ||
registry-password: ${{ secrets.GITHUB_TOKEN }} | ||
image-name: ${{ env.IMAGE_NAME_BACKEND }} | ||
docker-context: server | ||
docker-file: server/Dockerfile | ||
metadata-tags: | | ||
type=ref,event=branch | ||
type=sha,format=long,prefix=,suffix= | ||
deploy: | ||
needs: [build-frontend, build-backend] | ||
runs-on: ubuntu-22.04 | ||
timeout-minutes: 5 | ||
permissions: | ||
contents: read | ||
environment: | ||
name: dev | ||
url: https://dev-strdss.f4a30d-dev.apps.silver.devops.gov.bc.ca/ | ||
|
||
steps: | ||
- uses: hmarr/debug-action@a701ed95a46e6f2fb0df25e1a558c16356fae35a | ||
- uses: actions/checkout@96f53100ba2a5449eb71d2e6604bbcd94b9449b5 | ||
|
||
- name: Authenticate and set context | ||
uses: redhat-actions/oc-login@9b79eb6d8ec51bce42cb4e77f0a174fc80cf3cb9 | ||
with: | ||
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER }} | ||
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }} | ||
namespace: f4a30d-dev | ||
insecure_skip_tls_verify: true | ||
|
||
- name: Deploy apps with Helm chart | ||
run: | | ||
make upgrade \ | ||
NAMESPACE=f4a30d-dev \ | ||
NAME=strdss-dev \ | ||
ENV_NAME=dev \ | ||
IMAGE_TAG_FRONTEND=${{ github.sha }} \ | ||
IMAGE_TAG_BACKEND=${{ github.sha }} \ | ||
working-directory: ./helm/main |
Oops, something went wrong.