-
Notifications
You must be signed in to change notification settings - Fork 626
73 lines (67 loc) · 2.08 KB
/
build-test-and-deploy.yml
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
name: facebook/metro/build-test-and-deploy
on:
pull_request:
types: [opened, synchronize]
push:
tags:
# The job is triggered for any tag push. Tag format validation will be done
# as part of the deploy job for clearer error reporting for bad tag formatting
- '**'
# ref us unique per PR (refs/pull/<pr_number>/merge)
# and per pushed tag (refs/tags/<tag_name>)
# So this makes sure that previous CI for the same PR/tag
# are cancelled when a newer one is triggered
concurrency:
group: "build-test-and-deploy-${{ github.ref }}"
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
run-js-checks:
runs-on: ubuntu-latest
name: "Type check, lint, smoke test"
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/yarn-install
- run: yarn typecheck
- run: yarn typecheck-ts
- run: yarn lint
- run: yarn test-smoke
test-with-coverage:
runs-on: ubuntu-latest
name: "Tests with coverage"
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/yarn-install
- run: yarn test-coverage
- run: "./.github/scripts/install_codecov.sh"
- run: "./codecov -t ${{ secrets.CODECOV_TOKEN }} -f ./coverage/coverage-final.json"
test:
strategy:
fail-fast: false
matrix:
runs-on: ['ubuntu-latest', 'windows-latest', 'macos-latest']
node-version: [
'18.18.0', # minimum supported
'lts/-1', # pre-latest lts
'lts/*', # latest lts
]
uses: ./.github/workflows/test.yml
with:
node-version: ${{ matrix.node-version }}
runs-on: ${{ matrix.runs-on }}
deploy:
# runs only on tag pushes
if: ${{ github.ref_type == 'tag' }}
runs-on: ubuntu-latest
name: "Deploy"
needs: [run-js-checks, test]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/yarn-install
- run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc
- run: "./.github/scripts/publish.sh"
env:
RAW_TAG_NAME: ${{ github.ref_name }}
- run: rm ~/.npmrc