-
Notifications
You must be signed in to change notification settings - Fork 1.5k
172 lines (152 loc) · 5.07 KB
/
ci.yml
File metadata and controls
172 lines (152 loc) · 5.07 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
name: Unit tests
on:
push:
branches:
- main
- 'release/**'
pull_request:
branches:
- '**'
types:
- opened
- reopened
- synchronize
- ready_for_review
workflow_dispatch:
permissions:
contents: read
pull-requests: read
jobs:
# Fast path: detect whether any non-docs files changed.
# For push and workflow_dispatch always returns code=true/docs_site=true.
# Jobs guarded by `needs.changes.outputs.code != 'false'` are skipped
# for docs-only PRs, saving 20-30 min of unnecessary Go CI.
changes:
runs-on: ubuntu-latest
outputs:
code: ${{ steps.check.outputs.code }}
docs_site: ${{ steps.check.outputs.docs_site }}
steps:
- id: check
env:
GH_TOKEN: ${{ github.token }}
run: |
if [ "${{ github.event_name }}" != "pull_request" ]; then
echo "code=true" >> "$GITHUB_OUTPUT"
echo "docs_site=true" >> "$GITHUB_OUTPUT"
exit 0
fi
files=$(gh api "repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" \
--paginate --jq '.[].filename') \
|| { echo "Failed to fetch PR files from GitHub API"; exit 1; }
# "code" = any file outside: docs/*, root-level llms*.txt, root-level *.md
# (nested *.md like execution/README.md still counts as a code change)
if echo "$files" | grep -qvE '^(docs/|llms[^/]*\.txt$|[^/]*\.md$)'; then
echo "code=true" >> "$GITHUB_OUTPUT"
else
echo "code=false" >> "$GITHUB_OUTPUT"
fi
if echo "$files" | grep -qE '^docs/site/'; then
echo "docs_site=true" >> "$GITHUB_OUTPUT"
else
echo "docs_site=false" >> "$GITHUB_OUTPUT"
fi
linux:
needs: [changes]
concurrency:
group: >-
${{
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')) &&
format('{0}-{1}-{2}', github.workflow, matrix.os, github.run_id) ||
format('{0}-{1}-{2}', github.workflow, matrix.os, github.ref)
}}
cancel-in-progress: true
if: ${{ needs.changes.outputs.code != 'false' && (github.event_name == 'push' || !github.event.pull_request.draft) }}
strategy:
matrix:
# list of os: https://github.com/actions/virtual-environments
os:
- ubuntu-latest
- macos-latest
runs-on: ${{ matrix.os }}
steps:
- name: Cleanup space
if: runner.os == 'Linux'
run: |
rm -fr /opt/az \
/opt/microsoft \
/usr/share/dotnet \
/usr/share/miniconda \
/usr/share/swift
- uses: actions/checkout@v6
with:
fetch-depth: 1
lfs: true
- name: Cleanup space
if: runner.os == 'Linux'
run: |
rm -fr /opt/az \
/opt/microsoft \
/usr/share/dotnet \
/usr/share/miniconda \
/usr/share/swift
- uses: actions/setup-go@v6
with:
go-version: '1.25'
cache: true
- name: Install dependencies on Linux runner
if: runner.os == 'Linux'
run: sudo apt update -y && sudo apt install -y build-essential
- name: Testing build all
run: make all
- name: Reproducible build test
run: |
make erigon
shasum -a256 ./build/bin/erigon > erigon1.sha256
make erigon
shasum -a256 ./build/bin/erigon > erigon2.sha256
if ! cmp -s erigon1.sha256 erigon2.sha256; then
echo >&2 "Reproducible build broken"; cat erigon1.sha256; cat erigon2.sha256; exit 1
fi
- name: Execute test-short
run: make test-short
win:
needs: [changes]
concurrency:
group: >-
${{
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')) &&
format('{0}-{1}-{2}', github.workflow, matrix.os, github.run_id) ||
format('{0}-{1}-{2}', github.workflow, matrix.os, github.ref)
}}
cancel-in-progress: true
if: ${{ needs.changes.outputs.code != 'false' && (github.event_name == 'push' || !github.event.pull_request.draft) }}
strategy:
matrix:
os: [ windows-2025 ]
runs-on: ${{ matrix.os }}
steps:
- name: Configure Pagefile
uses: al-cheb/configure-pagefile-action@v1.5
with:
minimum-size: 8GB
disk-root: "C:"
- uses: actions/checkout@v6
with:
fetch-depth: 1
- uses: actions/setup-go@v6
with:
go-version: '1.25'
cache: true
- name: Install make
run: choco install make -y
- name: Testing build all
shell: bash
run: make all
- name: Execute test-short
shell: bash
run: make test-short
docs-site:
needs: [changes]
if: ${{ needs.changes.outputs.docs_site == 'true' && (github.event_name == 'push' || !github.event.pull_request.draft) }}
uses: ./.github/workflows/docs-site-build.yml