Skip to content

Commit

Permalink
feat: SJIP-644 github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Francis Lavoie committed Nov 15, 2023
1 parent 532547a commit ad931f2
Show file tree
Hide file tree
Showing 7 changed files with 172 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Build

on: [pull_request]

jobs:
build_qa:
name: Build QA Image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Set the QA configuration file
run: mv env-qa .env
- name: Ensure we can build the image
run: docker build -t test:test --target server .
15 changes: 15 additions & 0 deletions .github/workflows/commit_lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Commit Lint Check

on: [push]

jobs:
build:
name: Commit Lint Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- name: Lint Commits
uses: Ferlab-Ste-Justine/action-commit-lint@v2
36 changes: 36 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: 'Quality'

on:
pull_request:
branches:
- main

permissions:
actions: write
checks: write
contents: write
deployments: write
issues: write
packages: write
pull-requests: write
repository-projects: write
security-events: write
statuses: write

jobs:
coverage:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: ArtiomTr/jest-coverage-report-action@v2
id: coverage
with:
test-script: npm run coverage:changed
output: report-markdown
- uses: marocchino/sticky-pull-request-comment@v2
with:
header: PR Coverage
message: ${{ steps.coverage.outputs.report }}
24 changes: 24 additions & 0 deletions .github/workflows/publish_image_sha.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Publish Image Using Commit Hash

on:
push:
branches:
- main

jobs:
publish_qa:
name: Publish QA Image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Set the QA configuration file
run: mv env-qa .env
- name: Push the image on the docker registry
uses: Ferlab-Ste-Justine/action-push-image@v2
with:
username: ${{ secrets.FERLAB_DOCKER_HUB_USER }}
password: ${{ secrets.FERLAB_DOCKER_HUB_TOKEN }}
image: ferlabcrsj/clin-portal-ui
tag_format: "qa-{sha}-{timestamp}"
40 changes: 40 additions & 0 deletions .github/workflows/publish_image_tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Publish Image Using Semver Tag

on:
push:
tags:
- v*

jobs:
build_staging:
name: Publish Staging Image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Set the Staging configuration file
run: mv env-staging .env
- name: Push the image on the docker registry
uses: Ferlab-Ste-Justine/action-push-image@v2
with:
username: ${{ secrets.FERLAB_DOCKER_HUB_USER }}
password: ${{ secrets.FERLAB_DOCKER_HUB_TOKEN }}
image: ferlabcrsj/clin-portal-ui
tag_format: "staging-{semver}"
build_prod:
name: Publish Prod Image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Set the Prod configuration file
run: mv env-prod .env
- name: Push the image on the docker registry
uses: Ferlab-Ste-Justine/action-push-image@v2
with:
username: ${{ secrets.FERLAB_DOCKER_HUB_USER }}
password: ${{ secrets.FERLAB_DOCKER_HUB_TOKEN }}
image: ferlabcrsj/clin-portal-ui
tag_format: "prod-{semver}"
40 changes: 40 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: 'Quality'

on:
pull_request:
branches:
- main

permissions:
actions: write
checks: write
contents: write
deployments: write
issues: write
packages: write
pull-requests: write
repository-projects: write
security-events: write
statuses: write

jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install modules
run: npm i
- name: Run tests
id: tests
run: |
echo " " >> results.log
echo "## Project Coverage and Test" >> results.log
echo "" >> results.log
echo "`npm run test:github 2>&1 | sed 's/=//g' | tail -n 11`" >> results.log
echo " " >> results.log
- uses: marocchino/sticky-pull-request-comment@v2
with:
header: Project Coverage and Test
path: results.log
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"build": "DISABLE_ESLINT_PLUGIN=true react-scripts build",
"build:netlify": "npm ci && npm run build",
"test": "react-scripts test",
"test:github": "react-scripts test --coverage --watchAll=false --no-watchman --coverageReporters=\"text-summary\"",
"lint": "eslint $(git diff-index --name-only --diff-filter=d HEAD | grep \"[\\.js|\\.jsx|\\.tsx|\\.ts]$\" | xargs)",
"lint:fix": "npm run lint -- --fix",
"theme": "mkdir -p src/style/themes/include/dist && npm run theme:antd",
Expand Down

0 comments on commit ad931f2

Please sign in to comment.