-
Notifications
You must be signed in to change notification settings - Fork 16
128 lines (104 loc) · 5.42 KB
/
trunk.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: trunk
on:
push:
branches: [main]
defaults:
run:
shell: bash
concurrency:
group: ${{ github.ref_name }}.${{ github.sha }}.trunk
cancel-in-progress: true
jobs:
checks:
runs-on: ubuntu-latest
outputs:
changes: ${{ steps.check-changes.outputs.changes }}
deploy: ${{ steps.check-changes.outputs.deploy }}
origin: ${{ steps.check-origin.outputs.origin }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Setup environment
uses: ./.github/actions/setup-environment
- name: Check changes
id: check-changes
uses: ./.github/actions/check-changes
- name: Check origin
id: check-origin
uses: ./.github/actions/check-origin
trunk:
needs: checks
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Setup environment
if: ${{ fromJSON(needs.checks.outputs.changes).dependencies == 'true' || fromJSON(needs.checks.outputs.changes).src == 'true' || fromJSON(needs.checks.outputs.changes).storybook == 'true' || fromJSON(needs.checks.outputs.changes).shelltools == 'true' }}
uses: ./.github/actions/setup-environment
with:
compodoc: true
cypress: true
firebase-tools: true
- name: Lint shell
if: fromJSON(needs.checks.outputs.changes).shelltools == 'true'
run: |
sudo apt install shellcheck
npx nx run tools:lint-shell
- name: Lint ts
if: ${{ fromJSON(needs.checks.outputs.changes).dependencies == 'true' || fromJSON(needs.checks.outputs.changes).src == 'true' || fromJSON(needs.checks.outputs.changes).storybook == 'true' }}
run: npx nx run-many --target lint --all
- name: Lint html
if: ${{ fromJSON(needs.checks.outputs.changes).dependencies == 'true' || fromJSON(needs.checks.outputs.changes).src == 'true' || fromJSON(needs.checks.outputs.changes).storybook == 'true' }}
run: npx nx run-many --target prettier-check --dryRun --all
- name: Lint scss
if: ${{ fromJSON(needs.checks.outputs.changes).dependencies == 'true' || fromJSON(needs.checks.outputs.changes).src == 'true' || fromJSON(needs.checks.outputs.changes).storybook == 'true' }}
run: npx nx run-many --target stylelint-check --dryRun --all
- name: Unit test
if: ${{ fromJSON(needs.checks.outputs.changes).dependencies == 'true' || fromJSON(needs.checks.outputs.changes).src == 'true' }}
run: |
npx nx run-many --target test --all --pass-with-no-tests --code-coverage --run-in-band --ci
npx nx run tools:coverage-stats
cat ./UNIT_COVERAGE.md >> $GITHUB_STEP_SUMMARY
- name: Build
if: ${{ fromJSON(needs.checks.outputs.changes).dependencies == 'true' || fromJSON(needs.checks.outputs.changes).src == 'true' || fromJSON(needs.checks.outputs.changes).storybook == 'true' }}
run: |
SKIP_FORMAT="true" yarn generate:env:documentation
npx nx run-many --target configure-env --all --parallel 1
npx nx run-many --target build --all --parallel 1 --configuration production
npx nx run-many --target configure-env --all --parallel 1 --reset
- name: Documentation assets
if: ${{ fromJSON(needs.checks.outputs.changes).dependencies == 'true' || fromJSON(needs.checks.outputs.changes).src == 'true' || fromJSON(needs.checks.outputs.changes).storybook == 'true' }}
run: |
bash tools/shell/test.sh reports || exit 1
yarn generate:unit-test-coverage-index
npx nx run tools:compodoc-build
cp -r ./dist/compodoc ./dist/apps/documentation/browser/assets
yarn generate:changelog
npx nx run-many --target e2e --all --parallel 1 || true
bash tools/shell/e2e.sh reports || exit 1
yarn generate:e2e-test-report-index
npx nx run documentation:build-storybook
cp -r ./dist/storybook/documentation ./dist/apps/documentation/browser/assets/storybook
- name: Upload dist artifact
if: ${{ fromJSON(needs.checks.outputs.changes).dependencies == 'true' || fromJSON(needs.checks.outputs.changes).src == 'true' || fromJSON(needs.checks.outputs.changes).storybook == 'true' }}
uses: ./.github/actions/dist-artifact-upload
- name: Cleanup
run: rm -rf ./.env ./functions/.env
deploy-apps:
needs: [checks, trunk]
if: ${{ needs.checks.outputs.origin == 'true' && fromJSON(needs.checks.outputs.changes).deploy == 'true' }}
uses: ./.github/workflows/deploy-apps.yml
secrets: inherit
with:
api: false # This only works with a paid plan such as Blaze (https://firebase.google.com/pricing/)
client: ${{ fromJSON(needs.checks.outputs.changes).dependencies == 'true' || fromJSON(needs.checks.outputs.changes).src == 'true' }}
elements: ${{ fromJSON(needs.checks.outputs.changes).dependencies == 'true' || fromJSON(needs.checks.outputs.changes).src == 'true' }}
documentation: ${{ fromJSON(needs.checks.outputs.changes).deploy == 'true' }}
publish-packages:
needs: [checks, trunk]
if: ${{ needs.checks.outputs.origin == 'true' && fromJSON(needs.checks.outputs.changes).packages == 'true' }}
uses: ./.github/workflows/publish-packages.yml
secrets: inherit