-
Notifications
You must be signed in to change notification settings - Fork 591
106 lines (92 loc) · 2.97 KB
/
determinism.yaml
File metadata and controls
106 lines (92 loc) · 2.97 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
name: Determinism
on:
workflow_dispatch:
pull_request:
types: [opened, synchronize]
paths:
- test/determinism/**
jobs:
check:
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
work_dir: ${{ env.RUNNER_TEMP }}/r
- os: ubuntu-latest
work_dir: ${{ env.RUNNER_TEMP }}/r
- os: windows-latest
work_dir: C:\r
runs-on: ${{ matrix.os }}
name: Check (${{ matrix.os }})
steps:
- uses: actions/checkout@v4
with:
clean: true
- name: Run tests
continue-on-error: true
run: |
bazel run \
--compilation_mode=opt \
//test/determinism:tester \
-- test \
--output="${{ github.workspace }}/results.json" \
--work-dir="${{ matrix.work_dir }}"
- name: Summarize (unix)
if: runner.os != 'Windows'
shell: bash
run: |
if [[ ! -f results.json ]]; then
exit 1
fi
{
echo '<details>'
echo
echo '```json'
cat results.json
echo
echo '```'
echo
echo '</details>'
} >> "$GITHUB_STEP_SUMMARY"
if [[ "$(cat results.json)" != "[]"* ]]; then
exit 1
fi
- name: Summarize (windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
if (-not (Test-Path results.json)) { exit 1 }
Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value '<details>'
Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value ''
Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value '```json'
Get-Content -Path results.json | Add-Content -Path $env:GITHUB_STEP_SUMMARY
Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value ''
Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value '```'
Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value ''
Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value '</details>'
$content = Get-Content -Path results.json -Raw
if (-not $content.StartsWith('[]')) { exit 1 }
- name: Archive output base (unix)
if: runner.os != 'Windows' && always()
shell: bash
run: |
if [[ -d "${{ matrix.work_dir }}/o" ]]; then
tar -czf output-base.tar.gz -C "${{ matrix.work_dir }}" o
fi
- name: Archive output base (windows)
if: runner.os == 'Windows' && always()
shell: pwsh
run: |
if (Test-Path "${{ matrix.work_dir }}\o") {
Compress-Archive -Path "${{ matrix.work_dir }}\o" -DestinationPath output-base.zip
}
- name: Upload output base artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: output-base-${{ matrix.os }}
path: |
output-base.tar.gz
output-base.zip
if-no-files-found: ignore