Skip to content

use cross-spawn instead #31754

use cross-spawn instead

use cross-spawn instead #31754

Workflow file for this run

name: CI Tests
on:
- pull_request
- push
- merge_group
env:
CI: true
NO_COLOR: true
permissions:
contents: read
concurrency:
# node-test-[pull_request|push]-[branch], typically. Will cancel previous runs that match!
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
if: contains(fromJSON('["pull_request", "merge_group"]'), github.event_name)
strategy:
matrix:
node-version:
- "20"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: npm
cache-dependency-path: npm-shrinkwrap.json
- run: npm i -g [email protected]
- run: npm ci
- run: npm run lint:changed-files
- run: npm run lint
working-directory: firebase-vscode
vscode_unit:
runs-on: macos-latest
strategy:
matrix:
node-version:
- "18"
- "20"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: npm
cache-dependency-path: firebase-vscode/package-lock.json
- run: npm i -g [email protected]
- run: npm ci
- run: npm install
working-directory: firebase-vscode
- run: npm run build
working-directory: firebase-vscode
- run: npm run test:unit
working-directory: firebase-vscode
- uses: codecov/codecov-action@v3
if: matrix.node-version == '20'
vscode_integration:
runs-on: macos-latest
strategy:
matrix:
node-version:
- "18"
- "20"
env:
FIREBASE_EMULATORS_PATH: ${{ github.workspace }}/emulator-cache
# This overrides the binary which runs firebase commands in the extension tasks such as emulator start.
# Currently, CI fails to start with npx so we change it to the global firebase binary.
FIREBASE_BINARY: firebase
steps:
- name: Setup Java JDK
uses: actions/[email protected]
with:
java-version: 17
distribution: temurin
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: npm
cache-dependency-path: firebase-vscode/package-lock.json
# TODO temporary workaround for GitHub Actions CI issue:
# npm ERR! Your cache folder contains root-owned files, due to a bug in
# npm ERR! previous versions of npm which has since been addressed.
- run: sudo chown -R 501:20 "/Users/runner/.npm" || exit 1
- run: npm ci
- run: npm install
working-directory: firebase-vscode
- run: npm run build
working-directory: firebase-vscode
- run: npm i -g firebase-tools@latest
- uses: GabrielBB/xvfb-action@v1
with:
run: npm run test:e2e
working-directory: firebase-vscode
- uses: actions/upload-artifact@v3
if: failure()
with:
name: screenshots
path: firebase-vscode/src/test/screenshots
- uses: codecov/codecov-action@v3
if: matrix.node-version == '20'
unit:
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- "18"
- "20"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: npm
cache-dependency-path: npm-shrinkwrap.json
- run: npm i -g [email protected]
- run: npm ci
- run: npm test -- -- --forbid-only
- uses: codecov/codecov-action@v3
if: matrix.node-version == '20'
integration:
needs: unit
if: contains(fromJSON('["push", "merge_group"]'), github.event_name)
runs-on: ubuntu-latest
env:
FIREBASE_EMULATORS_PATH: ${{ github.workspace }}/emulator-cache
COMMIT_SHA: ${{ github.sha }}
CI_JOB_ID: ${{ github.action }}
FBTOOLS_TARGET_PROJECT: ${{ secrets.FBTOOLS_TARGET_PROJECT }}
FBTOOLS_CLIENT_INTEGRATION_SITE: ${{ secrets.FBTOOLS_CLIENT_INTEGRATION_SITE }}
CI_RUN_ID: ${{ github.run_id }}
CI_RUN_ATTEMPT: ${{ github.run_attempt }}
strategy:
fail-fast: false
matrix:
node-version:
- "20"
script:
- npm run test:client-integration
- npm run test:emulator
- npm run test:extensions-emulator
- npm run test:frameworks
- npm run test:functions-discover
- npm run test:hosting
# - npm run test:hosting-rewrites # Long-running test that might conflict across test runs. Run this manually.
- npm run test:import-export
- npm run test:storage-deploy
- npm run test:storage-emulator-integration
- npm run test:triggers-end-to-end
- npm run test:triggers-end-to-end:inspect
- npm run test:dataconnect-deploy
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: npm
cache-dependency-path: npm-shrinkwrap.json
- name: Cache firebase emulators
uses: actions/cache@v3
with:
path: ${{ env.FIREBASE_EMULATORS_PATH }}
key: ${{ runner.os }}-firebase-emulators-${{ hashFiles('emulator-cache/**') }}
continue-on-error: true
- run: npm i -g [email protected]
- run: npm ci
- run: echo ${{ secrets.service_account_json_base64 }} | base64 -d > ./scripts/service-account.json
- run: ${{ matrix.script }}
- name: Print debug logs
if: failure()
run: find . -type f -name "*debug.log" | xargs cat
integration-windows:
needs: unit
if: contains(fromJSON('["push", "merge_group"]'), github.event_name)
runs-on: windows-latest
env:
FIREBASE_EMULATORS_PATH: ${{ github.workspace }}/emulator-cache
COMMIT_SHA: ${{ github.sha }}
CI_JOB_ID: ${{ github.action }}
FBTOOLS_TARGET_PROJECT: ${{ secrets.FBTOOLS_TARGET_PROJECT }}
FBTOOLS_CLIENT_INTEGRATION_SITE: ${{ secrets.FBTOOLS_CLIENT_INTEGRATION_SITE }}
CI_RUN_ID: ${{ github.run_id }}
CI_RUN_ATTEMPT: ${{ github.run_attempt }}
strategy:
fail-fast: false
matrix:
node-version:
- "20"
script:
- npm run test:hosting
# - npm run test:hosting-rewrites # Long-running test that might conflict across test runs. Run this manually.
- npm run test:client-integration
- npm run test:emulator
# - npm run test:import-export # Fails becuase port 4000 is taken after first run - hub not shutting down?
# - npm run test:extensions-emulator # Fails due to cannot find module sharp (not waiting for npm install?)
- npm run test:functions-discover
# - npm run test:triggers-end-to-end
- npm run test:triggers-end-to-end:inspect
- npm run test:storage-deploy
# - npm run test:storage-emulator-integration
# - npm run test:dataconnect-deploy # TODO (joehanley): Reenable this - it should be safe to run in parallel
- npm run test:frameworks
steps:
- name: Setup Java JDK
uses: actions/[email protected]
with:
java-version: 17
distribution: temurin
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: npm
cache-dependency-path: npm-shrinkwrap.json
- name: Cache firebase emulators
uses: actions/cache@v3
with:
path: ${{ env.FIREBASE_EMULATORS_PATH }}
key: ${{ runner.os }}-firebase-emulators-${{ hashFiles('emulator-cache/**') }}
continue-on-error: true
- run: echo ${{ secrets.service_account_json_base64 }} > tmp.txt
- run: certutil -decode tmp.txt scripts/service-account.json
- run: npm i -g [email protected]
- run: npm ci
- run: ${{ matrix.script }}
- name: Print debug logs
if: failure()
run: type *debug.log
check-package-lock:
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- "20"
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm i -g [email protected]
# --ignore-scripts prevents the `prepare` script from being run.
- run: npm install --package-lock-only --ignore-scripts
- run: "git diff --exit-code -- npm-shrinkwrap.json || (echo 'Error: npm-shrinkwrap.json is changed during npm install! Please make sure to use npm >= 8 and commit npm-shrinkwrap.json.' && false)"
check-package-lock-vsce:
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- "20"
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm i -g [email protected]
# --ignore-scripts prevents the `prepare` script from being run.
- run: "(cd firebase-vscode && npm install --package-lock-only --ignore-scripts)"
- run: "git diff --exit-code -- firebase-vscode/package-lock.json || (echo 'Error: firebase-vscode/package-lock.json is changed during npm install! Please make sure to use npm >= 8 and commit firebase-vscode/package-lock.json.' && false)"
check-json-schema:
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- "20"
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: npm
cache-dependency-path: npm-shrinkwrap.json
- run: npm install
- run: npm run generate:json-schema
- run: "git diff --exit-code -- schema/*.json || (echo 'Error: JSON schema is changed! Please run npm run generate:json-schema and commit the results.' && false)"