ci #1090
This file contains hidden or 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: ci | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - master | |
| schedule: | |
| - cron: "00 01 * * *" | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| name: test | |
| env: | |
| # For some builds, we use cross to test on 32-bit and big-endian | |
| # systems. | |
| CARGO: cargo | |
| # When CARGO is set to CROSS, this is set to `--target matrix.target`. | |
| # Note that we only use cross on Linux, so setting a target on a | |
| # different OS will just use normal cargo. | |
| TARGET_FLAGS: | |
| # When CARGO is set to CROSS, TARGET_DIR includes matrix.target. | |
| TARGET_DIR: ./target | |
| # We pin to a version to make sure CI continues to work as cross | |
| # releases in the past have broken things in subtle ways. | |
| CROSS_VERSION: 0.2.5 | |
| # Emit backtraces on panics. | |
| RUST_BACKTRACE: 1 | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - build: pinned | |
| os: ubuntu-latest | |
| rust: 1.93 | |
| - build: stable | |
| os: ubuntu-latest | |
| rust: stable | |
| - build: beta | |
| os: ubuntu-latest | |
| rust: beta | |
| - build: nightly | |
| os: ubuntu-latest | |
| rust: nightly | |
| - build: stable-musl | |
| os: ubuntu-latest | |
| rust: stable | |
| target: x86_64-unknown-linux-musl | |
| - build: stable-x86 | |
| os: ubuntu-latest | |
| rust: stable | |
| target: i686-unknown-linux-gnu | |
| - build: stable-aarch64 | |
| os: ubuntu-latest | |
| rust: stable | |
| target: aarch64-unknown-linux-gnu | |
| - build: stable-powerpc64 | |
| os: ubuntu-latest | |
| rust: stable | |
| target: powerpc64-unknown-linux-gnu | |
| - build: stable-s390x | |
| os: ubuntu-latest | |
| rust: stable | |
| target: s390x-unknown-linux-gnu | |
| - build: macos | |
| os: macos-latest | |
| rust: nightly | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Install packages (Ubuntu) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| ci/ubuntu-install-packages | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ matrix.rust }} | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Install cross | |
| if: matrix.os == 'ubuntu-latest' && matrix.target != '' | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: cross@${{ env.CROSS_VERSION }} | |
| - name: Configure cross | |
| if: matrix.os == 'ubuntu-latest' && matrix.target != '' | |
| shell: bash | |
| run: | | |
| echo "CARGO=cross" >> $GITHUB_ENV | |
| echo "TARGET_FLAGS=--target ${{ matrix.target }}" >> $GITHUB_ENV | |
| echo "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV | |
| - name: Show command used for Cargo | |
| run: | | |
| echo "cargo command is: ${{ env.CARGO }}" | |
| echo "target flag is: ${{ env.TARGET_FLAGS }}" | |
| - name: Build envelope and all crates | |
| run: ${{ env.CARGO }} build --verbose --workspace ${{ env.TARGET_FLAGS }} | |
| - name: Run tests (with cross) | |
| # These tests should actually work, but they almost double the runtime. | |
| # Every integration test spins up qemu to run 'envelope' | |
| if: matrix.target != '' | |
| run: ${{ env.CARGO }} test --verbose --workspace ${{ env.TARGET_FLAGS }} | |
| e2e: | |
| name: e2e (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - ubuntu-latest | |
| - macos-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: stable | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Build release binary | |
| run: cargo build --release | |
| - name: Run e2e tests | |
| run: ci/e2e-test target/release/envelope | |
| rustfmt: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: stable | |
| components: rustfmt | |
| - name: Check formatting | |
| run: cargo fmt --all --check | |
| docs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: stable | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Check documentation | |
| env: | |
| RUSTDOCFLAGS: -D warnings | |
| run: cargo doc --no-deps --document-private-items --workspace |