Skip to content

Commit

Permalink
Initial revamp of CI
Browse files Browse the repository at this point in the history
Signed-off-by: Dom Rodriguez <[email protected]>
  • Loading branch information
shymega committed Feb 18, 2024
1 parent 4298657 commit 47ad535
Show file tree
Hide file tree
Showing 11 changed files with 450 additions and 51 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/ci-debug-builds-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
name: Nightly builder (Linux)

on:
workflow_call:

env:
CARGO_TERM_COLOR: always

jobs:
build-nightlies-linux:
name: Nightly builds for Linux
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
target: [aarch64-unknown-linux-musl, x86_64-unknown-linux-musl]
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Cache Rust assets
id: rust-cache
uses: Swatinem/rust-cache@v2
- name: Configure Rust
if: ${{ steps.rust-cache.outputs.cache-hit != 'true' }}
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
override: true
target: ${{ matrix.target }}
profile: minimal
- name: Install Cross
if: ${{ steps.rust-cache.outputs.cache-hit != 'true' }}
uses: brndnmtthws/[email protected]
with:
packages: cross
- name: Build bestool release for Linux.
id: build
uses: actions-rs/cargo@v1
with:
command: build
args: >-
--all --locked --verbose --target=${{ matrix.target }}
use-cross: true
- name: Create nightly release
continue-on-error: true
uses: actions/create-release@v1
with:
draft: false
prerelease: true
body: "Nightly build of `bestool` for Linux: ${{ matrix.target }}"
release_name: bestool-nightly-${{ matrix.target }}
tag_name: bestool-nightly-${{ matrix.target }}
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Upload debug nightly build
run: gh release upload bestool-nightly-${{ matrix.target }} ${{ github.workspace }}/target/${{ matrix.target }}/debug/bestool --clobber
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54 changes: 54 additions & 0 deletions .github/workflows/ci-debug-builds-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
name: Nightly builder (macOS)

on:
workflow_call:

env:
CARGO_TERM_COLOR: always

jobs:
build-nightlies-macos:
name: Nightly builds for macOS
runs-on: macos-14
strategy:
fail-fast: true
matrix:
target: [aarch64-apple-darwin, x86_64-apple-darwin]
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Cache Rust assets
id: rust-cache
uses: Swatinem/rust-cache@v2
- name: Configure Rust
if: ${{ steps.rust-cache.outputs.cache-hit != 'true' }}
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
override: true
target: ${{ matrix.target }}
profile: minimal
- name: Build bestool release for macOS.
id: build
uses: actions-rs/cargo@v1
with:
command: build
args: >-
--all --locked --verbose --target=${{ matrix.target }}
- name: Create nightly release
continue-on-error: true
uses: actions/create-release@v1
with:
draft: false
prerelease: true
body: "Nightly build of `bestool` for macOS: ${{ matrix.target }}"
release_name: bestool-nightly-${{ matrix.target }}
tag_name: bestool-nightly-${{ matrix.target }}
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Upload debug nightly build
run: gh release upload bestool-nightly-${{ matrix.target }} ${{ github.workspace }}/target/${{ matrix.target }}/debug/bestool --clobber
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54 changes: 54 additions & 0 deletions .github/workflows/ci-debug-builds-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
name: Nightly builder (Windows)

on:
workflow_call:

env:
CARGO_TERM_COLOR: always

jobs:
build-nightlies-windows:
name: Nightly builds for Windows
runs-on: windows-latest
strategy:
fail-fast: true
matrix:
target: [x86_64-pc-windows-gnu]
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Cache Rust assets
id: rust-cache
uses: Swatinem/rust-cache@v2
- name: Configure Rust
if: ${{ steps.rust-cache.outputs.cache-hit != 'true' }}
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
override: true
target: ${{ matrix.target }}
profile: minimal
- name: Build bestool release for Windows.
id: build
uses: actions-rs/cargo@v1
with:
command: build
args: >-
--all --locked --verbose --target=${{ matrix.target }}
- name: Create nightly release
continue-on-error: true
uses: actions/create-release@v1
with:
draft: false
prerelease: true
body: "Nightly build of `bestool` for Windows: ${{ matrix.target }}"
release_name: bestool-nightly-${{ matrix.target }}
tag_name: bestool-nightly-${{ matrix.target }}
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Upload debug nightly build
run: gh release upload bestool-nightly-${{ matrix.target }} ${{ github.workspace }}/target/${{ matrix.target }}/debug/bestool.exe --clobber
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43 changes: 43 additions & 0 deletions .github/workflows/ci-debug-builds.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
name: Nightly Builders

on:
workflow_dispatch:
schedule:
- cron: 0 0 * * 1

