Skip to content

Commit

Permalink
Try to refactor workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
yamadapc committed Aug 23, 2024
1 parent e09cbb0 commit fd9106b
Show file tree
Hide file tree
Showing 6 changed files with 207 additions and 98 deletions.
48 changes: 48 additions & 0 deletions .github/actions/common.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
### {{ github.job }}

name: Common job setup

run:
setup:
name: Setup dependencies
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
lfs: {{ inputs.lfs }}
- uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ inputs.cache_key }}
cache-all-crates: true
cache-on-failure: true
- uses: subosito/flutter-action@v1
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
with:
version: "v0.4.0"
- name: Cache cargo binaries
uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
key: ${{ runner.os }}-cargo-bin
- name: Install LLVM
if: ${{ runner.os }} == 'Linux'
run: brew install llvm
- name: Install dependencies
if: ${{ runner.os }} == 'Linux'
run: |
./scripts/install-ubuntu-apt-dependencies.sh
- uses: taiki-e/install-action@v2
with:
tool: cargo-tarpaulin,cargo-nextest

inputs:
lfs:
description: 'Enable LFS clone'
required: true
default: false
cache_key:
description: 'A cache key for this step'
required: true
default: 'shared_cache'
79 changes: 79 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: CI builds

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

env:
CARGO_TERM_COLOR: always
SCCACHE_GHA_ENABLED: true
RUSTC_WRAPPER: sccache

jobs:
build-rust:
runs-on: ${{ matrix.os }}
name: Build rust crates on ${{ matrix.os }}
strategy:
matrix:
os:
- macos-14
- ubuntu-20.04
steps:
- uses: ../actions/common.yml
with:
lfs: false
cache_key: ${{ matrix.os }}_build
- name: Run build
run: cargo build
- name: Upload build outputs
uses: actions/upload-artifact@v4
with:
name: build_target
path: target
retention-days: 0

test-rust:
needs:
- build-rust
runs-on: ${{ matrix.os }}
name: Test rust crates on ${{ matrix.os }}
strategy:
matrix:
os:
- macos-14
- ubuntu-20.04
steps:
- uses: ../actions/common.yml
with:
lfs: true
cache_key: ${{ matrix.os }}_test
- name: Download build target
uses: actions/download-artifact@v4
with:
name: build_target
- name: Run tests
run: ./scripts/test.sh

lint-rust:
needs:
- build-rust
runs-on: ${{ matrix.os }}
name: Test rust crates on ${{ matrix.os }}
strategy:
matrix:
os:
- macos-14
- ubuntu-20.04
steps:
- uses: ../actions/common.yml
with:
lfs: true
cache_key: ${{ matrix.os }}_lint
- name: Download build target
uses: actions/download-artifact@v4
with:
name: build_target
- name: Run clippy
run: ./scripts/clippy.sh
8 changes: 2 additions & 6 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: Linux

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
on: {}

env:
CARGO_TERM_COLOR: always
Expand Down Expand Up @@ -47,7 +43,7 @@ jobs:
- name: Test
if: true
run: |
cargo test \
cargo test --workflow \
--exclude assert-no-alloc \
--exclude augmented-ui \
--exclude audiounit \
Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/linux_container.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: Linux in Docker

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
on: {}

env:
CARGO_TERM_COLOR: always
Expand All @@ -15,7 +11,6 @@ env:

jobs:
test-rust:
if: false
name: Run unit-tests on rust crates ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
Expand Down Expand Up @@ -108,7 +103,6 @@ jobs:
path: ./tarpaulin-report

build-rust:
if: false
name: Build release rust crates ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
Expand Down
156 changes: 76 additions & 80 deletions .github/workflows/default.yml → .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: macOS
name: Build macOS

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
on: {}

env:
CARGO_TERM_COLOR: always
Expand Down Expand Up @@ -88,55 +84,55 @@ jobs:
matrix:
os: [macos-14]
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
lfs: true
- uses: actions/checkout@v2
with:
submodules: recursive
lfs: true

- uses: subosito/flutter-action@v1
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
with:
version: "v0.4.0"
- uses: subosito/flutter-action@v1
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
with:
version: "v0.4.0"

