-
-
Notifications
You must be signed in to change notification settings - Fork 78
184 lines (168 loc) · 5.65 KB
/
Copy pathbuild.yml
File metadata and controls
184 lines (168 loc) · 5.65 KB
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
name: Daffodil Build
on:
push:
branches:
- develop
workflow_call:
inputs:
ref:
required: true
type: string
cache-mode:
required: true
type: string
secrets:
NX_KEY:
required: true
AZURE_STORAGE_CONNECTION_STRING:
required: true
VERCEL_DAFFIO_NEXT_PROJECT_ID:
required: false
VERCEL_DAFFIO_PROJECT_ID:
required: false
VERCEL_TOKEN:
required: false
VERCEL_ORG:
required: false
env:
NX_KEY: ${{ secrets.NX_KEY }}
NG_BUILD_ENV: ${{ github.event_name == 'push' && github.ref_type == 'tag' && 'production' || 'next' }}
NPM_VERSION: 11
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
strategy:
matrix:
node: [22.21.x]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
ref: ${{ inputs.ref && inputs.ref || github.sha }}
persist-credentials: false
- uses: graycoreio/daffodil/.github/actions/setup-nx-remote-cache@develop
with:
cache-mode: ${{ inputs.cache-mode }}
read-only-azure-connection-string: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}
read-write-azure-connection-string: ${{ secrets.AZURE_NX_CACHE_READWRITE_CONNECTION_STRING }}
event-name: ${{ github.event_name }}
- uses: graycoreio/github-actions/setup-node@main
with:
node-version: ${{ matrix.node }}
npm-version: ${{ env.NPM_VERSION }}
use-stamp-cache: true
- run: npx nx run-many -t lint
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
node: [22.21.x]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
ref: ${{ inputs.ref && inputs.ref || github.sha }}
persist-credentials: false
- uses: graycoreio/github-actions/setup-node@main
with:
node-version: ${{ matrix.node }}
npm-version: ${{ env.NPM_VERSION }}
use-stamp-cache: true
- uses: graycoreio/daffodil/.github/actions/setup-nx-remote-cache@develop
with:
cache-mode: ${{ inputs.cache-mode }}
read-only-azure-connection-string: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}
read-write-azure-connection-string: ${{ secrets.AZURE_NX_CACHE_READWRITE_CONNECTION_STRING }}
event-name: ${{ github.event_name }}
- run: npx nx run-many -t build --parallel=1
- run: cd dist/apps/daffio && zip -r ../daffio.zip .
- uses: actions/upload-artifact@v4
with:
name: daffio-${{ matrix.node }}
path: dist/apps/daffio.zip
if-no-files-found: error
compute_packages:
name: Compute Packages to Test
outputs:
packages: ${{ steps.compute.outputs.packages }}
runs-on: ubuntu-latest
needs: [ ]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref && inputs.ref || github.sha }}
fetch-depth: 0
persist-credentials: false
- uses: graycoreio/github-actions/setup-node@main
with:
node-version: '22.21.x'
npm-version: ${{ env.NPM_VERSION }}
use-stamp-cache: true
- uses: nrwl/nx-set-shas@v3
name: Derive appropriate SHAs for base and head for `nx affected` commands
with:
main-branch-name: 'develop'
- name: packages
id: compute
shell: bash
run: |
packages=$(npx nx show projects --affected --json)
echo "packages=$packages" >> ${GITHUB_OUTPUT}
test:
name: Test
runs-on: ubuntu-latest
if: ${{ needs.compute_packages.outputs.packages != '[]' && needs.compute_packages.outputs.packages != '' }}
strategy:
fail-fast: false
matrix:
package: ${{ fromJSON(needs.compute_packages.outputs.packages) }}
node: [22.21.x]
needs:
- compute_packages
- build
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
ref: ${{ inputs.ref && inputs.ref || github.sha }}
persist-credentials: false
- uses: graycoreio/daffodil/.github/actions/setup-nx-remote-cache@develop
with:
cache-mode: ${{ inputs.cache-mode }}
read-only-azure-connection-string: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}
read-write-azure-connection-string: ${{ secrets.AZURE_NX_CACHE_READWRITE_CONNECTION_STRING }}
event-name: ${{ github.event_name }}
- uses: graycoreio/github-actions/setup-node@main
with:
node-version: ${{ matrix.node }}
npm-version: ${{ env.NPM_VERSION }}
use-stamp-cache: true
- run: npx nx run-many -t test -p ${{ matrix.package }} --parallel=1
name: Test ${{ matrix.package }}
test-commerce-schematic:
name: Test Commerce Schematic
needs:
- build
uses: ./.github/workflows/test-commerce-schematic.yml
with:
ref: ${{ inputs.ref && inputs.ref || github.sha }}
node-versions: '22.21.x'
secrets:
NX_KEY: ${{ secrets.NX_KEY }}
AZURE_NX_CACHE_READONLY_CONNECTION_STRING: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING || secrets.AZURE_NX_CACHE_READONLY_CONNECTION_STRING }}
deploy_daffio:
name: Deploy Daff.io
needs:
- build
uses: ./.github/workflows/deploy.yml
if: ${{ github.event_name == 'push' }}
secrets:
VERCEL_NEXT_PROJECT_ID: ${{ secrets.VERCEL_DAFFIO_NEXT_PROJECT_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_DAFFIO_PROJECT_ID }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VERCEL_ORG: ${{ secrets.VERCEL_ORG }}
with:
artifact: daffio-22.21.x
artifact-zip-name: daffio.zip