robo(ci): bump actions/checkout from 3 to 4 #529
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: Build and test | |
on: | |
pull_request: | |
branches: | |
- master | |
push: | |
branches: | |
- master | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Lint | |
run: | | |
rustup component add rustfmt | |
cargo fmt -- --check || (echo "Please reformat your code with 'cargo | |
fmt' (version $(cargo fmt --version))"; false) | |
tests: | |
needs: [lint] | |
name: Tests ${{ matrix.target }} on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
target: | |
- x86_64-unknown-linux-gnu | |
os: | |
- ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# - name: Set environment variables | |
# run: | | |
# .github/env.sh ${{ matrix.target }} >> $GITHUB_ENV | |
# - name: Install qemu-user-static | |
# if: ${{ matrix.target != 'x86_64-unknown-linux-gnu' }} | |
# run: | | |
# sudo apt update | |
# sudo apt install qemu-user-static | |
# - uses: ryankurte/[email protected] | |
# if: ${{ matrix.target != 'x86_64-unknown-linux-gnu' }} | |
# with: | |
# arch: ${{ env.MULTILIB_ARCH }} | |
# packages: "libssl-dev:${{ env.MULTILIB_ARCH }}" | |
- name: Rustup setup | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
default: true | |
target: ${{ matrix.target }} | |
- name: Unit tests | |
run: | | |
cargo test --locked | |
build: | |
needs: [lint] | |
name: Build ${{ matrix.target }}-${{ matrix.rust }} on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
target: | |
- x86_64-unknown-linux-gnu | |
- aarch64-unknown-linux-gnu | |
- riscv64gc-unknown-linux-gnu | |
rust: | |
- stable | |
- 1.67.0 | |
os: | |
- ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Rustup setup | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.rust }} | |
default: true | |
target: ${{ matrix.target }} | |
- name: Set environment variables | |
run: | | |
.github/env.sh ${{ matrix.target }} >> $GITHUB_ENV | |
- name: Install libssl (native) | |
if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' }} | |
run: | | |
sudo apt update | |
sudo apt install libssl-dev | |
# - name: Install libssl (cross) | |
# uses: ryankurte/[email protected] | |
# if: ${{ matrix.target != 'x86_64-unknown-linux-gnu' }} | |
# with: | |
# arch: ${{ env.MULTILIB_ARCH }} | |
# packages: "${{ env.UBUNTU_CROSS_PKG_LIST }} libssl-dev:${{ env.MULTILIB_ARCH }}" | |
- name: Install libssl (cross) | |
if: ${{ matrix.target != 'x86_64-unknown-linux-gnu' }} | |
run: | | |
sudo dpkg --add-architecture ${{ env.MULTILIB_ARCH }} | |
sudo sed -i'' -E 's/^(deb|deb-src) /\1 [arch=amd64,i386] /' /etc/apt/sources.list | |
echo "deb [arch=${{ env.MULTILIB_ARCH }}] http://ports.ubuntu.com/ubuntu-ports/ $(lsb_release -cs) main restricted universe" | sudo tee /etc/apt/sources.list.d/${{ env.MULTILIB_ARCH }}.list | |
echo "deb [arch=${{ env.MULTILIB_ARCH }}] http://ports.ubuntu.com/ubuntu-ports/ $(lsb_release -cs)-updates main restricted universe" | sudo tee -a /etc/apt/sources.list.d/${{ env.MULTILIB_ARCH }}.list | |
echo "deb [arch=${{ env.MULTILIB_ARCH }}] http://ports.ubuntu.com/ubuntu-ports/ $(lsb_release -cs)-security main restricted universe" | sudo tee -a /etc/apt/sources.list.d/${{ env.MULTILIB_ARCH }}.list | |
sudo apt update | |
sudo apt install ${{ env.UBUNTU_CROSS_PKG_LIST }} libssl-dev:${{ env.MULTILIB_ARCH }} | |
#- name: Setup tmate session | |
#uses: mxschmitt/action-tmate@v3 | |
- name: Check | |
run: cargo check --locked --target ${{ matrix.target }} | |
- name: Build | |
run: cargo build --locked --target ${{ matrix.target }} |