jobs:
check_date:
runs-on: ubuntu-latest
name: Check latest commit
if: ${{ github.event_name == 'schedule' }}
outputs:
should_run: ${{ steps.should_run.outputs.should_run }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- id: should_run
continue-on-error: true
name: Check latest commit is less than a day
run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo
"::set-output name=should_run::false"

build-macos-debug:
needs: check_date
if: ${{ needs.check_date.outputs.should_run != 'false' }}
uses: ./.github/workflows/ci-debug-builds-macos.yml
secrets: inherit

build-linux-debug:
needs: check_date
if: ${{ needs.check_date.outputs.should_run != 'false' }}
uses: ./.github/workflows/ci-debug-builds-linux.yml
secrets: inherit

build-windows-debug:
needs: check_date
if: ${{ needs.check_date.outputs.should_run != 'false' }}
uses: ./.github/workflows/ci-debug-builds-windows.yml
secrets: inherit
34 changes: 34 additions & 0 deletions .github/workflows/ci-tests-common.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: CI tests (Common)

on:
workflow_call:

env:
CARGO_TERM_COLOR: always

jobs:
run-tests:
name: Common CI tests
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Configure Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: clippy,rustfmt
override: true
default: true
- name: Install `cargo-audit`
run: cargo install --locked cargo-audit
- name: Install `cargo-vet`
run: cargo install --locked cargo-vet --version "0.9.0"
- name: Run `cargo-vet`
run: cargo vet --locked
working-directory: src/oldbestool
- name: Run `cargo-audit`
run: cargo audit -D unsound -D yanked -D unmaintained --ignore "RUSTSEC-2020-0168"
working-directory: src/oldbestool
59 changes: 59 additions & 0 deletions .github/workflows/ci-tests-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
name: CI tests (Linux)

on:
workflow_call:

env:
CARGO_TERM_COLOR: always

jobs:
run-linux-tests:
name: CI tests for ${{ matrix.target }}
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
target: [aarch64-unknown-linux-musl, x86_64-unknown-linux-musl]
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Cache Rust assets
id: rust-cache
uses: Swatinem/rust-cache@v2
- name: Configure Rust
if: ${{ steps.rust-cache.outputs.cache-hit != 'true' }}
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: clippy,rustfmt
override: true
target: ${{ matrix.target }}
default: true
- name: Install Cross
if: ${{ steps.rust-cache.outputs.cache-hit != 'true' }}
uses: brndnmtthws/[email protected]
with:
packages: cross

- name: Run Linux tests of `bestool`
uses: actions-rs/cargo@v1
with:
command: test
args: --target=${{ matrix.target }}
use-cross: true

- name: Run Linux checks of `bestool`
uses: actions-rs/cargo@v1
with:
command: check
args: --target=${{ matrix.target }}
use-cross: true

- name: Run Linux Clippy tests of `bestool`
uses: actions-rs/cargo@v1
with:
command: clippy
args: --target=${{ matrix.target }}
use-cross: true
48 changes: 48 additions & 0 deletions .github/workflows/ci-tests-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
name: CI tests (macOS)

on:
workflow_call:

env:
CARGO_TERM_COLOR: always

jobs:
run-macos-tests:
name: CI tests for ${{ matrix.target }}
runs-on: macos-14
strategy:
fail-fast: true
matrix:
target: [aarch64-apple-darwin, x86_64-apple-darwin]
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Cache Rust assets
id: rust-cache
uses: Swatinem/rust-cache@v2
- name: Configure Rust
if: ${{ steps.rust-cache.outputs.cache-hit != 'true' }}
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: clippy,rustfmt
override: true
target: ${{ matrix.target }}
default: true
- name: Run macOS tests of `bestool`
uses: actions-rs/cargo@v1
with:
command: test
args: --target=${{ matrix.target }}
- name: Run macOS checks of `bestool`
uses: actions-rs/cargo@v1
with:
command: check
args: --target=${{ matrix.target }}
- name: Run macOS Clippy tests of `bestool`
uses: actions-rs/cargo@v1
with:
command: clippy
args: --target=${{ matrix.target }}
22 changes: 22 additions & 0 deletions .github/workflows/ci-tests-nix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: CI tests (Nix)

on:
workflow_call:

jobs:
run-tests:
name: Nix CI tests
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- uses: cachix/install-nix-action@v25
- name: Build Nix package
run: nix build
- name: Check Flake formatting
run: nix run nixpkgs#nixpkgs-fmt -- --check ./
- name: Check Flake with Nix
run: nix flake check
- name: Check Flake with Statix
run: nix run nixpkgs#statix -- check ./
Loading

0 comments on commit 47ad535

Please sign in to comment.