forked from machulav/ec2-github-runner
-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (84 loc) · 2.71 KB
/
pr.yml
File metadata and controls
87 lines (84 loc) · 2.71 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: PR automations
on:
pull_request:
jobs:
lint-code:
name: Lint code
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache dependencies
uses: actions/cache@v4
with:
path: '**/node_modules'
key: ec2-github-runner-${{ hashFiles('**/package-lock.json') }}
- name: Install packages
run: npm install
- name: Run linter
run: npm run lint
verify-dist:
name: Verify dist is up to date
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- name: Install packages
run: npm ci
- name: Rebuild dist
run: npm run package
- name: Fail if dist/ differs from committed copy
# ncc 0.38 produces code-split chunks alongside dist/index.js
# (e.g. dist/136.index.js); the whole dist/ tree must stay in
# sync with src/.
run: |
if ! git diff --quiet -- dist/ || [ -n "$(git status --porcelain -- dist/)" ]; then
echo "::error::dist/ is out of sync with src/."
echo "::error::Run 'npm run package' locally and commit the rebuilt dist/."
git status --porcelain -- dist/
git diff --stat -- dist/
exit 1
fi
unit-tests:
name: Unit tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- name: Install packages
run: npm ci
- name: Run jest
run: npm test
verify-runner-url:
name: Verify pinned actions/runner release exists
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Extract runner version from src/aws.js
id: extract
run: |
version=$(grep -oE 'actions/runner/releases/download/v[0-9]+\.[0-9]+\.[0-9]+' src/aws.js | head -1 | sed 's|.*/v||')
if [ -z "$version" ]; then
echo "::error::Could not locate the pinned actions/runner version in src/aws.js"
exit 1
fi
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "Pinned actions/runner: v$version"
- name: HEAD check the Linux x64 release asset
env:
VERSION: ${{ steps.extract.outputs.version }}
run: |
url="https://github.com/actions/runner/releases/download/v${VERSION}/actions-runner-linux-x64-${VERSION}.tar.gz"
echo "Checking $url"
curl -fsSLI -o /dev/null "$url"