Skip to content

Commit

Permalink
Refactor github actions (#1028)
Browse files Browse the repository at this point in the history
  • Loading branch information
casey authored Nov 22, 2021
1 parent ee04975 commit c49d534
Show file tree
Hide file tree
Showing 7 changed files with 194 additions and 202 deletions.
2 changes: 0 additions & 2 deletions .cargo/config

This file was deleted.

175 changes: 0 additions & 175 deletions .github/workflows/build.yaml

This file was deleted.

112 changes: 112 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Release

on:
push:
branches:
- master
tags:
- '*'

defaults:
run:
shell: bash

jobs:
all:
name: All

strategy:
matrix:
target:
- aarch64-unknown-linux-gnu
- armv7-unknown-linux-gnueabihf
- x86_64-apple-darwin
- x86_64-pc-windows-msvc
- x86_64-unknown-linux-musl
include:
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
native: false
target_rustflags: '--codegen linker=aarch64-linux-gnu-gcc'
- target: armv7-unknown-linux-gnueabihf
os: ubuntu-latest
native: false
target_rustflags: '--codegen linker=arm-linux-gnueabihf-gcc'
- target: x86_64-apple-darwin
os: macos-latest
native: true
target_rustflags: ''
- target: x86_64-pc-windows-msvc
os: windows-2016
native: true
target_rustflags: ''
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
native: true
target_rustflags: ''

runs-on: ${{matrix.os}}

steps:
- uses: actions/checkout@v2

- name: Install Rust Toolchain Components
uses: actions-rs/toolchain@v1
with:
override: true
target: ${{ matrix.target }}
toolchain: stable

- name: Install AArch64 Toolchain
if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }}
run: |
sudo apt-get update
sudo apt-get install gcc-aarch64-linux-gnu
- name: Install ARM7 Toolchain
if: ${{ matrix.target == 'armv7-unknown-linux-gnueabihf' }}
run: |
sudo apt-get update
sudo apt-get install gcc-arm-linux-gnueabihf
- name: Test
if: matrix.native
run: cargo test --all --target ${{ matrix.target }}

- name: Ref Type
id: ref-type
run: cargo run --package ref-type -- --reference ${{ github.ref }}

- name: Package
id: package
env:
TARGET: ${{ matrix.target }}
REF: ${{ github.ref }}
OS: ${{ matrix.os }}
TARGET_RUSTFLAGS: ${{ matrix.target_rustflags }}
run: ./bin/package
shell: bash

- name: Publish Archive
uses: softprops/[email protected]
if: ${{ startsWith(github.ref, 'refs/tags/') }}
with:
draft: false
files: ${{ steps.package.outputs.archive }}
prerelease: ${{ steps.ref-type.outputs.value != 'release' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish Changelog
uses: softprops/[email protected]
if: >-
${{
startsWith(github.ref, 'refs/tags/')
&& matrix.target == 'x86_64-unknown-linux-musl'
}}
with:
draft: false
files: CHANGELOG.md
prerelease: ${{ steps.ref-type.outputs.value != 'release' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61 changes: 61 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Test

on: pull_request

defaults:
run:
shell: bash

jobs:
all:
name: All

strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-2016

runs-on: ${{matrix.os}}

env:
RUSTFLAGS: --deny warnings

steps:
- uses: actions/checkout@v2

- name: Install Rust Toolchain Components
uses: actions-rs/toolchain@v1
with:
components: clippy, rustfmt
override: true
toolchain: 1.47.0

- uses: Swatinem/rust-cache@v1

- name: Check Lockfile
run: |
cargo update --locked --package just
- name: Test
run: cargo test --all

- name: Clippy
run: cargo clippy --all --all-targets

- name: Format
run: cargo fmt --all -- --check

- name: Completion Scripts
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
./bin/generate-completions
git diff --no-ext-diff --quiet --exit-code
- name: Check for Forbidden Words
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt-get update
sudo apt-get install ripgrep
./bin/forbid
2 changes: 1 addition & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1829,7 +1829,7 @@ Before merging a particularly large or gruesome change, Janus should be run to m

=== Minimum Supported Rust Version

The minimum supported Rust version, or MSRV, can be found in link:rust-toolchain[].
The minimum supported Rust version, or MSRV, is Rust 1.47.0.

== Frequently Asked Questions

Expand Down
Loading

0 comments on commit c49d534

Please sign in to comment.