Skip to content

Move Linux CI from Azure Pipelines to GitHub Actions #1232

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: ci

on:
push:
branches: [ master ]
pull_request:

jobs:
test-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup component add rustfmt rustc-dev
# rust-cache very carefully caches toolchains and target directories,
# based on the job and toolchain and other factors. See
# https://github.com/Swatinem/rust-cache#cache-details for what gets
# cached, what gets used as part of the key, and what additional handling
# happens to make the cache reliable and smaller.
- uses: Swatinem/rust-cache@v2
- run: |
sudo apt-get update
sudo apt-get install \
clang \
clang-tools \
cmake \
curl \
git \
gperf \
libbrotli-dev \
libclang-dev \
libgcrypt20 \
libreadline-dev \
libidn2-dev \
libldap2-dev \
libncurses5-dev \
libnghttp2-dev \
libpcre3-dev \
libpsl-dev \
librtmp-dev \
libssl-dev \
libtool \
llvm \
llvm-dev \
luarocks \
ninja-build \
pkg-config \
python3-pip \
python3-setuptools \
python3-wheel \
rcs \
strace \
unzip \
zlib1g-dev
- name: Provision Python Packages
run: python3 -m pip install -r $GITHUB_WORKSPACE/scripts/requirements.txt
- name: cargo fmt --check
run: |
export RUSTFLAGS="-D warnings"
export RUSTDOCFLAGS="-D warnings"
cargo fmt --check
- name: cargo build --release
run: |
export RUSTFLAGS="-D warnings"
export RUSTDOCFLAGS="-D warnings"
# Don't build with `--all-features` as `--all-features` includes `--features llvm-static`,
# which we don't want to test here (see https://github.com/immunant/c2rust/issues/500).
cargo build --release
- name: cargo test --release --workspace
run: |
export RUSTFLAGS="-D warnings"
export RUSTDOCFLAGS="-D warnings"
cargo test --release --workspace
- name: Test translator
run: |
# `test_translator.py` compiles translated code,
# which has tons of warnings.
# `RUSTFLAGS="-D warnings"` would be inherited by that,
# causing tons of errors, so don't set that.
# `test_translator.py` does not rebuild,
# so changing `RUSTFLAGS` will not trigger a full rebuild.
./scripts/test_translator.py tests/
68 changes: 0 additions & 68 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,74 +14,6 @@ trigger:
- docs/*

jobs:
- job: Linux
timeoutInMinutes: 120
pool:
vmImage: 'ubuntu-latest'
strategy:
matrix:
arch:
containerImage: immunant/c2rust:archlinux-base-latest
debian10:
containerImage: immunant/c2rust:debian-buster-latest
debian11:
containerImage: immunant/c2rust:debian-bullseye-latest
fedora34:
containerImage: immunant/c2rust:fedora-34-latest
ubuntu20:
containerImage: immunant/c2rust:ubuntu-focal-latest
ubuntu18:
containerImage: immunant/c2rust:ubuntu-bionic-latest
container: $[ variables['containerImage'] ]
steps:

# rust was installed for the `docker` user, not the user azure creates
# but cargo and rustup can be controlled via $CARGO_HOME and $RUSTUP_HOME.
# NOTE: $HOME is not set correctly for the azure user; don't rely on it.

- script: |
export PATH="/home/docker/.cargo/bin:$PATH"
export RUSTUP_HOME=/home/docker/.rustup
export CARGO_HOME=$AGENT_TEMPDIRECTORY/.cargo
export RUSTFLAGS="-D warnings"
export RUSTDOCFLAGS="-D warnings"
cargo fmt --check
displayName: 'cargo fmt --check'

- script: |
export PATH="/home/docker/.cargo/bin:$PATH"
export RUSTUP_HOME=/home/docker/.rustup
export CARGO_HOME=$AGENT_TEMPDIRECTORY/.cargo
export RUSTFLAGS="-D warnings"
export RUSTDOCFLAGS="-D warnings"
# Don't build with `--all-features` as `--all-features` includes `--features llvm-static`,
# which we don't want to test here (it doesn't work out of the box on Arch and Fedora;
# see https://github.com/immunant/c2rust/issues/500).
cargo build --release
displayName: 'cargo build against host clang/LLVM (fast build)'

- script: |
export PATH="/home/docker/.cargo/bin:$PATH"
export RUSTUP_HOME=/home/docker/.rustup
export CARGO_HOME=$AGENT_TEMPDIRECTORY/.cargo
export RUSTFLAGS="-D warnings"
export RUSTDOCFLAGS="-D warnings"
cargo test --release --workspace
displayName: 'cargo test'

- script: |
export PATH="/home/docker/.cargo/bin:$PATH"
export RUSTUP_HOME=/home/docker/.rustup
export CARGO_HOME=$AGENT_TEMPDIRECTORY/.cargo
# `test_translator.py` compiles translated code,
# which has tons of warnings.
# `RUSTFLAGS="-D warnings"` would be inherited by that,
# causing tons of errors, so don't set that.
# `test_translator.py` does not rebuild,
# so changing `RUSTFLAGS` will not trigger a full rebuild.
./scripts/test_translator.py tests/
displayName: 'Test translator (fast build)'

- job: Darwin
timeoutInMinutes: 180
pool:
Expand Down
Loading