Skip to content

Commit

Permalink
use build in test-all jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
dlarocque committed Nov 4, 2024
1 parent 369e2ba commit e87fcee
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 77 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml → .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
- name: Upload build archive
uses: actions/upload-artifact@v4
with:
name: dists
name: dists-${{ github.ref }}
path: |
packages/**/dist
repo-scripts/**/dist
Expand All @@ -74,7 +74,7 @@ jobs:
- name: Download build archive
uses: actions/download-artifact@v4
with:
name: dists
name: dists-${{ github.ref }}
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
Expand Down
138 changes: 63 additions & 75 deletions .github/workflows/test-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@

name: Test All Packages

on: pull_request
on:
workflow_run:
workflows: ["Build"]
types:
- completed

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

jobs:
build:
name: Build the SDK
runs-on: ubuntu-latest
steps:
# Install Chrome so the correct version of webdriver can be installed by chromedriver when
# setting up the repo. This must be done to build and execute Auth properly.
- name: install Chrome stable
run: |
npx @puppeteer/browsers install chrome@stable
- uses: actions/checkout@v3
- name: Set up Node (20)
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Test setup and yarn install
run: |
cp config/ci.config.json config/project.json
yarn
- name: yarn build
run: yarn build
- name: Archive build
if: ${{ !cancelled() }}
run: |
tar -cf build.tar --exclude=.git .
gzip build.tar
- name: Upload build archive
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v3
with:
name: build.tar.gz
path: build.tar.gz
retention-days: ${{ env.artifactRetentionDays }}

# Auth and Firestore are built and executed in their own jobs in an attempt to reduce flakiness.
test-the-rest:
if: ${{ github.event.workflow_run.conclusion == 'success'}}
name: (bulk) Node.js and Browser (Chrome) Tests
needs: build
runs-on: ubuntu-latest
steps:
# install Chrome first, so the correct version of webdriver can be installed by chromedriver when setting up the repo
- name: install Chrome stable
run: |
npx @puppeteer/browsers install chrome@stable
- name: Download build archive
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: build.tar.gz
- name: Unzip build artifact
run: tar xf build.tar.gz
- name: Set up Node (20)
uses: actions/setup-node@v4
name: dists-${{ github.ref }}
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Test setup and yarn install
run: |
cp config/ci.config.json config/project.json
yarn
cache: yarn
cache-dependency-path: yarn.lock
- name: Restore cached node_modules
uses: actions/cache@v4
id: node_modules
with:
path: "**/node_modules"
key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
- run: yarn install --frozen-lockfile
- name: Test setup
run: cp config/ci.config.json config/project.json
- name: Set start timestamp env var
run: echo "FIREBASE_CI_TEST_START_TIME=$(date +%s)" >> $GITHUB_ENV
- name: Run unit tests
Expand All @@ -106,8 +81,8 @@ jobs:
continue-on-error: true

test-auth:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
name: (Auth) Node.js and Browser (Chrome) Tests
needs: build
runs-on: ubuntu-latest
steps:
# install Chrome first, so the correct version of webdriver can be installed by chromedriver
Expand All @@ -125,19 +100,23 @@ jobs:
run: |
echo $CHROME_VERSION_NOTES=$CHROME_VERSION_MISMATCH_MESSAGE
- name: Download build archive
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: build.tar.gz
- name: Unzip build artifact
run: tar xf build.tar.gz
- name: Set up Node (20)
uses: actions/setup-node@v4
name: dists-${{ github.ref }}
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Test setup and yarn install
run: |
cp config/ci.config.json config/project.json
yarn
cache: yarn
cache-dependency-path: yarn.lock
- name: Restore cached node_modules
uses: actions/cache@v4
id: node_modules
with:
path: "**/node_modules"
key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
- run: yarn install --frozen-lockfile
- name: Test setup
run: cp config/ci.config.json config/project.json
- name: Set start timestamp env var
run: echo "FIREBASE_CI_TEST_START_TIME=$(date +%s)" >> $GITHUB_ENV
- name: Run unit tests
Expand All @@ -156,28 +135,32 @@ jobs:
continue-on-error: true

test-firestore:
if: ${{ github.event.workflow_run.conclusion == 'success'}}
name: (Firestore) Node.js and Browser (Chrome) Tests
needs: build
runs-on: ubuntu-latest
steps:
# install Chrome so the correct version of webdriver can be installed by chromedriver when setting up the repo
- name: install Chrome stable
run: |
npx @puppeteer/browsers install chrome@stable
- name: Download build archive
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: build.tar.gz
- name: Unzip build artifact
run: tar xf build.tar.gz
- name: Set up Node (20)
uses: actions/setup-node@v4
name: dists-${{ github.ref }}
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Test setup and yarn install
run: |
cp config/ci.config.json config/project.json
yarn
cache: yarn
cache-dependency-path: yarn.lock
- name: Restore cached node_modules
uses: actions/cache@v4
id: node_modules
with:
path: "**/node_modules"
key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
- run: yarn install --frozen-lockfile
- name: Test setup
run: cp config/ci.config.json config/project.json
- name: Set start timestamp env var
run: echo "FIREBASE_CI_TEST_START_TIME=$(date +%s)" >> $GITHUB_ENV
- name: Run unit tests
Expand All @@ -196,30 +179,35 @@ jobs:
path-to-lcov: ./lcov-all.info
continue-on-error: true
test-firestore-integration:
if: ${{ github.event.workflow_run.conclusion == 'success'}}
strategy:
fail-fast: false
matrix:
persistence: ['memory', 'persistence']
name: Firestore Integration Tests (${{ matrix.persistence }})
needs: build
runs-on: ubuntu-latest
steps:
# install Chrome so the correct version of webdriver can be installed by chromedriver when setting up the repo
- name: install Chrome stable
run: |
npx @puppeteer/browsers install chrome@stable
- name: Download build archive
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: build.tar.gz
- name: Unzip build artifact
run: tar xf build.tar.gz
- name: Set up Node (20)
uses: actions/setup-node@v4
name: dists-${{ github.ref }}
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: yarn
cache-dependency-path: yarn.lock
- name: Restore cached node_modules
uses: actions/cache@v4
id: node_modules
with:
path: "**/node_modules"
key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
- run: yarn install --frozen-lockfile
- run: cp config/ci.config.json config/project.json
- run: yarn
- run: yarn build:${{ matrix.persistence }}
working-directory: integration/firestore
- run: xvfb-run yarn karma:singlerun
Expand Down

0 comments on commit e87fcee

Please sign in to comment.