Repository navigation
69 lines (61 loc) · 2.27 KB
/
Copy pathverify-samples.yml
File metadata and controls
69 lines (61 loc) · 2.27 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
name: Verify samples
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
detect:
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.detect.outputs.changed }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Detect runnable sample changes
id: detect
env:
BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }}
HEAD_SHA: ${{ github.sha }}
run: |
echo "comparing $BASE_SHA...$HEAD_SHA"
if ! python3 detect-code-changes.py --self-test > /dev/null; then
echo "::warning::detector self-test failed; running the verifier"
echo "changed=true" >> "$GITHUB_OUTPUT"
exit 0
fi
python3 detect-code-changes.py "$BASE_SHA" "$HEAD_SHA" || true
if ! grep -q '^changed=' "$GITHUB_OUTPUT" 2>/dev/null; then
echo "::warning::detector reported no verdict; running the verifier"
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
verify_samples:
runs-on: ubuntu-latest
needs: detect
if: github.event_name == 'push' || needs.detect.outputs.changed == 'true'
steps:
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'corretto'
- name: Generate GitHub App token
id: app-token
if: github.event_name == 'push'
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.VERIFY_SAMPLES_APP_ID }}
private-key: ${{ secrets.VERIFY_SAMPLES_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
repositories: 'kotlin-compiler-server,kotlin-web-site'
- name: Run a verifier
uses: zoobestik/kotlin-samples-verifier@v2
with:
push-repository: 'https://github.com/JetBrains/kotlin-compiler-server'
tag-filter: '#tag="code" & kotlin-runnable="true" & !validate="false"'
push-path: 'src/test/resources/test-compile-data/jvm/kotlin-web-site'
username: ${{ steps.app-token.outputs.token && 'x-access-token' || '' }}
password: ${{ steps.app-token.outputs.token || '' }}
report-error-only: true