Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modular deployments #29

Merged
merged 49 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
dd83e33
Reuse scan workflow
HendrikSchmidt May 16, 2024
a524005
Skip build in pipeline
HendrikSchmidt May 16, 2024
7672def
Add dito specific pipeline
HendrikSchmidt May 16, 2024
fa57906
Add shared pipeline
HendrikSchmidt May 16, 2024
eb9b151
Adapt pipeline setup
HendrikSchmidt May 16, 2024
9d0e736
Update pipeline-shared.yml
HendrikSchmidt May 16, 2024
7c23986
Update _index.tsx
HendrikSchmidt May 16, 2024
808e2ea
Ignore changes to single pipelines in shared
HendrikSchmidt May 16, 2024
15feceb
Update pipeline-dito.yml
HendrikSchmidt May 16, 2024
fb4e9bc
Create pipeline-tool-finder.yml
HendrikSchmidt May 16, 2024
794bf78
Update pipeline-shared.yml
HendrikSchmidt May 16, 2024
a494e7d
Use root license audit
HendrikSchmidt May 16, 2024
c882483
Run single pipelines on workflow changes
HendrikSchmidt May 16, 2024
ec8a4af
Inherit secrets for slack integration
HendrikSchmidt May 16, 2024
b56bbd2
Inherit secret everywhere for slack
HendrikSchmidt May 16, 2024
1d7bb93
Use root formatter and linter in pipeline
HendrikSchmidt May 16, 2024
8f796ca
Update build-and-deploy.yml
HendrikSchmidt May 16, 2024
ff4e28f
Readd node modules caching
HendrikSchmidt May 17, 2024
8e6f94a
Update README with new workflow
HendrikSchmidt May 17, 2024
3a7da1f
Fix typo in workflow paths
HendrikSchmidt May 21, 2024
3303006
Update pipeline-shared.yml
HendrikSchmidt May 21, 2024
3f3e8e3
Update pipeline-shared.yml
HendrikSchmidt May 21, 2024
41995ff
Sanity check pipeline filter
HendrikSchmidt May 21, 2024
7b2463b
Revert "Sanity check pipeline filter"
HendrikSchmidt May 21, 2024
d156e50
Unify pipeline using paths filter action
HendrikSchmidt May 21, 2024
7d9dc9f
Rename to pipeline
HendrikSchmidt May 21, 2024
4bf1dd5
Move workflow dispatch
HendrikSchmidt May 21, 2024
d3c6520
Update pipeline.yml
HendrikSchmidt May 21, 2024
ee57c15
Merge branch 'main' into modular-deployments
HendrikSchmidt May 21, 2024
74c4b4f
Update pipeline.yml
HendrikSchmidt May 21, 2024
d1e32d0
Add concurrency group for matrix
HendrikSchmidt May 21, 2024
e866206
Clean up pipeline
HendrikSchmidt May 21, 2024
07ba573
Remove concurrency groups completely
HendrikSchmidt May 21, 2024
51b9fa9
Run check and test with package matrix
HendrikSchmidt May 21, 2024
a9edeaf
Add package specific concurrency
HendrikSchmidt May 21, 2024
7fc0941
Fix max-parallel (set to 1)
HendrikSchmidt May 21, 2024
957f7ab
Update README.md
HendrikSchmidt May 21, 2024
b0761e7
Update package-lock.json
HendrikSchmidt May 22, 2024
a04fc32
Test changes in shared
HendrikSchmidt May 22, 2024
5111052
Test pipeline multiple commits in push
HendrikSchmidt May 22, 2024
ac6c484
Test pipeline multiple commits in push
HendrikSchmidt May 22, 2024
8f6cd01
Revert "Test pipeline multiple commits in push"
HendrikSchmidt May 22, 2024
cb8031d
Revert "Test pipeline multiple commits in push"
HendrikSchmidt May 22, 2024
89287b8
Revert "Test changes in shared"
HendrikSchmidt May 22, 2024
c94908f
Update _index.tsx
HendrikSchmidt May 22, 2024
2c0aff8
Test deployments
HendrikSchmidt May 22, 2024
e0fdf65
Update check-and-test.yml
HendrikSchmidt May 22, 2024
945397e
Revert "Test deployments"
HendrikSchmidt May 22, 2024
52c5ec4
Merge branch 'main' into modular-deployments
HendrikSchmidt May 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 10
concurrency:
group: "dito-apps-deploy"
group: "digitalcheck-apps-deploy"
cancel-in-progress: false
permissions:
packages: read
Expand Down
88 changes: 88 additions & 0 deletions .github/workflows/check-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Pipeline

on:
workflow_call:
inputs:
flag:
required: false
type: string
description: "Additional flag to pass to the build script (e.g. --workspace=dito)"

jobs:
check-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: npm
cache-dependency-path: "**/package-lock.json"

- name: Cache npm dependencies
id: cache-npm-deps
uses: actions/cache@v4
with:
path: |
**/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: Install dependencies
if: steps.cache-npm-deps.outputs.cache-hit != 'true'
run: npm ci

- name: Audit used licences
HendrikSchmidt marked this conversation as resolved.
Show resolved Hide resolved
run: npm run audit:licences

