-
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.
Merge pull request #3 from digitalservicebund/RISDEV-5816-add-continu…
…ous-integration Setup Continuous Integration
- Loading branch information
Showing
3 changed files
with
151 additions
and
2 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,131 @@ | ||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
confirm-frontend-changes: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
frontend: ${{ steps.filter.outputs.frontend }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dorny/paths-filter@v3 | ||
id: filter | ||
with: | ||
filters: | | ||
frontend: | ||
- 'frontend/**' | ||
linting-formatting-frontend: | ||
needs: confirm-frontend-changes | ||
if: ${{ needs.scan-frontend-changes.outputs.frontend == 'true' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: ./frontend/package.json | ||
cache: npm | ||
cache-dependency-path: ./frontend/package-lock.json | ||
- name: Cache node_modules | ||
uses: actions/cache@v4 | ||
id: node-modules-cache | ||
with: | ||
path: | | ||
./frontend/node_modules | ||
key: modules-${{ hashFiles('./frontend/package-lock.json') }} | ||
- name: Install dependencies | ||
if: steps.node-modules-cache.outputs.cache-hit != 'true' | ||
run: | | ||
npm ci | ||
working-directory: ./frontend | ||
- name: Linting | ||
run: npm run style:check | ||
working-directory: ./frontend | ||
- name: Formatting | ||
run: npm run format:check | ||
working-directory: ./frontend | ||
- name: Send status to Slack | ||
# Third-party action, pin to commit SHA! | ||
# See https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions | ||
uses: digitalservicebund/notify-on-failure-gha@814d0c4b2ad6a3443e89c991f8657b10126510bf # v1.5.0 | ||
if: ${{ failure() && github.ref == 'refs/heads/main' }} | ||
with: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
|
||
unit-tests-frontend: | ||
needs: confirm-frontend-changes | ||
if: ${{ needs.scan-frontend-changes.outputs.frontend == 'true' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: ./frontend/package.json | ||
cache: npm | ||
cache-dependency-path: ./frontend/package-lock.json | ||
- name: Cache node_modules | ||
uses: actions/cache@v4 | ||
id: node-modules-cache | ||
with: | ||
path: | | ||
./frontend/node_modules | ||
key: modules-${{ hashFiles('./frontend/package-lock.json') }} | ||
- name: Install dependencies | ||
if: steps.node-modules-cache.outputs.cache-hit != 'true' | ||
run: | | ||
npm ci | ||
working-directory: ./frontend | ||
- name: Unit tests | ||
run: | | ||
npm run test:unit | ||
working-directory: ./frontend | ||
# TODO: enable later | ||
# | ||
# - name: Send status to Slack | ||
# # Third-party action, pin to commit SHA! | ||
# # See https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions | ||
# uses: digitalservicebund/notify-on-failure-gha@814d0c4b2ad6a3443e89c991f8657b10126510bf # v1.5.0 | ||
# if: ${{ failure() && github.ref == 'refs/heads/main' }} | ||
# with: | ||
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
|
||
e2e-tests-frontend: | ||
needs: confirm-frontend-changes | ||
if: ${{ needs.scan-frontend-changes.outputs.frontend == 'true' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: ./frontend/package.json | ||
cache: npm | ||
cache-dependency-path: ./frontend/package-lock.json | ||
- name: Cache node_modules | ||
uses: actions/cache@v4 | ||
id: node-modules-cache | ||
with: | ||
path: | | ||
./frontend/node_modules | ||
key: modules-${{ hashFiles('./frontend/package-lock.json') }} | ||
- name: Install dependencies | ||
if: steps.node-modules-cache.outputs.cache-hit != 'true' | ||
run: | | ||
npm ci | ||
working-directory: ./frontend | ||
- name: Unit tests | ||
run: | | ||
npm run test:e2e | ||
working-directory: ./frontend | ||
# TODO: enable later | ||
# | ||
# - name: Send status to Slack | ||
# # Third-party action, pin to commit SHA! | ||
# # See https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions | ||
# uses: digitalservicebund/notify-on-failure-gha@814d0c4b2ad6a3443e89c991f8657b10126510bf # v1.5.0 | ||
# if: ${{ failure() && github.ref == 'refs/heads/main' }} | ||
# with: | ||
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
#TODO sonar analysis |
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 @@ | ||
name: "CI Pipeline" | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
paths-ignore: | ||
- "**/*.md" | ||
pull_request: | ||
branches: [main] | ||
# Allow to run this workflow manually | ||
workflow_dispatch: | ||
|
||
jobs: | ||
frontend-checks: | ||
uses: ./.github/workflows/frontend-jobs.yml | ||
secrets: inherit |
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