Skip to content

Commit 22d2085

Browse files
authored
Move Linux CI from Azure Pipelines to GitHub Actions (#1232)
This simplifies the CI setup substantially. In particular, this installs packages as part of the CI setup, rather than in a separate manual container build step where modifications by contributors are ineffective until the container images are regenerated. Now, changes to provisioning will take immediate effect, allowing upgrades to new versions to be contributed and tested easily. This does not move macOS over, because I don't have sufficient experience with macOS to easily debug the issues that occur when attempting to do so. * Fixes Linux part of #1226.
2 parents 376bd12 + 8add06a commit 22d2085

File tree

2 files changed

+81
-68
lines changed

2 files changed

+81
-68
lines changed

.github/workflows/ci.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
8+
jobs:
9+
test-linux:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- run: rustup component add rustfmt rustc-dev
14+
# rust-cache very carefully caches toolchains and target directories,
15+
# based on the job and toolchain and other factors. See
16+
# https://github.com/Swatinem/rust-cache#cache-details for what gets
17+
# cached, what gets used as part of the key, and what additional handling
18+
# happens to make the cache reliable and smaller.
19+
- uses: Swatinem/rust-cache@v2
20+
- run: |
21+
sudo apt-get update
22+
sudo apt-get install \
23+
clang \
24+
clang-tools \
25+
cmake \
26+
curl \
27+
git \
28+
gperf \
29+
libbrotli-dev \
30+
libclang-dev \
31+
libgcrypt20 \
32+
libreadline-dev \
33+
libidn2-dev \
34+
libldap2-dev \
35+
libncurses5-dev \
36+
libnghttp2-dev \
37+
libpcre3-dev \
38+
libpsl-dev \
39+
librtmp-dev \
40+
libssl-dev \
41+
libtool \
42+
llvm \
43+
llvm-dev \
44+
luarocks \
45+
ninja-build \
46+
pkg-config \
47+
python3-pip \
48+
python3-setuptools \
49+
python3-wheel \
50+
rcs \
51+
strace \
52+
unzip \
53+
zlib1g-dev
54+
- name: Provision Python Packages
55+
run: python3 -m pip install -r $GITHUB_WORKSPACE/scripts/requirements.txt
56+
- name: cargo fmt --check
57+
run: |
58+
export RUSTFLAGS="-D warnings"
59+
export RUSTDOCFLAGS="-D warnings"
60+
cargo fmt --check
61+
- name: cargo build --release
62+
run: |
63+
export RUSTFLAGS="-D warnings"
64+
export RUSTDOCFLAGS="-D warnings"
65+
# Don't build with `--all-features` as `--all-features` includes `--features llvm-static`,
66+
# which we don't want to test here (see https://github.com/immunant/c2rust/issues/500).
67+
cargo build --release
68+
- name: cargo test --release --workspace
69+
run: |
70+
export RUSTFLAGS="-D warnings"
71+
export RUSTDOCFLAGS="-D warnings"
72+
cargo test --release --workspace
73+
- name: Test translator
74+
run: |
75+
# `test_translator.py` compiles translated code,
76+
# which has tons of warnings.
77+
# `RUSTFLAGS="-D warnings"` would be inherited by that,
78+
# causing tons of errors, so don't set that.
79+
# `test_translator.py` does not rebuild,
80+
# so changing `RUSTFLAGS` will not trigger a full rebuild.
81+
./scripts/test_translator.py tests/

azure-pipelines.yml

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -14,74 +14,6 @@ trigger:
1414
- docs/*
1515

1616
jobs:
17-
- job: Linux
18-
timeoutInMinutes: 120
19-
pool:
20-
vmImage: 'ubuntu-latest'
21-
strategy:
22-
matrix:
23-
arch:
24-
containerImage: immunant/c2rust:archlinux-base-latest
25-
debian10:
26-
containerImage: immunant/c2rust:debian-buster-latest
27-
debian11:
28-
containerImage: immunant/c2rust:debian-bullseye-latest
29-
fedora34:
30-
containerImage: immunant/c2rust:fedora-34-latest
31-
ubuntu20:
32-
containerImage: immunant/c2rust:ubuntu-focal-latest
33-
ubuntu18:
34-
containerImage: immunant/c2rust:ubuntu-bionic-latest
35-
container: $[ variables['containerImage'] ]
36-
steps:
37-
38-
# rust was installed for the `docker` user, not the user azure creates
39-
# but cargo and rustup can be controlled via $CARGO_HOME and $RUSTUP_HOME.
40-
# NOTE: $HOME is not set correctly for the azure user; don't rely on it.
41-
42-
- script: |
43-
export PATH="/home/docker/.cargo/bin:$PATH"
44-
export RUSTUP_HOME=/home/docker/.rustup
45-
export CARGO_HOME=$AGENT_TEMPDIRECTORY/.cargo
46-
export RUSTFLAGS="-D warnings"
47-
export RUSTDOCFLAGS="-D warnings"
48-
cargo fmt --check
49-
displayName: 'cargo fmt --check'
50-
51-
- script: |
52-
export PATH="/home/docker/.cargo/bin:$PATH"
53-
export RUSTUP_HOME=/home/docker/.rustup
54-
export CARGO_HOME=$AGENT_TEMPDIRECTORY/.cargo
55-
export RUSTFLAGS="-D warnings"
56-
export RUSTDOCFLAGS="-D warnings"
57-
# Don't build with `--all-features` as `--all-features` includes `--features llvm-static`,
58-
# which we don't want to test here (it doesn't work out of the box on Arch and Fedora;
59-
# see https://github.com/immunant/c2rust/issues/500).
60-
cargo build --release
61-
displayName: 'cargo build against host clang/LLVM (fast build)'
62-
63-
- script: |
64-
export PATH="/home/docker/.cargo/bin:$PATH"
65-
export RUSTUP_HOME=/home/docker/.rustup
66-
export CARGO_HOME=$AGENT_TEMPDIRECTORY/.cargo
67-
export RUSTFLAGS="-D warnings"
68-
export RUSTDOCFLAGS="-D warnings"
69-
cargo test --release --workspace
70-
displayName: 'cargo test'
71-
72-
- script: |
73-
export PATH="/home/docker/.cargo/bin:$PATH"
74-
export RUSTUP_HOME=/home/docker/.rustup
75-
export CARGO_HOME=$AGENT_TEMPDIRECTORY/.cargo
76-
# `test_translator.py` compiles translated code,
77-
# which has tons of warnings.
78-
# `RUSTFLAGS="-D warnings"` would be inherited by that,
79-
# causing tons of errors, so don't set that.
80-
# `test_translator.py` does not rebuild,
81-
# so changing `RUSTFLAGS` will not trigger a full rebuild.
82-
./scripts/test_translator.py tests/
83-
displayName: 'Test translator (fast build)'
84-
8517
- job: Darwin
8618
timeoutInMinutes: 180
8719
pool:

0 commit comments

Comments
 (0)