Skip to content

Commit

Permalink
Add test actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ianmclinden committed Nov 19, 2023
1 parent 02797b9 commit 223a4f3
Showing 1 changed file with 154 additions and 0 deletions.
154 changes: 154 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
name: Rust

on:
pull_request:
push:
branches: ["main"]
release:
types: [published]

env:
CARGO_TERM_COLOR: always

jobs:
style:
name: Check Style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt
profile: minimal
override: true
- name: Format
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

test:
name: Test
needs: [style]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
- name: Test
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose

deploy_linux:
name: Deploy Linux
needs: [test]
if: ${{ github.event_name == 'release' }}
runs-on: ubuntu-latest
strategy:
matrix:
target:
[
x86_64-unknown-linux-gnu,
aarch64-unknown-linux-gnu,
arm-unknown-linux-gnueabihf,
]
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: ${{ matrix.target }}
- name: Build target
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --release --target ${{ matrix.target }}
- name: Package
shell: bash
run: |
tar -czvf bfrs-${{ matrix.target }}.tar.gz -C build/${{ matrix.target }}/release/ bfrs
- name: Publish
uses: softprops/action-gh-release@v1
with:
files: "bfrs*"

deploy_macos:
name: Deploy macOS
needs: [test]
if: ${{ github.event_name == 'release' }}
runs-on: macos-latest
strategy:
matrix:
target: [x86_64-apple-darwin, aarch64-apple-darwin]
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: ${{ matrix.target }}
- name: Build target
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --release --target ${{ matrix.target }}
- name: Package
shell: bash
run: |
tar -czvf bfrs-${{ matrix.target }}.tar.gz -C build/${{ matrix.target }}/release/ bfrs
- name: Publish
uses: softprops/action-gh-release@v1
with:
files: "bfrs*"

deploy_windows:
name: Deploy Windows
needs: [test]
if: ${{ github.event_name == 'release' }}
runs-on: ubuntu-latest
strategy:
matrix:
target: [x86_64-pc-windows-gnu]
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: ${{ matrix.target }}
- name: Build target
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --release --target ${{ matrix.target }}
- name: Package
shell: bash
run: |
tar -czvf bfrs-${{ matrix.target }}.tar.gz -C build/${{ matrix.target }}/release/ bfrs.exe
- name: Publish
uses: softprops/action-gh-release@v1
with:
files: "bfrs*"

0 comments on commit 223a4f3

Please sign in to comment.