Repository navigation
68 lines (51 loc) · 2.08 KB
/
Copy pathvalidate-ruby.yml
File metadata and controls
68 lines (51 loc) · 2.08 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
name: Ruby Config Validation
on:
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
validate:
name: Ruby Config Validation
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- name: Validate configuration files
run: |
set -euo pipefail
ruby -e 'require "yaml"; %w[versions.yml variants.yml .github/workflows/build-ruby.yml .github/workflows/check-ruby-versions.yml .github/workflows/validate-ruby.yml].each { |path| YAML.load_file(path); puts "ok #{path}" }'
- name: Validate scripts
run: |
set -euo pipefail
python3 -m py_compile scripts/update-ruby-versions.py
bash -n scripts/build-ruby-variants.sh
bash -n scripts/configure-platform.sh
- name: Ensure cache builds never run on pull requests
run: |
set -euo pipefail
python3 - <<'PY'
from pathlib import Path
workflow = Path(".github/workflows/build-ruby.yml")
in_on_block = False
offenders = []
for number, line in enumerate(workflow.read_text().splitlines(), start=1):
if line.startswith("on:"):
in_on_block = True
continue
if in_on_block and line and not line.startswith((" ", "\t")):
in_on_block = False
if in_on_block and line.lstrip().startswith("pull_request:"):
offenders.append(number)
if offenders:
lines = ", ".join(str(number) for number in offenders)
raise SystemExit(f"{workflow} must not run cache-producing builds on pull_request (line {lines})")
PY
if grep -R "BORINGCACHE_API_TOKEN" .github/workflows/build-ruby.yml scripts; then
echo "Use split BORINGCACHE_RESTORE_TOKEN and BORINGCACHE_SAVE_TOKEN secrets instead." >&2
exit 1
fi
- name: Check version updater idempotence
run: |
set -euo pipefail
python3 scripts/update-ruby-versions.py
git diff --exit-code -- versions.yml