-
-
Notifications
You must be signed in to change notification settings - Fork 954
38 lines (34 loc) · 1.16 KB
/
build-test.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
name: Build and Test
on:
push:
branches: [ main ]
pull_request:
jobs:
build-test:
name: Build and Test
runs-on: ubuntu-20.04
strategy:
matrix:
node-version: [18.x, 20.x, 22.x]
steps:
- name: Set Environment Variables
run: |
echo "TMP=${{ runner.temp }}" >> $GITHUB_ENV
if [ "${{ github.event_name }}" == "push" ]; then
echo "BASE_COMMIT=${{ github.event.push.before }}" >> $GITHUB_ENV
echo "HEAD_COMMIT=${{ github.event.push.after }}" >> $GITHUB_ENV
fi
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo "BASE_COMMIT=${{ github.event.pull_request.base.sha }}" >> $GITHUB_ENV
echo "HEAD_COMMIT=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
fi
- uses: actions/checkout@v4
- run: git fetch origin "$BASE_COMMIT" "$HEAD_COMMIT" --depth 1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- run: yarn --frozen-lockfile
- run: yarn ci
- run: bin/compare-git-configs.sh "$BASE_COMMIT" "$HEAD_COMMIT"