Skip to content

Commit e87fcee

Browse files
committed
use build in test-all jobs
1 parent 369e2ba commit e87fcee

File tree

2 files changed

+65
-77
lines changed

2 files changed

+65
-77
lines changed

.github/workflows/build.yaml renamed to .github/workflows/build.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
- name: Upload build archive
5858
uses: actions/upload-artifact@v4
5959
with:
60-
name: dists
60+
name: dists-${{ github.ref }}
6161
path: |
6262
packages/**/dist
6363
repo-scripts/**/dist
@@ -74,7 +74,7 @@ jobs:
7474
- name: Download build archive
7575
uses: actions/download-artifact@v4
7676
with:
77-
name: dists
77+
name: dists-${{ github.ref }}
7878
- uses: actions/setup-node@v4
7979
with:
8080
node-version-file: '.nvmrc'

.github/workflows/test-all.yml

+63-75
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@
1414

1515
name: Test All Packages
1616

17-
on: pull_request
17+
on:
18+
workflow_run:
19+
workflows: ["Build"]
20+
types:
21+
- completed
1822

1923
env:
2024
# make chromedriver detect installed Chrome version and download the corresponding driver
@@ -30,63 +34,34 @@ env:
3034
NODE_OPTIONS: "--max_old_space_size=4096"
3135

3236
jobs:
33-
build:
34-
name: Build the SDK
35-
runs-on: ubuntu-latest
36-
steps:
37-
# Install Chrome so the correct version of webdriver can be installed by chromedriver when
38-
# setting up the repo. This must be done to build and execute Auth properly.
39-
- name: install Chrome stable
40-
run: |
41-
npx @puppeteer/browsers install chrome@stable
42-
- uses: actions/checkout@v3
43-
- name: Set up Node (20)
44-
uses: actions/setup-node@v4
45-
with:
46-
node-version-file: '.nvmrc'
47-
- name: Test setup and yarn install
48-
run: |
49-
cp config/ci.config.json config/project.json
50-
yarn
51-
- name: yarn build
52-
run: yarn build
53-
- name: Archive build
54-
if: ${{ !cancelled() }}
55-
run: |
56-
tar -cf build.tar --exclude=.git .
57-
gzip build.tar
58-
- name: Upload build archive
59-
if: ${{ !cancelled() }}
60-
uses: actions/upload-artifact@v3
61-
with:
62-
name: build.tar.gz
63-
path: build.tar.gz
64-
retention-days: ${{ env.artifactRetentionDays }}
65-
6637
# Auth and Firestore are built and executed in their own jobs in an attempt to reduce flakiness.
6738
test-the-rest:
39+
if: ${{ github.event.workflow_run.conclusion == 'success'}}
6840
name: (bulk) Node.js and Browser (Chrome) Tests
69-
needs: build
7041
runs-on: ubuntu-latest
7142
steps:
7243
# install Chrome first, so the correct version of webdriver can be installed by chromedriver when setting up the repo
7344
- name: install Chrome stable
7445
run: |
7546
npx @puppeteer/browsers install chrome@stable
7647
- name: Download build archive
77-
uses: actions/download-artifact@v3
48+
uses: actions/download-artifact@v4
7849
with:
79-
name: build.tar.gz
80-
- name: Unzip build artifact
81-
run: tar xf build.tar.gz
82-
- name: Set up Node (20)
83-
uses: actions/setup-node@v4
50+
name: dists-${{ github.ref }}
51+
- uses: actions/setup-node@v4
8452
with:
8553
node-version-file: '.nvmrc'
86-
- name: Test setup and yarn install
87-
run: |
88-
cp config/ci.config.json config/project.json
89-
yarn
54+
cache: yarn
55+
cache-dependency-path: yarn.lock
56+
- name: Restore cached node_modules
57+
uses: actions/cache@v4
58+
id: node_modules
59+
with:
60+
path: "**/node_modules"
61+
key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
62+
- run: yarn install --frozen-lockfile
63+
- name: Test setup
64+
run: cp config/ci.config.json config/project.json
9065
- name: Set start timestamp env var
9166
run: echo "FIREBASE_CI_TEST_START_TIME=$(date +%s)" >> $GITHUB_ENV
9267
- name: Run unit tests
@@ -106,8 +81,8 @@ jobs:
10681
continue-on-error: true
10782

