Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

Revert "test: local test with act" #131

Revert "test: local test with act"

Revert "test: local test with act" #131

Workflow file for this run

name: CI
on: push
jobs:
format:
name: Check Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cargo fmt
run: cargo fmt --all -- --check
test:
name: Test
runs-on: ${{ matrix.os }}
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`.
TARGET_FLAGS: ""
# When CARGO is set to CROSS, TARGET_DIR includes matrix.target.
TARGET_DIR: ./target
# Emit backtraces on panics.
RUST_BACKTRACE: 1
strategy:
fail-fast: false
matrix:
build: [linux, linux-arm, macos, macos-arm]
include:
- build: linux
os: ubuntu-latest
rust: stable
target: x86_64-unknown-linux-gnu
- build: linux-arm
os: ubuntu-latest
rust: stable
target: aarch64-unknown-linux-gnu
- build: macos
os: macos-latest
rust: stable
target: x86_64-apple-darwin
- build: macos-arm
os: ubuntu-20.04
rust: stable
target: aarch64-apple-darwin
# - build: windows
# os: windows-latest
# rust: stable
# target: x86_64-pc-windows-msvc
# Failed to build, could be an issue with ring crate, recheck on new version? https://github.com/cross-rs/cross/issues/1307
# - build: windows-arm
# os: ubuntu-20.04
# rust: stable
# target: aarch64-pc-windows-msvc
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
target: ${{ matrix.target }}
- name: Login to GitHub Container Registry
if: matrix.build == 'macos-arm' || matrix.build == 'windows-arm'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GH_REGISTRY_TOKEN }}
- name: Use Cross
shell: bash
run: |
cargo install cross
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 }}"
echo "target dir is: ${{ env.TARGET_DIR }}"
# - name: Install Linux ARM toolchain
# if: matrix.build == 'linux-arm'
# shell: bash
# run: |
# sudo dpkg --add-architecture arm64
# sudo tee /etc/apt/sources.list << END
# deb [arch=amd64,i386] http://archive.archive.ubuntu.com/ubuntu/ jammy main restricted
# deb [arch=amd64,i386] http://archive.archive.ubuntu.com/ubuntu/ jammy-updates main restricted
# deb [arch=amd64,i386] http://archive.archive.ubuntu.com/ubuntu/ jammy universe
# deb [arch=amd64,i386] http://archive.archive.ubuntu.com/ubuntu/ jammy-updates universe
# deb [arch=amd64,i386] http://archive.archive.ubuntu.com/ubuntu/ jammy multiverse
# deb [arch=amd64,i386] http://archive.archive.ubuntu.com/ubuntu/ jammy-updates multiverse
# deb [arch=amd64,i386] http://archive.archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse
# deb [arch=amd64,i386] http://security.archive.ubuntu.com/ubuntu/ jammy-security main restricted
# deb [arch=amd64,i386] http://security.archive.ubuntu.com/ubuntu/ jammy-security universe
# deb [arch=amd64,i386] http://security.archive.ubuntu.com/ubuntu/ jammy-security multiverse
# END
# sudo tee /etc/apt/sources.list.d/ports.list << END
# deb [arch-=amd64,i386] http://ports.ubuntu.com/ubuntu-ports/ jammy main restricted
# deb [arch-=amd64,i386] http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main restricted
# deb [arch-=amd64,i386] http://ports.ubuntu.com/ubuntu-ports/ jammy universe
# deb [arch-=amd64,i386] http://ports.ubuntu.com/ubuntu-ports/ jammy-updates universe
# deb [arch-=amd64,i386] http://ports.ubuntu.com/ubuntu-ports/ jammy multiverse
# deb [arch-=amd64,i386] http://ports.ubuntu.com/ubuntu-ports/ jammy-updates multiverse
# deb [arch-=amd64,i386] http://ports.ubuntu.com/ubuntu-ports/ jammy-backports main restricted universe multiverse
# deb [arch-=amd64,i386] http://ports.ubuntu.com/ubuntu-ports/ jammy-security main restricted
# deb [arch-=amd64,i386] http://ports.ubuntu.com/ubuntu-ports/ jammy-security universe
# deb [arch-=amd64,i386] http://ports.ubuntu.com/ubuntu-ports/ jammy-security multiverse
# END
# ls -lh /etc/apt/sources.list.d
# sudo mv /etc/apt/sources.list.d/git-core-ubuntu-ppa-jammy.list /etc/apt/sources.list.d/git-core-ubuntu-ppa-jammy.list.bak || true
# sudo mv /etc/apt/sources.list.d/ubuntu-toolchain-r-ubuntu-test-jammy.list /etc/apt/sources.list.d/ubuntu-toolchain-r-ubuntu-test-jammy.list.bak || true
# sudo mv /etc/apt/sources.list.d/github_git-lfs.list /etc/apt/sources.list.d/github_git-lfs.list.bak || true
# sudo mv /etc/apt/sources.list.d/microsoft-prod.list /etc/apt/sources.list.d/microsoft-prod.list.bak || true
# sudo apt-get update || true
# sudo apt-get update --fix-missing
# sudo apt install libgcc-s1:arm64 gcc g++ libc6-dev libclang-dev pkg-config libstd-rust-dev:arm64 gcc-aarch64-linux-gnu qemu-user -y
# rustup target add aarch64-unknown-linux-gnu
- name: Build
run: ${{ env.CARGO }} build --verbose ${{ env.TARGET_FLAGS }}
- name: Run tests
if: matrix.build != 'macos-arm' && matrix.build != 'linux-arm'
shell: bash
run: |
if [[ "${{ matrix.build }}" = "linux" || "${{ matrix.build }}" = "linux-arm" ]]; then
cargo test ${{ env.TARGET_FLAGS }} -- --nocapture
else
${{ env.CARGO }} test ${{ env.TARGET_FLAGS }} -- --nocapture
fi