Skip to content

Commit

Permalink
chore(ci): refactor build pipeline, dedup things
Browse files Browse the repository at this point in the history
  • Loading branch information
sassman committed Apr 18, 2022
1 parent d989506 commit 1c587f6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 89 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
paths-ignore:
- "**/docs/**"
- "**.md"
workflow_call:

jobs:
check:
Expand Down
96 changes: 7 additions & 89 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,105 +1,23 @@
## references:
# cache: https://github.com/actions/cache/blob/main/examples.md#rust---cargo
# audit: https://github.com/actions-rs/audit-check
# "needs": https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idneeds

name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]-alpha.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]-beta.[0-9]+'
paths-ignore:
- "**/docs/**"
- "**.md"

# NOTE: needs to stay in sync with ./build.yml
jobs:
check:
name: check
strategy:
fail-fast: false
matrix:
version: [ 'ubuntu-latest']
runs-on: ${{ matrix.version }}
steps:
- uses: actions/checkout@v2
- name: setup | rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
profile: minimal
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v1
- run: cargo check

lint:
name: lint
needs: check
strategy:
fail-fast: false
matrix:
version: [ 'ubuntu-latest']
cargo-cmd:
- fmt --all -- --check
- clippy --all-targets --all-features -- -D warnings
runs-on: ${{ matrix.version }}
steps:
- uses: actions/checkout@v2
- name: setup | rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
profile: minimal
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v1
- run: cargo ${{ matrix['cargo-cmd'] }}

tests:
name: test
needs: check
strategy:
fail-fast: false
matrix:
version: [ 'macos-latest', 'ubuntu-latest', 'windows-latest']
rust: [ nightly, stable ]
runs-on: ${{ matrix.version }}
continue-on-error: ${{ matrix.rust == 'nightly' }}
steps:
- uses: actions/checkout@v2
- name: setup | rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
default: true
profile: minimal
- uses: Swatinem/rust-cache@v1
- name: cargo test
run: cargo test --all --locked -- -Z unstable-options

audit:
name: security audit
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: setup | rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
profile: minimal
- uses: Swatinem/rust-cache@v1
- name: audit
uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
# END of build.yml
# call out to build.yml
doing-a-build:
uses: steganogram/stegano-rs/.github/workflows/build.yml@main

publish:
name: post / cargo publish
needs: [audit, lint, tests]
needs: doing-a-build
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -149,7 +67,7 @@ jobs:
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
with:
# This pulls from the "Get Changelog Entry" step above, referencing it's ID to get its outputs object.
# See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
Expand Down

0 comments on commit 1c587f6

Please sign in to comment.