10883
test-auth:
84+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
10985
name: (Auth) Node.js and Browser (Chrome) Tests
110-
needs: build
11186
runs-on: ubuntu-latest
11287
steps:
11388
# install Chrome first, so the correct version of webdriver can be installed by chromedriver
@@ -125,19 +100,23 @@ jobs:
125100
run: |
126101
echo $CHROME_VERSION_NOTES=$CHROME_VERSION_MISMATCH_MESSAGE
127102
- name: Download build archive
128-
uses: actions/download-artifact@v3
103+
uses: actions/download-artifact@v4
129104
with:
130-
name: build.tar.gz
131-
- name: Unzip build artifact
132-
run: tar xf build.tar.gz
133-
- name: Set up Node (20)
134-
uses: actions/setup-node@v4
105+
name: dists-${{ github.ref }}
106+
- uses: actions/setup-node@v4
135107
with:
136108
node-version-file: '.nvmrc'
137-
- name: Test setup and yarn install
138-
run: |
139-
cp config/ci.config.json config/project.json
140-
yarn
109+
cache: yarn
110+
cache-dependency-path: yarn.lock
111+
- name: Restore cached node_modules
112+
uses: actions/cache@v4
113+
id: node_modules
114+
with:
115+
path: "**/node_modules"
116+
key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
117+
- run: yarn install --frozen-lockfile
118+
- name: Test setup
119+
run: cp config/ci.config.json config/project.json
141120
- name: Set start timestamp env var
142121
run: echo "FIREBASE_CI_TEST_START_TIME=$(date +%s)" >> $GITHUB_ENV
143122
- name: Run unit tests
@@ -156,28 +135,32 @@ jobs:
156135
continue-on-error: true
157136

158137
test-firestore:
138+
if: ${{ github.event.workflow_run.conclusion == 'success'}}
159139
name: (Firestore) Node.js and Browser (Chrome) Tests
160-
needs: build
161140
runs-on: ubuntu-latest
162141
steps:
163142
# install Chrome so the correct version of webdriver can be installed by chromedriver when setting up the repo
164143
- name: install Chrome stable
165144
run: |
166145
npx @puppeteer/browsers install chrome@stable
167146
- name: Download build archive
168-
uses: actions/download-artifact@v3
147+
uses: actions/download-artifact@v4
169148
with:
170-
name: build.tar.gz
171-
- name: Unzip build artifact
172-
run: tar xf build.tar.gz
173-
- name: Set up Node (20)
174-
uses: actions/setup-node@v4
149+
name: dists-${{ github.ref }}
150+
- uses: actions/setup-node@v4
175151
with:
176152
node-version-file: '.nvmrc'
177-
- name: Test setup and yarn install
178-
run: |
179-
cp config/ci.config.json config/project.json
180-
yarn
153+
cache: yarn
154+
cache-dependency-path: yarn.lock
155+
- name: Restore cached node_modules
156+
uses: actions/cache@v4
157+
id: node_modules
158+
with:
159+
path: "**/node_modules"
160+
key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
161+
- run: yarn install --frozen-lockfile
162+
- name: Test setup
163+
run: cp config/ci.config.json config/project.json
181164
- name: Set start timestamp env var
182165
run: echo "FIREBASE_CI_TEST_START_TIME=$(date +%s)" >> $GITHUB_ENV
183166
- name: Run unit tests
@@ -196,30 +179,35 @@ jobs:
196179
path-to-lcov: ./lcov-all.info
197180
continue-on-error: true
198181
test-firestore-integration:
182+
if: ${{ github.event.workflow_run.conclusion == 'success'}}
199183
strategy:
200184
fail-fast: false
201185
matrix:
202186
persistence: ['memory', 'persistence']
203187
name: Firestore Integration Tests (${{ matrix.persistence }})
204-
needs: build
205188
runs-on: ubuntu-latest
206189
steps:
207190
# install Chrome so the correct version of webdriver can be installed by chromedriver when setting up the repo
208191
- name: install Chrome stable
209192
run: |
210193
npx @puppeteer/browsers install chrome@stable
211194
- name: Download build archive
212-
uses: actions/download-artifact@v3
195+
uses: actions/download-artifact@v4
213196
with:
214-
name: build.tar.gz
215-
- name: Unzip build artifact
216-
run: tar xf build.tar.gz
217-
- name: Set up Node (20)
218-
uses: actions/setup-node@v4
197+
name: dists-${{ github.ref }}
198+
- uses: actions/setup-node@v4
219199
with:
220200
node-version-file: '.nvmrc'
201+
cache: yarn
202+
cache-dependency-path: yarn.lock
203+
- name: Restore cached node_modules
204+
uses: actions/cache@v4
205+
id: node_modules
206+
with:
207+
path: "**/node_modules"
208+
key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
209+
- run: yarn install --frozen-lockfile
221210
- run: cp config/ci.config.json config/project.json
222-
- run: yarn
223211
- run: yarn build:${{ matrix.persistence }}
224212
working-directory: integration/firestore
225213
- run: xvfb-run yarn karma:singlerun

0 commit comments

Comments
 (0)