Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Run tests in CI #1388

Merged
merged 5 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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: |
Expand Down
52 changes: 28 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -56,19 +60,20 @@ 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:
name: Running `cargo fmt`
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

Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Instructions for installation with winget
- Run tests in CI workflow
- Add macOS arm64 builds to CI/CD

### Changed

Expand Down