Skip to content

Commit 71a8069

Browse files
committed
WIP: Move CI from Azure Pipelines to GitHub Actions
This simplifies the CI setup substantially. Fixes: #1226
1 parent 4b7691e commit 71a8069

File tree

3 files changed

+117
-122
lines changed

3 files changed

+117
-122
lines changed

.github/workflows/ci.yml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
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+
# Needs adding to the safelist for c2rust GitHub Actions
15+
#- uses: Swatinem/rust-cache@v2
16+
- run: |
17+
sudo apt-get update
18+
sudo apt-get install \
19+
clang \
20+
clang-tools \
21+
cmake \
22+
curl \
23+
git \
24+
gperf \
25+
libbrotli-dev \
26+
libclang-dev \
27+
libgcrypt20 \
28+
libreadline-dev \
29+
libidn2-dev \
30+
libldap2-dev \
31+
libncurses5-dev \
32+
libnghttp2-dev \
33+
libpcre3-dev \
34+
libpsl-dev \
35+
librtmp-dev \
36+
libssl-dev \
37+
libtool \
38+
llvm \
39+
llvm-dev \
40+
luarocks \
41+
ninja-build \
42+
pkg-config \
43+
python3-pip \
44+
python3-setuptools \
45+
python3-wheel \
46+
rcs \
47+
strace \
48+
unzip \
49+
zlib1g-dev
50+
- name: Provision Python Packages
51+
run: python3 -m pip install -r $GITHUB_WORKSPACE/scripts/requirements.txt
52+
- name: cargo fmt --check
53+
run: |
54+
export RUSTFLAGS="-D warnings"
55+
export RUSTDOCFLAGS="-D warnings"
56+
cargo fmt --check
57+
- name: cargo build --release
58+
run: |
59+
export RUSTFLAGS="-D warnings"
60+
export RUSTDOCFLAGS="-D warnings"
61+
# Don't build with `--all-features` as `--all-features` includes `--features llvm-static`,
62+
# which we don't want to test here (see https://github.com/immunant/c2rust/issues/500).
63+
cargo build --release
64+
- name: cargo test --release --workspace
65+
run: |
66+
export RUSTFLAGS="-D warnings"
67+
export RUSTDOCFLAGS="-D warnings"
68+
cargo test --release --workspace
69+
- name: Test translator
70+
run: |
71+
# `test_translator.py` compiles translated code,
72+
# which has tons of warnings.
73+
# `RUSTFLAGS="-D warnings"` would be inherited by that,
74+
# causing tons of errors, so don't set that.
75+
# `test_translator.py` does not rebuild,
76+
# so changing `RUSTFLAGS` will not trigger a full rebuild.
77+
./scripts/test_translator.py tests/
78+
79+
test-mac:
80+
runs-on: macos-14
81+
steps:
82+
- uses: actions/checkout@v4
83+
- run: rustup component add rustfmt rustc-dev
84+
# Needs adding to the safelist for c2rust GitHub Actions
85+
#- uses: Swatinem/rust-cache@v2
86+
- name: Provision macOS
87+
run: |
88+
./scripts/provision_mac.sh
89+
# speeds up provisioning
90+
export HOMEBREW_NO_AUTO_UPDATE=1
91+
# prepare environment for the following steps
92+
source $HOME/.cargo/env
93+
# print some useful info to help troubleshoot
94+
brew info llvm@17
95+
which python3
96+
/usr/bin/env python3 -c "import sys; print(sys.path)"
97+
98+
- name: cargo build --release
99+
run: |
100+
export LLVM_CONFIG_PATH=$(brew --prefix llvm@17)/bin/llvm-config
101+
export RUSTFLAGS="-D warnings"
102+
export RUSTDOCFLAGS="-D warnings"
103+
# Don't build with `--all-features` (see analogous step for Linux).
104+
cargo build --release
105+
106+
- name: cargo test --release --workspace
107+
run: |
108+
export RUSTFLAGS="-D warnings"
109+
export RUSTDOCFLAGS="-D warnings"
110+
cargo test --release --workspace
111+
112+
- name: Test translator
113+
run: |
114+
# `RUSTFLAGS` not set (see analogous step for Linux).
115+
./scripts/test_translator.py tests/

azure-pipelines.yml

Lines changed: 0 additions & 120 deletions
This file was deleted.

scripts/provision_mac.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ export HOMEBREW_NO_AUTO_UPDATE=1
2323
brew install -q python cmake ninja gpg llvm@17 bash
2424

2525
# Python 3 packages
26-
python3 -m pip install --user --upgrade pip
27-
python3 -m pip install --user -r "$SCRIPT_DIR/requirements.txt"
26+
python3 -m pip install --break-system-packages --user --upgrade pip
27+
python3 -m pip install --break-system-packages --user -r "$SCRIPT_DIR/requirements.txt"
2828

2929
# Rust and dependencies
3030
RUST_TOOLCHAIN_FILE="$SCRIPT_DIR/../rust-toolchain.toml"

0 commit comments

Comments
 (0)