-
Notifications
You must be signed in to change notification settings - Fork 0
162 lines (137 loc) · 5.81 KB
/
Copy pathverify.yml
File metadata and controls
162 lines (137 loc) · 5.81 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
name: verify
on: push
permissions:
contents: write
concurrency:
group: verify-cache-${{ github.ref }}
cancel-in-progress: false
jobs:
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.14'
- name: Install dependencies
run: |
pip3 install -U "setuptools<81"
pip3 install -U online-judge-verify-helper
- name: Restore verify cache
run: |
git fetch origin verify-cache || true
if git show-ref --verify --quiet refs/remotes/origin/verify-cache; then
git checkout origin/verify-cache -- .verify-helper/timestamps.local.json || true
git checkout origin/verify-cache -- .verify-helper/timestamps.remote.json || true
fi
- name: Run tests
env:
YUKICODER_TOKEN: ${{ secrets.YUKICODER_TOKEN }}
run: oj-verify run --timeout=3600
- name: Save verify cache
if: always()
run: |
mkdir -p /tmp/verify-cache-files/.verify-helper
found=0
for file in .verify-helper/timestamps.local.json .verify-helper/timestamps.remote.json; do
if [ -f "$file" ]; then
cp "$file" /tmp/verify-cache-files/.verify-helper/
found=1
fi
done
if [ "$found" -eq 0 ]; then
echo "No verify timestamp files found."
exit 0
fi
git worktree add /tmp/verify-cache-worktree HEAD
cd /tmp/verify-cache-worktree
git switch --orphan verify-cache
git rm -rf . || true
mkdir -p .verify-helper
cp /tmp/verify-cache-files/.verify-helper/*.json .verify-helper/
git config user.name "GitHub"
git config user.email "noreply@github.com"
git add .verify-helper
git commit -m "Update verify cache" || exit 0
git push --force origin HEAD:verify-cache
- name: Generate docs with Library Checker coverage
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
env:
REPO_LINK_PREFIX: https://github.com/${{ github.repository }}/blob/${{ github.sha }}/
run: |
oj-verify docs
python3 tools/library_checker_coverage.py --refresh --mode all --format page --link-prefix "$REPO_LINK_PREFIX" --update-pages-index .verify-helper/markdown/index.md > .verify-helper/markdown/library-checker-coverage.md
- name: Set up Ruby for docs
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
working-directory: .verify-helper/markdown
- name: Configure Pages
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
id: pages
uses: actions/configure-pages@v5
- name: Build docs site
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
env:
PAGES_REPO_NWO: ${{ github.repository }}
PAGES_ORIGIN: ${{ steps.pages.outputs.origin }}
PAGES_BASE_PATH: ${{ steps.pages.outputs.base_path }}
run: |
cd .verify-helper/markdown
printf 'url: "%s"\nbaseurl: "%s"\n' "$PAGES_ORIGIN" "$PAGES_BASE_PATH" > _config_pages.yml
bundle exec jekyll build --config _config.yml,_config_pages.yml
- name: Publish docs
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ secrets.GH_PAT }}
publish_dir: ./.verify-helper/markdown/_site
force_orphan: true
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.14'
- name: Generate Library Checker coverage
env:
REPO_LINK_PREFIX: https://github.com/${{ github.repository }}/blob/${{ github.sha }}/
run: |
python3 tools/library_checker_coverage.py --refresh --mode all --format json > library-checker-coverage.json
python3 tools/library_checker_coverage.py --mode all --format csv > library-checker-coverage.csv
python3 tools/library_checker_coverage.py --mode all --format markdown --link-prefix "$REPO_LINK_PREFIX" > library-checker-coverage.md
BEFORE="${{ github.event.before }}"
if [ "$BEFORE" != "0000000000000000000000000000000000000000" ] && git cat-file -e "$BEFORE^{commit}"; then
git worktree add /tmp/library-checker-coverage-base "$BEFORE"
python3 tools/library_checker_coverage.py --root /tmp/library-checker-coverage-base --mode all --format json > library-checker-coverage.previous.json
set +e
python3 tools/library_checker_coverage.py --mode all --format summary --compare-json library-checker-coverage.previous.json --fail-on-decrease --link-prefix "$REPO_LINK_PREFIX" > library-checker-coverage-summary.md
COVERAGE_STATUS=$?
set -e
else
echo "[]" > library-checker-coverage.previous.json
python3 tools/library_checker_coverage.py --mode all --format summary --link-prefix "$REPO_LINK_PREFIX" > library-checker-coverage-summary.md
COVERAGE_STATUS=0
fi
cat library-checker-coverage-summary.md >> "$GITHUB_STEP_SUMMARY"
exit "$COVERAGE_STATUS"
- name: Upload Library Checker coverage
if: always()
uses: actions/upload-artifact@v4
with:
name: library-checker-coverage
path: |
library-checker-coverage.md
library-checker-coverage-summary.md
library-checker-coverage.json
library-checker-coverage.previous.json
library-checker-coverage.csv