-
Notifications
You must be signed in to change notification settings - Fork 591
137 lines (120 loc) · 3.88 KB
/
determinism.yaml
File metadata and controls
137 lines (120 loc) · 3.88 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
name: Determinism
on:
workflow_dispatch:
inputs:
commit:
description: "Git commit or branch to test (defaults to main)"
required: false
default: "main"
jobs:
check:
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
- ubuntu-24.04-arm
- windows-latest
runs-on: ${{ matrix.os }}
name: Check (${{ matrix.os }})
steps:
- uses: actions/checkout@v4
with:
clean: true
- name: Choose a work directory (unix)
if: runner.os != 'Windows'
shell: bash
run: |
echo "WORK_DIR=$RUNNER_TEMP/r" >> "$GITHUB_ENV"
- name: Choose a work directory (windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
'WORK_DIR=C:\r' | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
- name: Run tests (unix)
if: runner.os != 'Windows'
continue-on-error: true
shell: bash
run: >-
bazel run
--compilation_mode=opt
//test/determinism:tester
--
test
--url=${{ format('{0}/{1}.git', github.server_url, github.repository) }}
--commit=${{ inputs.commit }}
--output="${{ github.workspace }}/results.json"
--work-dir="${WORK_DIR}"
- name: Run tests (windows)
if: runner.os == 'Windows'
continue-on-error: true
shell: pwsh
run: >-
bazel run
--compilation_mode=opt
//test/determinism:tester
'--'
test
--url=${{ format('{0}/{1}.git', github.server_url, github.repository) }}
--commit=${{ inputs.commit }}
--output="${{ github.workspace }}/results.json"
--work-dir="$env: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 "${WORK_DIR}/o" ]]; then
tar -czf output-base.tar.gz -C "${WORK_DIR}" o
fi
- name: Archive output base (windows)
if: runner.os == 'Windows' && always()
shell: pwsh
run: |
if (Test-Path "$env:WORK_DIR\o") {
Compress-Archive -Path "$env: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