-
Notifications
You must be signed in to change notification settings - Fork 2
106 lines (87 loc) · 3.07 KB
/
ci.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: CI pipeline
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
static-analysis:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- name: Audit dependencies
run: pnpm audit --audit-level=low
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run Biome CI
run: pnpm -r lint:ci
- name: Run TypeScript type checks
run: pnpm -r typecheck
# This will run the dev command in background, wait for
# RUNTIME_CHECK_TIMEOUT_SECONDS seconds, and then kill the process if it
# is still running. If the command does not throw an error within that
# time, the step will exit successfully. If it does throw an error,
# the step will exit and fail the CI pipeline. This runtime check uses
# a pglite database that only lives in the CI environment.
# It will be discarded after the CI run.
- name: Run Ponder runtime integrity checks
working-directory: apps/ensnode
env:
ACTIVE_PLUGINS: eth,base.eth,linea.eth
RPC_URL_1: https://eth.drpc.org
RPC_URL_8453: https://base.drpc.org
RPC_URL_59144: https://linea.drpc.org
RUNTIME_CHECK_TIMEOUT_SECONDS: 10
run: |
pnpm dev -vv &
PID=$!
sleep $RUNTIME_CHECK_TIMEOUT_SECONDS
if ps -p $PID > /dev/null; then
kill $PID
wait $PID || true
exit 0
else
wait $PID
exit $?
fi
unit-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run unit tests
run: pnpm -r test
ensrainbow-docker-build-and-push:
runs-on: ubuntu-latest
needs: [static-analysis, unit-tests]
# we only build the docker image after a push to the branch
if: github.event_name == 'push'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Build & Push Docker image for ENSRainbow app
env:
IMAGE_NAME: ghcr.io/${{ github.repository }}/ensrainbow
TAG: ${{ github.ref == 'refs/heads/main' && 'latest' || github.ref == 'refs/heads/alpha' && 'alpha' || github.ref == 'refs/heads/subgraph' && 'subgraph' }}
run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
docker build -f apps/ensrainbow/Dockerfile -t $IMAGE_NAME:$TAG -t $IMAGE_NAME:${{ github.sha }} .
docker push $IMAGE_NAME:$TAG
docker push $IMAGE_NAME:${{ github.sha }}