- name: Check format
run: npm run format:check

- name: Lint
run: npm run lint:check

- name: Check types
run: npm run typecheck ${{ inputs.flag }}

- name: Run unit tests
run: npm test ${{ inputs.flag }}

- name: Install E2E & A11y test dependencies
run: |
npx --yes playwright install --with-deps

- name: Run E2E tests
id: e2e
run: npm run test:e2e ${{ inputs.flag }}

- uses: actions/upload-artifact@v4
if: ${{ failure() && steps.e2e.outcome == 'failure' }}
with:
name: playwright-e2e-test-results
path: packages/*/test/e2e/playwright-report

- name: Run A11y tests
id: a11y
run: npm run test:a11y ${{ inputs.flag }}
env:
# Use a different port (from the one used with E2E tests) to workaround problem in CI/GitHub Actions,
# starting to occur with playwright/test 1.28.0:
# Error: http://localhost:4173 is already used ...
# See https://github.com/digitalservicebund/typescript-vite-application-template/actions/runs/3486985178/jobs/5834089375
VITE_PORT: 4183

- uses: actions/upload-artifact@v4
if: ${{ failure() && steps.a11y.outcome == 'failure' }}
with:
name: playwright-a11y-test-results
path: packages/*/test/a11y/playwright-report

- name: Send failure to Slack
uses: digitalservicebund/notify-on-failure-gha@814d0c4b2ad6a3443e89c991f8657b10126510bf # v1.5.0
if: ${{ failure() }}
with:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
38 changes: 38 additions & 0 deletions .github/workflows/pipeline-dito.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: PipelineDiTo

on:
workflow_dispatch:
push:
branches: [main]
paths:
- "packages/dito/**"
- ".github/workflows/**"
- "!.github/workflows/shared.yml"
HendrikSchmidt marked this conversation as resolved.
Show resolved Hide resolved
pull_request:
branches: [main]
paths:
- "packages/dito/**"
- ".github/workflows/**"
- "!.github/workflows/shared.yml"
HendrikSchmidt marked this conversation as resolved.
Show resolved Hide resolved

jobs:
check-and-test:
uses: ./.github/workflows/check-and-test.yml
with:
flag: "--workspace=packages/dito"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the input the whole flag instead of just the package name (similar to the build-and-deploy.yml workflow? Are there current use cases where this is needed? Otherwise I would say YAGNI and KISS 🤪 and streamline aka. use only package name as input.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finde die Varianten alle nicht besonders schön: https://github.com/orgs/community/discussions/25725

secrets: inherit

vulnerability-scan:
uses: ./.github/workflows/scan.yml
secrets: inherit

build-and-deploy:
needs:
- check-and-test
- vulnerability-scan
if: ${{ github.ref == 'refs/heads/main' }}
uses: ./.github/workflows/build-and-deploy.yml
with:
package: dito
environment: production
secrets: inherit
42 changes: 42 additions & 0 deletions .github/workflows/pipeline-shared.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: PipelineShared

on:
workflow_dispatch:
push:
branches: [main]
paths-ignore:
- "packages/dito/**"
mpanne marked this conversation as resolved.
Show resolved Hide resolved
- ".github/workflows/pipeline-dito.yml"
- "packages/tool-finder/**"
- ".github/workflows/pipeline-tool-finder.yml"
pull_request:
branches: [main]
paths-ignore:
- "packages/dito/**"
- ".github/workflows/pipeline-dito.yml"
- "packages/tool-finder/**"
- ".github/workflows/pipeline-tool-finder.yml"

jobs:
check-and-test:
uses: ./.github/workflows/check-and-test.yml
secrets: inherit

vulnerability-scan:
uses: ./.github/workflows/scan.yml
secrets: inherit

build-and-deploy:
needs:
- check-and-test
- vulnerability-scan
if: ${{ github.ref == 'refs/heads/main' }}
uses: ./.github/workflows/build-and-deploy.yml
strategy:
fail-fast: false
matrix:
package: [dito, tool-finder]
with:
package: ${{ matrix.package }}
environment: production
secrets: inherit
38 changes: 38 additions & 0 deletions .github/workflows/pipeline-tool-finder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: PipelineToolFinder

on:
workflow_dispatch:
push:
branches: [main]
paths:
- "packages/tool-finder/**"
- ".github/workflows/**"
- "!.github/workflows/shared.yml"
pull_request:
branches: [main]
paths:
- "packages/tool-finder/**"
- ".github/workflows/**"
- "!.github/workflows/shared.yml"

jobs:
check-and-test:
uses: ./.github/workflows/check-and-test.yml
with:
flag: "--workspace=packages/tool-finder"
secrets: inherit

vulnerability-scan:
uses: ./.github/workflows/scan.yml
secrets: inherit

build-and-deploy:
needs:
- check-and-test
- vulnerability-scan
if: ${{ github.ref == 'refs/heads/main' }}
uses: ./.github/workflows/build-and-deploy.yml
with:
package: tool-finder
environment: production
secrets: inherit
178 changes: 0 additions & 178 deletions .github/workflows/pipeline.yml

This file was deleted.

Loading
Loading