ci: Run tests in CI
* ci: Run tests in CI Thanks to contributors test coverage is becoming a thing, thus it makes sense to run tests in CI workflows. Additionally, switch back to `cargo build` instead of `cargo check`, as the tests need compilation anyway. * ci: Enable build for `macos-aarch64` * fix: Streamline build target names * fix: Set toolchain target correctly * ci: Switch to `rustup` over 3rd party action
This commit is contained in:
committed by
GitHub
parent
beae6c3bec
commit
0f1a9ab579
25
.github/workflows/cd.yml
vendored
25
.github/workflows/cd.yml
vendored
@@ -15,7 +15,6 @@ jobs:
|
||||
container: ${{ matrix.container }}
|
||||
strategy:
|
||||
matrix:
|
||||
build_target: [linux-x86_64, linux-arm64, linux-armhf, macos-x86_64, windows-x86_64]
|
||||
include:
|
||||
- build_target: linux-x86_64
|
||||
os: ubuntu-latest
|
||||
@@ -43,16 +42,28 @@ jobs:
|
||||
os: macos-latest
|
||||
target: x86_64-apple-darwin
|
||||
features: '--no-default-features --features rodio_backend,pancurses_backend'
|
||||
- build_target: macos-aarch64
|
||||
os: macos-14
|
||||
target: aarch64-apple-darwin
|
||||
artifact_suffix: macos-aarch64
|
||||
features: '--no-default-features --features rodio_backend,cursive/pancurses-backend'
|
||||
- build_target: windows-x86_64
|
||||
os: windows-latest
|
||||
target: x86_64-pc-windows-msvc
|
||||
features: '--no-default-features --features rodio_backend,pancurses_backend,share_clipboard,notify'
|
||||
steps:
|
||||
- name: Install Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
target: ${{ matrix.target }}
|
||||
toolchain: stable
|
||||
- uses: actions/checkout@v4
|
||||
name: Checkout src
|
||||
- name: Install rustup
|
||||
if: runner.os != 'Windows'
|
||||
shell: bash
|
||||
run: |
|
||||
if ! command -v rustup &>/dev/null; then
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||
echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> $GITHUB_PATH
|
||||
fi
|
||||
- name: Add cross-compilation target
|
||||
run: rustup target add ${{ matrix.target }}
|
||||
- name: Install macOS dependencies
|
||||
if: matrix.os == 'macos-latest'
|
||||
run: brew install portaudio pkg-config
|
||||
@@ -67,8 +78,6 @@ jobs:
|
||||
run: |
|
||||
apt update
|
||||
apt install -y ${{ matrix.dependencies }}
|
||||
- uses: actions/checkout@v4
|
||||
name: Checkout src
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
|
||||
52
.github/workflows/ci.yml
vendored
52
.github/workflows/ci.yml
vendored
@@ -13,19 +13,18 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
build_target: [linux, macos, windows]
|
||||
include:
|
||||
- build_target: linux
|
||||
- build_target: linux-x86_64
|
||||
os: ubuntu-latest
|
||||
artifact_suffix: linux-x86_64
|
||||
target: x86_64-unknown-linux-gnu
|
||||
features: ''
|
||||
- build_target: macos
|
||||
os: macos-latest
|
||||
artifact_suffix: macos-x86_64
|
||||
target: x86_64-apple-darwin
|
||||
features: '--no-default-features --features rodio_backend,cursive/pancurses-backend'
|
||||
- build_target: windows
|
||||
- build_target: macos-aarch64
|
||||
os: macos-14
|
||||
artifact_suffix: macos-aarch64
|
||||
target: aarch64-apple-darwin
|
||||
features: '--no-default-features --features rodio_backend,pancurses_backend'
|
||||
- build_target: windows-x86_64
|
||||
os: windows-latest
|
||||
artifact_suffix: windows-x86_64
|
||||
target: x86_64-pc-windows-msvc
|
||||
@@ -42,11 +41,16 @@ jobs:
|
||||
~/.cargo/git/db/
|
||||
target/
|
||||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||
- name: Install Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
target: ${{ matrix.target }}
|
||||
components: clippy, rustfmt
|
||||
- name: Install rustup
|
||||
if: runner.os != 'Windows'
|
||||
shell: bash
|
||||
run: |
|
||||
if ! command -v rustup &>/dev/null; then
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --target ${{ matrix.target }} -y
|
||||
echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> $GITHUB_PATH
|
||||
fi
|
||||
- name: Install clippy + rustfmt
|
||||
run: rustup component add clippy rustfmt
|
||||
- name: Install macOS dependencies
|
||||
if: matrix.os == 'macos-latest'
|
||||
run: brew install portaudio pkg-config
|
||||
@@ -56,7 +60,9 @@ jobs:
|
||||
sudo apt update
|
||||
sudo apt install libpulse-dev libdbus-1-dev libncursesw5-dev libxcb-shape0-dev libxcb-xfixes0-dev
|
||||
- name: Running cargo build
|
||||
run: cargo check --locked --target ${{ matrix.target }} ${{ matrix.features }}
|
||||
run: cargo build --locked --target ${{ matrix.target }} ${{ matrix.features }}
|
||||
- name: Running cargo test
|
||||
run: cargo test --locked --target ${{ matrix.target }} ${{ matrix.features }}
|
||||
|
||||
# Check Rust code formatting.
|
||||
fmt:
|
||||
@@ -64,11 +70,10 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
target: x86_64-unknown-linux-gnu
|
||||
components: clippy, rustfmt
|
||||
- name: Install rustup
|
||||
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||
- name: Install clippy + rustfmt
|
||||
run: rustup component add rustfmt
|
||||
- name: cargo fmt
|
||||
run: cargo fmt --all -- --check
|
||||
|
||||
@@ -89,11 +94,10 @@ jobs:
|
||||
~/.cargo/git/db/
|
||||
target/
|
||||
key: ${{ runner.os }}-clippy-${{ hashFiles('**/Cargo.lock') }}
|
||||
- name: Install Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
target: x86_64-unknown-linux-gnu
|
||||
components: clippy, rustfmt
|
||||
- name: Install rustup
|
||||
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||
- name: Install clippy + rustfmt
|
||||
run: rustup component add clippy
|
||||
- name: Install Linux dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
|
||||
Reference in New Issue
Block a user