mirror of
https://github.com/expo/eas-cli.git
synced 2026-11-15 17:31:46 -10:00
88 lines
3.1 KiB
YAML
88 lines
3.1 KiB
YAML
name: Run tests
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
types: [opened, synchronize]
|
|
|
|
concurrency:
|
|
group: test-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
node: ['20', '22', '24']
|
|
include:
|
|
- node: '20'
|
|
coverage: true
|
|
name: Test with Node ${{ matrix.node }}
|
|
steps:
|
|
- uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2
|
|
- name: Setup tools
|
|
uses: ./.github/actions/setup-mise
|
|
env:
|
|
MISE_NODE_VERSION: ${{ matrix.node }}
|
|
- name: Install dependencies
|
|
run: yarn install --immutable
|
|
env:
|
|
YARN_ENABLE_HARDENED_MODE: ${{ matrix.coverage == true && '1' || '0' }}
|
|
- run: yarn typecheck
|
|
- run: |
|
|
git config --global user.email "[email protected]"
|
|
git config --global user.name "Test"
|
|
- name: Fetch base commit for PR diffing
|
|
if: ${{ github.event_name == 'pull_request' }}
|
|
# Lerna needs the base commit to compute affected packages.
|
|
run: git fetch --no-tags --depth=1 origin ${{ github.event.pull_request.base.sha }}
|
|
- name: Run tests (affected)
|
|
# PRs: only run tests for changed packages + dependents.
|
|
if: ${{ !matrix.coverage && github.event_name == 'pull_request' }}
|
|
run: yarn run -T lerna run test --since ${{ github.event.pull_request.base.sha }} --include-dependents
|
|
env:
|
|
NODE_OPTIONS: --max-old-space-size=8192
|
|
- name: Run tests (all)
|
|
# Pushes to main: run all package tests.
|
|
if: ${{ !matrix.coverage && github.event_name == 'push' }}
|
|
run: yarn run -T lerna run test
|
|
env:
|
|
NODE_OPTIONS: --max-old-space-size=8192
|
|
- name: Run tests (coverage)
|
|
# Coverage on PRs and main; per-package reports are uploaded to Codecov.
|
|
if: ${{ matrix.coverage }}
|
|
run: yarn run -T lerna run test -- --coverage
|
|
env:
|
|
# Oclif seems to cause OOM errors when testing with coverage enabled.
|
|
# Remove this whenever we solved those OOM errors.
|
|
NODE_OPTIONS: --max-old-space-size=8192
|
|
- run: yarn lint
|
|
- run: yarn fmt:check
|
|
- name: Install scripts dependencies
|
|
if: ${{ matrix.coverage }}
|
|
run: yarn install --immutable
|
|
working-directory: ./scripts
|
|
env:
|
|
YARN_ENABLE_HARDENED_MODE: ${{ matrix.coverage == true && '1' || '0' }}
|
|
- uses: codecov/codecov-action@29386c70ef20e286228c72b668a06fd0e8399192 # v1
|
|
if: ${{ matrix.coverage }}
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
- if: ${{ matrix.coverage }}
|
|
run: yarn lint-changelog
|
|
|
|
notify-slack:
|
|
runs-on: ubuntu-latest
|
|
needs: [test]
|
|
name: Notify Slack
|
|
if: ${{ github.ref == 'refs/heads/main' && always() }}
|
|
steps:
|
|
- uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2
|
|
- name: Notify Slack
|
|
uses: ./.github/internal-actions/notify-slack-on-fail-or-recover
|
|
with:
|
|
channel: eas-cli
|
|
slack_webhook: ${{ secrets.SLACK_WEBHOOK }}
|