Skip to content

Oxidation fuse

Oxidation fuse #3

Workflow file for this run

name: CI Rust
on:
workflow_call:
workflow_dispatch:
# We set `concurrency` to prevent having this workflow being run on code that is not up-to-date on a PR (a user make multiple push in a quick manner).
# But on the main branch, we don't want that behavior.
# Having the workflow run on each merge commit is something we would like, that could help us where a regression was made and missed by previous checks.
#
# For that we use `head_ref` that is only defined on `pull-request` and fallback to `run_id` (this is a counter, so it's value is unique between workflow call).
concurrency:
group: ci-rust-${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
cargo-nextest-version: 0.9.53
CARGO_CI_FLAGS: --locked --profile ci-rust
CARGO_NEXTEST_CI_FLAGS: --locked --cargo-profile ci-rust
WINFSP_VERSION: 2.0.23075
WINFSP_TEST_EXE: C:/Program Files (x86)/WinFsp/bin/winfsp-tests-x64.exe
permissions:
contents: read
packages: read
jobs:
# Cannot factorize the jobs with a matrix since we use a service container that is
# only available on linux (see https://github.com/orgs/community/discussions/25578)
test-rust-linux:
name: "🐧 Linux: 🦀 Rust tests"
# Just a fail-safe timeout, see the fine grain per-task timeout instead
timeout-minutes: 30
runs-on: ubuntu-20.04
# Testbed server comes as a Docker image, so it will eventually goes out of sync
# with the tests (typically a new API is introduced in the Parsec server, or a new
# testbed template is introduced).
# In such case, the container url should be updated from the, see:
# https://github.com/Scille/parsec-cloud/pkgs/container/parsec-cloud%2Fparsec-testbed-server
env:
TESTBED_SERVER: http://localhost:6777
services:
parsec-testbed-server:
image: ghcr.io/scille/parsec-cloud/parsec-testbed-server:v2.16.0-a.0-dev.2023-09-01-sha.7e2d9d5
ports:
- 6777:6777
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # pin v3.6.0
timeout-minutes: 5
- uses: actions-rust-lang/setup-rust-toolchain@f3c84ee10bf5a86e7a5d607d487bf17d57670965 # pin v1.5.0
with:
# We setup the cache by hand, see below
cache: false
timeout-minutes: 10
- name: Retrieve Rust cache
uses: Swatinem/rust-cache@e207df5d269b42b69c8bc5101da26f7d31feddb4 # pin v2.6.2
with:
# Cache is limited to 10Go (and cache is ~700mo per platform !). On top of that.
# cache is only shared between master and the PRs (and not across PRs).
# So we only save the cache on master build given it's the ones that are the
# most likely to be reused.
save-if: ${{ github.ref == 'refs/heads/master' }}
timeout-minutes: 5
# Install fio
- name: Install fio
shell: bash
run: apt install fio
# Install cargo nextest command
- uses: taiki-e/install-action@6801bd56b9711500292d943350f0b1f3559d7acb # pin v2.17.8
with:
tool: nextest@${{ env.cargo-nextest-version }}
- name: Categorize workspace crates
id: crates
run: |
(
for type in agnostic platform bindings; do
echo -n "$type=" && python misc/libparsec_crates_flags.py $type
done
) | tee -a $GITHUB_OUTPUT
timeout-minutes: 2
- name: Test agnostic rust codebase
run: cargo nextest run ${{ env.CARGO_NEXTEST_CI_FLAGS }} ${{ steps.crates.outputs.agnostic }}
env:
RUST_LOG: debug
timeout-minutes: 10
# By default `libparsec_crypto` uses RustCrypto, so here we test the sodiumoxide
# implementation and it compatibility with the rest of the project
- name: Test sodiumoxide rust crypto
run: cargo nextest run ${{ env.CARGO_NEXTEST_CI_FLAGS }} --package libparsec_crypto --features use-sodiumoxide
env:
RUST_LOG: debug
timeout-minutes: 10
- name: Check agnostic & platform crates using sodium crypto features
run: cargo check ${{ env.CARGO_CI_FLAGS }} ${{ steps.crates.outcome.agnostic }} ${{ steps.crates.outcome.platform }} --features use-sodiumoxide
timeout-minutes: 10
env:
RUST_LOG: debug
# Use sodiumoxide here given 1) it is composed of C code, so not totally
# platform independant and 2) it is what is going to be used in release
- name: Test platform crates using sodium crypto features (🐧 Linux specific)
shell: bash
run: cargo nextest run ${{ env.CARGO_NEXTEST_CI_FLAGS }} ${{ steps.crates.outcome.platform }} --features libparsec_crypto/use-sodiumoxide
timeout-minutes: 30
env:
RUST_LOG: debug
# Clippy basically compile the project, hence it's faster to run it in
# the test-rust-matrix job where compilation cache is reused !
- uses: ./.github/actions/use-pre-commit
with:
extra-args: clippy --verbose
timeout-minutes: 10
- name: Check rust code format
run: cargo fmt --check
timeout-minutes: 2
test-rust-non-linux:
strategy:
fail-fast: false
matrix:
include:
- name: 🍎 macOS
os: macos-12
- name: 🏁 Windows
os: windows-2022
name: "${{ matrix.name }}: 🦀 Rust tests"
# Just a fail-safe timeout, see the fine grain per-task timeout instead
timeout-minutes: 30
runs-on: ${{ matrix.os }}
steps:

Check failure on line 140 in .github/workflows/ci-rust.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/ci-rust.yml

Invalid workflow file

You have an error in your yaml syntax on line 140
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # pin v3.6.0
timeout-minutes: 5
- uses: actions-rust-lang/setup-rust-toolchain@f3c84ee10bf5a86e7a5d607d487bf17d57670965 # pin v1.5.0
with:
# We setup the cache by hand, see below
cache: false
timeout-minutes: 10
- name: Retrieve Rust cache
uses: Swatinem/rust-cache@e207df5d269b42b69c8bc5101da26f7d31feddb4 # pin v2.6.2
with:
# Cache is limited to 10Go (and cache is ~700mo per platform !). On top of that.
# cache is only shared between master and the PRs (and not across PRs).
# So we only save the cache on master build given it's the ones that are the
# most likely to be reused.
save-if: ${{ github.ref == 'refs/heads/master' }}
timeout-minutes: 5
# Building OpenSSL requires a perl interpreter.
# The default one does not provide windows-style filesystem
# paths so we have to switch to Strawberry.
- name: Use strawberry perl
if: startsWith(matrix.os, 'windows')
shell: bash
run: echo OPENSSL_SRC_PERL=C:/Strawberry/perl/bin/perl >> $GITHUB_ENV
timeout-minutes: 1
- name: Install winfsp
if: startsWith(matrix.os, 'windows')
shell: bash
run: |
set -eux
choco install winfsp -y --version=${{ env.WINFSP_VERSION }}
curl -L https://github.com/winfsp/winfsp/releases/download/v2.0/winfsp-tests-${{ env.WINFSP_VERSION }}.zip -o D:/a/_temp/winfsp-tests.zip
unzip D:/a/_temp/winfsp-tests.zip -d D:/a/_temp/
mv 'D:/a/_temp/winfsp-tests-x64.exe' 'C:/Program Files (x86)/WinFsp/bin/'
# Install fio
- name: Install fio
if: startsWith(matrix.os, 'macos')
shell: bash
run: apt install fio
# Install cargo nextest command
- uses: taiki-e/install-action@6801bd56b9711500292d943350f0b1f3559d7acb # pin v2.17.8
with:
tool: nextest@${{ env.cargo-nextest-version }}
# Don't run platform agnostic tests here (only runned on Linux)
- name: Test Rust codebase (${{ matrix.name }} specific)
shell: bash
run: |
set -ex
CRATES=`python3 misc/libparsec_crates_flags.py platform`
cargo nextest run ${{ env.CARGO_NEXTEST_CI_FLAGS }} $CRATES --features libparsec_crypto/use-sodiumoxide
# By default `libparsec_crypto` uses RustCrypto, so here we test the sodiumoxide
# implementation and it compatibility with the rest of the project
cargo nextest run ${{ env.CARGO_NEXTEST_CI_FLAGS }} --package libparsec_crypto --features use-sodiumoxide
NON_BINDINGS_CRATES=`python3 misc/libparsec_crates_flags.py agnostic platform`
cargo check ${{ env.CARGO_CI_FLAGS }} $NON_BINDINGS_CRATES --features use-sodiumoxide
timeout-minutes: 30
env:
RUST_LOG: debug
TESTBED_SERVER: http://localhost:6777