Rust #237
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rust | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
schedule: | |
- cron: "0 14 * * 5" | |
env: | |
CARGO_TERM_COLOR: always | |
DEBIAN_FRONTEND: noninteractive | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "20.11.1" | |
- uses: abbbi/github-actions-tune@81fb919e588c20b7ab52b2cac097d2efd765c714 | |
- name: Cache cargo packages | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/ | |
~/.rustup/ | |
key: ${{ runner.os }}-cargo2-${{ hashFiles('**/Cargo.toml', '**/Cargo.lock', 'rust-toolchain') }} | |
restore-keys: | | |
${{ runner.os }}-cargo2- | |
- run: rustup component add rustfmt | |
- run: rustup component add clippy | |
- run: cargo install cargo-cache | |
- run: sudo apt-get update -y | |
- run: sudo apt-get install -y --no-install-recommends build-essential curl dbus-x11 jq libasound2 libdbus-1-dev libdbus-glib-1-2 libgtk-3-0 libx11-xcb1 libxt6 libxtst6 pkg-config python3 python3-pip python3-venv python3-wheel libpango1.0-dev libgif-dev tar bzip2 | |
- run: pip3 install --user 'yq==2.12.*' | |
- run: mkdir -p ~/.local/bin/ | |
- name: Set Rust flags | |
run: .github/rustflags.sh >> $GITHUB_ENV | |
- name: Set XDG_CACHE_HOME | |
# No spaces allowed here, too much work to escape later in shell commands | |
run: "echo XDG_CACHE_HOME=${HOME}/cache/ >> $GITHUB_ENV" | |
- name: Create XDG_CACHE_HOME directory | |
run: "mkdir $XDG_CACHE_HOME" | |
- name: Build | |
run: ./build.sh check | |
- name: Native extension install check | |
run: ./install_native.sh | |
- name: Set Artifact env var | |
run: echo XPI_FILE=$(cat extension/artifact.txt) >> $GITHUB_ENV | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: extension | |
path: extension/tabreport-*.xpi | |
- name: Cache pip packages | |
uses: actions/cache@v4 | |
with: | |
path: | | |
${{ env.XDG_CACHE_HOME }}/virtualenv | |
key: ${{ runner.os }}-pip2-${{ hashFiles('integration_tests/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip2- | |
- name: Cache firefox versions | |
uses: actions/cache@v4 | |
# TODO: restoring the cache still makes sense since the latest version might | |
# match one we test in the CI build, but we should ensure there is no full | |
# key match so that the existing cache is not overwritten. We could include | |
# the current timestamp in the key. | |
if: github.event_name != 'schedule' | |
with: | |
path: | | |
${{ env.XDG_CACHE_HOME }}/extension_testing | |
key: ${{ runner.os }}-ff2-${{ hashFiles('integration_tests/firefox_versions', 'integration_tests/firefox.py') }} | |
restore-keys: | | |
${{ runner.os }}-ff2- | |
- name: Run integration tests | |
if: github.event_name != 'schedule' | |
# CI run, test against the versions we specify in the firefox_versions file | |
run: ./run_tests.sh -o "$GITHUB_STEP_SUMMARY" -f origin "$XPI_FILE" 2>>test.log | |
working-directory: integration_tests | |
env: | |
VIRTUALENV_DIR: ${{ env.XDG_CACHE_HOME }}/virtualenv | |
- name: Run integration tests against latest FF version | |
if: github.event_name == 'schedule' | |
# Scheduled job, test against the latest FF developer edition (the `-l` option) | |
run: ./run_tests.sh -o "$GITHUB_STEP_SUMMARY" -l -f origin "$XPI_FILE" 2>>test.log | |
working-directory: integration_tests | |
env: | |
VIRTUALENV_DIR: ${{ env.XDG_CACHE_HOME }}/virtualenv | |
- name: Prune cargo cache | |
run: cargo cache clean-unref | |
- name: Collect test logs | |
uses: actions/upload-artifact@v4 | |
if: ${{ always() }} | |
with: | |
name: test.log | |
path: integration_tests/*.log |