-
Notifications
You must be signed in to change notification settings - Fork 269
173 lines (157 loc) · 6.43 KB
/
run_tests.yml
File metadata and controls
173 lines (157 loc) · 6.43 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
163
164
165
166
167
168
169
170
171
172
173
# Syntax reference:
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions
name: Shadow Tests
permissions: read-all
defaults:
run:
shell: bash
on:
pull_request:
types: [opened, synchronize]
env:
CARGO_TERM_COLOR: always
jobs:
shadow:
strategy:
matrix:
container:
# End of standard support: April 2027 https://wiki.ubuntu.com/Releases
- 'ubuntu:22.04'
# End of standard support: June 2029 https://wiki.ubuntu.com/Releases
- 'ubuntu:24.04'
# EOL ~June 2026 https://wiki.debian.org/LTS
- 'debian:11-slim'
# EOL June 2028 https://wiki.debian.org/LTS
- 'debian:12-slim'
# EOL June 2030 https://wiki.debian.org/LTS
- 'debian:13-slim'
# EOL May 2026 https://endoflife.date/fedora
- 'fedora:42'
cc: ['gcc']
buildtype: ['release']
include:
# Run some tests on the newest-available clang. Testing clang on
# *every* platform is a bit overkill, but testing on at least one
# gives decent "bang for the buck" of testing compatibility with
# clang's most recent diagnostics and optimizations.
- container: 'ubuntu:22.04'
cc: 'clang'
buildtype: 'release'
# Test a debug build for each compiler.
- container: 'ubuntu:22.04'
cc: 'gcc'
buildtype: 'debug'
- container: 'ubuntu:22.04'
cc: 'clang'
buildtype: 'debug'
# Tests are all run in containers; just use the latest base image.
runs-on: ubuntu-latest
container:
image: ${{ matrix.container }}
# the default shm-size for ubuntu:18.04, but with the size increased from
# 65536k. github's default docker seccomp policy seems to disallow
# process_vm_readv and process_vm_writev; disable it altogether. See
# https://docs.docker.com/engine/security/seccomp/
options: '--shm-size=1024g --security-opt seccomp=unconfined'
env:
CC: ${{ matrix.cc }}
CONTAINER: ${{ matrix.container }}
BUILDTYPE: ${{ matrix.buildtype }}
# for sccache:
## Invoke cargo via sccache
RUSTC_WRAPPER: sccache
## Set max cache size
SCCACHE_CACHE_SIZE: 2G
## Set cache path
SCCACHE_DIR: /home/runner/.cache/sccache
## sccache doesn't work on incrmentally compiled crates, and incremental
## compilation doesn't help us here anyway.
CARGO_INCREMENTAL: false
## Increment to force eviction of previous caches, e.g. if the sccache configuration
## or usage has changed in a way to make the previous cache not useful.
## Keep in sync with same variable in `extra_tests.yml`.
SCCACHE_CACHE_VERSION: 1
steps:
- name: Checkout
uses: actions/checkout@v5
with:
persist-credentials: false
# Run on PR head instead of merge result. Running on the merge
# result can give confusing results, and we require PR to be up to
# date with target branch before merging, anyway.
# See https://github.com/shadow/shadow/issues/2166
ref: ${{ github.event.pull_request.head.sha }}
- name: Get month
id: get-month
run: |
echo "month=$(/bin/date -u "+%Y%m")" >> $GITHUB_OUTPUT
- name: Install dependencies
run: |
. ci/container_scripts/install_deps.sh
. ci/container_scripts/install_extra_deps.sh
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Restore cargo registry cache
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
# key *and* restore-keys include the month to force a monthly reset instead
# of unbounded growth.
key: cargo-registry-${{ steps.get-month.outputs.month }}-${{ hashFiles('src/Cargo.lock') }}
restore-keys: |
cargo-registry-${{ steps.get-month.outputs.month }}
- name: Get rust version
id: get-rustv
run: |
echo rustv=\"$(rustc --version)\" >> $GITHUB_OUTPUT
- name: Restore sccache cache
uses: actions/cache@v4
continue-on-error: false
with:
path: ${{ env.SCCACHE_DIR }}
# TODO: Consider whether we can safely drop e.g. CC, CONTAINER, and/or BUILDTYPE,
# merging those caches.
#
# sccache won't cache crates that "invoke the system linker". If that means it
# won't cache crates that link with platform libraries, then I think we can merge
# the caches. I'm not sure whether or not it does, though.
# https://github.com/mozilla/sccache#rust
key: sccache-${{ steps.get-month.outputs.month }}-${{ steps.get-rustv.outputs.rustv }}-${{ env.CONTAINER }}-${{ env.CC }}-${{ env.BUILDTYPE }}-${{ env.SCCACHE_CACHE_VERSION}}-${{ hashFiles('src/Cargo.lock') }}
restore-keys: |
sccache-${{ steps.get-month.outputs.month }}-${{ steps.get-rustv.outputs.rustv }}-${{ env.CONTAINER }}-${{ env.CC }}-${{ env.BUILDTYPE }}-${{ env.SCCACHE_CACHE_VERSION}}-
- name: Install sccache
env:
LINK: https://github.com/mozilla/sccache/releases/download
SCCACHE_VERSION: v0.3.1
run: |
SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl
mkdir -p $HOME/.local/bin
curl -v -L "$LINK/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz
mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache
chmod +x $HOME/.local/bin/sccache
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Start sccache server
run: sccache --start-server
- name: Build
run: . ci/container_scripts/build_and_install.sh
- name: Test
run: . ci/container_scripts/test.sh
- name: Compress logs
if: failure()
run: |
shopt -s globstar
tar -cJf build/Testing/Temporary{.tar.xz,/}
for f in build/**/*.data; do tar -cJf "$f.tar.xz" "$f/"; done
- name: Upload shadow data directories
uses: actions/upload-artifact@v4
if: failure()
with:
name: shadow-data-dirs
path: build/**/*.data.tar.xz
- name: Upload shadow log file
uses: actions/upload-artifact@v4
if: failure()
with:
name: shadow-log-file
path: build/Testing/Temporary.tar.xz