- uses: Swatinem/rust-cache@v2
with:
shared-key: "rust-cache-macos2"
cache-all-crates: true
cache-on-failure: true
- name: Cache cargo binaries
uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
key: ${{ runner.os }}-cargo-bin
- name: Install LLVM
run: brew install llvm
- uses: Swatinem/rust-cache@v2
with:
shared-key: "rust-cache-macos2"
cache-all-crates: true
cache-on-failure: true
- name: Cache cargo binaries
uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
key: ${{ runner.os }}-cargo-bin
- name: Install LLVM
run: brew install llvm

- name: Build release
run: cargo build --release --verbose --workspace --exclude augmented-ui --exclude midir
- name: Build release
run: cargo build --release --verbose --workspace --exclude augmented-ui --exclude midir

- name: Upload plugin-host binary
uses: actions/upload-artifact@v2
with:
name: ${{ runner.os }}-plugin-host
path: ./target/release/plugin-host
- name: Upload plugin-host-gui2 binary
uses: actions/upload-artifact@v2
with:
name: ${{ runner.os }}-plugin-host-gui2
path: ./target/release/plugin-host-gui2
- name: Upload tremolo-plugin dylib
uses: actions/upload-artifact@v2
with:
name: ${{ runner.os }}-libtas_v2-dylib
path: ./target/release/libtas_v2.dylib
- name: Validate license information
run: |
if ! [ -x "$(command -v cargo-about)" ]; then
cargo install cargo-about
fi
cargo about generate about.hbs
- name: Upload plugin-host binary
uses: actions/upload-artifact@v2
with:
name: ${{ runner.os }}-plugin-host
path: ./target/release/plugin-host
- name: Upload plugin-host-gui2 binary
uses: actions/upload-artifact@v2
with:
name: ${{ runner.os }}-plugin-host-gui2
path: ./target/release/plugin-host-gui2
- name: Upload tremolo-plugin dylib
uses: actions/upload-artifact@v2
with:
name: ${{ runner.os }}-libtas_v2-dylib
path: ./target/release/libtas_v2.dylib
- name: Validate license information
run: |
if ! [ -x "$(command -v cargo-about)" ]; then
cargo install cargo-about
fi
cargo about generate about.hbs
run-snapshot-tests:
name: Run snapshot tests
Expand All @@ -145,35 +141,35 @@ jobs:
matrix:
os: [macos-14]
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
lfs: true
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
with:
version: "v0.4.0"
- uses: subosito/flutter-action@v1
- uses: Swatinem/rust-cache@v2
with:
shared-key: "rust-cache-macos2"
cache-all-crates: true
cache-on-failure: true
- name: Install ARM/x86 toolchains
run: |
rustup target add aarch64-apple-darwin
rustup target add x86_64-apple-darwin
- name: Install LLVM
run: brew install llvm
- name: Run snapshot tests
run: |
./scripts/dev.sh test-snapshots
- name: Upload snapshot test results
uses: actions/upload-artifact@v2
with:
name: ${{ runner.os }}-snapshot-tests
path: ./test
if: ${{ failure() }}
- uses: actions/checkout@v2
with:
submodules: recursive
lfs: true
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
with:
version: "v0.4.0"
- uses: subosito/flutter-action@v1
- uses: Swatinem/rust-cache@v2
with:
shared-key: "rust-cache-macos2"
cache-all-crates: true
cache-on-failure: true
- name: Install ARM/x86 toolchains
run: |
rustup target add aarch64-apple-darwin
rustup target add x86_64-apple-darwin
- name: Install LLVM
run: brew install llvm
- name: Run snapshot tests
run: |
./scripts/dev.sh test-snapshots
- name: Upload snapshot test results
uses: actions/upload-artifact@v2
with:
name: ${{ runner.os }}-snapshot-tests
path: ./test
if: ${{ failure() }}

build-sequencer:
name: Build Continuous looper
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/web.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: Web-based builds

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
on: {}

env:
CARGO_TERM_COLOR: always
Expand Down

0 comments on commit fd9106b

Please sign in to comment.