Skip to content

Commit

Permalink
GitHub CI: Fix MSRV build (#45)
Browse files Browse the repository at this point in the history
* GitHub CI: Fix Rust caching

* GitHub CI: Fix MSRV build

* GitHub CI: Enable manual workflow dispatch

* GitHub CI: Remove obsolete workspace check and rename workflow

* Update pre-commit hooks
  • Loading branch information
uklotzde authored Aug 31, 2023
1 parent 8a33286 commit 4a09971
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 22 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow

# Same as file name
name: pre-commit

permissions:
Expand All @@ -10,14 +11,15 @@ on:
push:
branches:
- "*"
workflow_dispatch:

env:
CARGO_TERM_COLOR: always

jobs:
pre-commit:
name: Detecting code style issues
run:
runs-on: ubuntu-latest

steps:
- name: Install ALSA and Jack dependencies
run: sudo apt install alsa libasound2-dev libxcb-shape0-dev libxcb-xfixes0-dev
Expand All @@ -41,8 +43,8 @@ jobs:
- name: Cache Rust toolchain and build artifacts
uses: Swatinem/rust-cache@v2
with:
# Distinguished by the action name to avoid sharing across different actions!
shared-key: "pre-commit"
# The cache should not be shared between different workflows and jobs.
shared-key: ${{ github.workflow }}-${{ github.job }}

- name: Detect code style issues (push)
uses: pre-commit/[email protected]
Expand Down
32 changes: 17 additions & 15 deletions .github/workflows/ci.yaml → .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,34 @@
name: Rust CI
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow

# Same as file name
name: test

permissions:
contents: read

on:
pull_request:
push:
branches:
- main
workflow_dispatch:

jobs:
build_and_test:
name: Build and test
run:
runs-on: ${{ matrix.os }}

strategy:
matrix:
include:
- os: ubuntu-latest
rust: stable
workspace-extra-args: ""

# Minimum Supported Rust Version (MSRV)
- os: ubuntu-latest
rust: 1.62.0
workspace-extra-args: "--exclude player --exclude writer"

runs-on: ${{ matrix.os }}
steps:
- name: Install dependencies
run: sudo apt install alsa libasound2-dev libxcb-shape0-dev libxcb-xfixes0-dev
Expand All @@ -39,15 +48,8 @@ jobs:
- name: Cache Rust toolchain and build artifacts
uses: Swatinem/rust-cache@v2
with:
# Distinguished by the action name to avoid sharing!
# The cache is automatically keyed by the relevant matrix properties.
shared-key: "ci"

- name: Check workspace build
run: cargo check --locked --workspace --tests --features decode-all

- name: Build tests
run: cargo test --locked --all-targets --no-run
# The cache should not be shared between different workflows and jobs.
shared-key: ${{ github.workflow }}-${{ github.job }}

- name: Run tests
run: cargo test --locked --all-targets -- --nocapture --quiet
- name: Run workspace tests
run: cargo test --locked --workspace --features decode-all ${{ matrix.workspace-extra-args }} -- --nocapture --quiet
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ repos:
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.8.1
rev: v0.9.2
hooks:
- id: markdownlint-cli2
exclude: ^LICENSE\.md$
Expand All @@ -36,12 +36,12 @@ repos:
- id: codespell
args: [--ignore-words=.codespellignore]
- repo: https://github.com/sirosen/check-jsonschema
rev: 0.23.2
rev: 0.26.3
hooks:
- id: check-github-actions
- id: check-github-workflows
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0
rev: v3.0.2
hooks:
- id: prettier
types_or:
Expand Down

0 comments on commit 4a09971

Please sign in to comment.