-
-
Notifications
You must be signed in to change notification settings - Fork 0
227 lines (219 loc) · 8.78 KB
/
Copy pathelixir-ci.yml
File metadata and controls
227 lines (219 loc) · 8.78 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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# SPDX-License-Identifier: MPL-2.0
# Elixir CI for the orchestration layer: compile, format check, test, audit.
name: elixir-ci
on:
push:
branches: [main, master]
paths:
- "elixir-orchestration/**"
- ".github/workflows/elixir-ci.yml"
# No pull_request paths-filter: 'benchee scripts compile' and 'hex audit' are
# REQUIRED status checks, so they must report on every PR (a path-filtered required
# check deadlocks PRs that don't touch its paths). The "Detect relevant changes"
# step in each job gates the heavy work; non-required jobs are gated the same way so
# they don't run on every unrelated PR.
pull_request:
branches: [main, master]
workflow_dispatch:
permissions:
contents: read
pull-requests: read # change-detector reads the PR's file list
env:
MIX_ENV: test
concurrency:
group: elixir-ci-${{ github.ref }}
cancel-in-progress: true
jobs:
build-test:
name: compile + test
runs-on: ubuntu-latest
timeout-minutes: 60
defaults:
run:
working-directory: elixir-orchestration
strategy:
matrix:
include:
- elixir: "1.17"
otp: "27"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Detect relevant changes
id: detect
working-directory: ${{ github.workspace }}
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
PATTERN='^elixir-orchestration/'
if [ "${{ github.event_name }}" = "pull_request" ]; then
FILES=$(gh api "repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" --paginate --jq '.[].filename')
if printf '%s\n' "$FILES" | grep -qE "$PATTERN"; then
echo "relevant=true" >> "$GITHUB_OUTPUT"
else
echo "relevant=false" >> "$GITHUB_OUTPUT"; echo "No elixir-orchestration changes — pass-through (required-check shim)."
fi
else
echo "relevant=true" >> "$GITHUB_OUTPUT"
fi
- if: steps.detect.outputs.relevant == 'true'
uses: erlef/setup-beam@e6d7c94229049569db56a7ad5a540c051a010af9 # v1.20.4
with:
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}
- if: steps.detect.outputs.relevant == 'true'
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
elixir-orchestration/deps
elixir-orchestration/_build
key: ${{ runner.os }}-mix-${{ matrix.elixir }}-${{ matrix.otp }}-${{ hashFiles('elixir-orchestration/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-${{ matrix.elixir }}-${{ matrix.otp }}-
- if: steps.detect.outputs.relevant == 'true'
run: mix deps.get
- if: steps.detect.outputs.relevant == 'true'
run: mix format --check-formatted
- if: steps.detect.outputs.relevant == 'true'
run: mix compile --warnings-as-errors
- if: steps.detect.outputs.relevant == 'true'
run: mix test
coverage:
# Unit-test coverage only: the federation adapters are exercised by the
# :integration suite (live databases; excluded in CI) and are skipped in
# coveralls.json, so they don't dilute the unit-coverage denominator.
name: ExCoveralls (unit, gate in coveralls.json)
runs-on: ubuntu-latest
timeout-minutes: 60
defaults:
run:
working-directory: elixir-orchestration
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Detect relevant changes
id: detect
working-directory: ${{ github.workspace }}
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
PATTERN='^elixir-orchestration/'
if [ "${{ github.event_name }}" = "pull_request" ]; then
FILES=$(gh api "repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" --paginate --jq '.[].filename')
if printf '%s\n' "$FILES" | grep -qE "$PATTERN"; then
echo "relevant=true" >> "$GITHUB_OUTPUT"
else
echo "relevant=false" >> "$GITHUB_OUTPUT"; echo "No elixir-orchestration changes — pass-through (required-check shim)."
fi
else
echo "relevant=true" >> "$GITHUB_OUTPUT"
fi
- if: steps.detect.outputs.relevant == 'true'
uses: erlef/setup-beam@e6d7c94229049569db56a7ad5a540c051a010af9 # v1.20.4
with:
elixir-version: "1.17"
otp-version: "27"
- if: steps.detect.outputs.relevant == 'true'
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
elixir-orchestration/deps
elixir-orchestration/_build
key: ${{ runner.os }}-mix-coverage-${{ hashFiles('elixir-orchestration/mix.lock') }}
- if: steps.detect.outputs.relevant == 'true'
run: mix deps.get
- if: steps.detect.outputs.relevant == 'true'
run: mix coveralls.json
- if: steps.detect.outputs.relevant == 'true'
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
files: elixir-orchestration/cover/excoveralls.json
flags: elixir
fail_ci_if_error: false
continue-on-error: true
bench-compile:
name: benchee scripts compile
runs-on: ubuntu-latest
timeout-minutes: 60
defaults:
run:
working-directory: elixir-orchestration
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Detect relevant changes
id: detect
working-directory: ${{ github.workspace }}
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
PATTERN='^elixir-orchestration/'
if [ "${{ github.event_name }}" = "pull_request" ]; then
FILES=$(gh api "repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" --paginate --jq '.[].filename')
if printf '%s\n' "$FILES" | grep -qE "$PATTERN"; then
echo "relevant=true" >> "$GITHUB_OUTPUT"
else
echo "relevant=false" >> "$GITHUB_OUTPUT"; echo "No elixir-orchestration changes — pass-through (required-check shim)."
fi
else
echo "relevant=true" >> "$GITHUB_OUTPUT"
fi
- if: steps.detect.outputs.relevant == 'true'
uses: erlef/setup-beam@e6d7c94229049569db56a7ad5a540c051a010af9 # v1.20.4
with:
elixir-version: "1.17"
otp-version: "27"
- if: steps.detect.outputs.relevant == 'true'
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
elixir-orchestration/deps
elixir-orchestration/_build
key: ${{ runner.os }}-mix-bench-${{ hashFiles('elixir-orchestration/mix.lock') }}
- if: steps.detect.outputs.relevant == 'true'
run: mix deps.get
- name: Syntax check all bench scripts
if: steps.detect.outputs.relevant == 'true'
run: |
for f in bench/*.exs; do
elixir -e "Code.string_to_quoted!(File.read!(\"$f\"))"
echo " ✓ $f parses"
done
audit:
name: hex audit
runs-on: ubuntu-latest
timeout-minutes: 60
defaults:
run:
working-directory: elixir-orchestration
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Detect relevant changes
id: detect
working-directory: ${{ github.workspace }}
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
PATTERN='^elixir-orchestration/'
if [ "${{ github.event_name }}" = "pull_request" ]; then
FILES=$(gh api "repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" --paginate --jq '.[].filename')
if printf '%s\n' "$FILES" | grep -qE "$PATTERN"; then
echo "relevant=true" >> "$GITHUB_OUTPUT"
else
echo "relevant=false" >> "$GITHUB_OUTPUT"; echo "No elixir-orchestration changes — pass-through (required-check shim)."
fi
else
echo "relevant=true" >> "$GITHUB_OUTPUT"
fi
- if: steps.detect.outputs.relevant == 'true'
uses: erlef/setup-beam@e6d7c94229049569db56a7ad5a540c051a010af9 # v1.20.4
with:
elixir-version: "1.17"
otp-version: "27"
- if: steps.detect.outputs.relevant == 'true'
run: mix deps.get
- if: steps.detect.outputs.relevant == 'true'
run: mix hex.audit
- if: steps.detect.outputs.relevant == 'true'
run: mix deps.unlock --check-unused