Skip to content

Commit

Permalink
Setup GitHub Actions for Rust
Browse files Browse the repository at this point in the history
  • Loading branch information
haata committed Oct 12, 2023
1 parent 3c54721 commit 72d88da
Show file tree
Hide file tree
Showing 5 changed files with 205 additions and 7 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: "Audit Dependencies"
on:
push:
paths:
# Run if workflow changes
- '.github/workflows/audit.yml'
# Run on changed dependencies
- '**/Cargo.toml'
- '**/Cargo.lock'
# Run if the configuration file changes
- '**/audit.toml'
# Rerun periodicly to pick up new advisories
schedule:
- cron: '0 0 * * *'
# Run manually
workflow_dispatch:

permissions: read-all

jobs:
audit:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: dtolnay/rust-toolchain@nightly
- uses: actions-rust-lang/audit@v1
name: Audit Rust Dependencies
with:
ignore: RUSTSEC-2020-0071,RUSTSEC-2021-0139

deny:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: dtolnay/rust-toolchain@nightly
- name: cargo-binstall
run: |
mkdir -p ~/.cargo/bin
wget https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz
tar xf cargo-binstall*.tgz -C ~/.cargo/bin
- run: cargo binstall --no-confirm cargo-deny
- name: Cargo Deny
run: cargo deny check licenses

pants:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: dtolnay/rust-toolchain@nightly
- name: cargo-binstall
run: |
mkdir -p ~/.cargo/bin
wget https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz
tar xf cargo-binstall*.tgz -C ~/.cargo/bin
- run: cargo binstall --no-confirm cargo-pants
- name: Cargo Pants
run: cargo pants
17 changes: 10 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,27 @@ on: [push, pull_request]

env:
PIPENV_ACTIVE: 1
deb_packages: >-
libreadline-dev
libwxgtk3.0-gtk3-dev
jobs:
linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install libwxgtk3.0-dev libreadline-dev -y
sudo apt-get install -y ${{ env.deb_packages }}
- name: Build
run: |
make -j
make install
bin/bossac --help
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v3
if: always()
with:
name: linux
Expand All @@ -32,7 +35,7 @@ jobs:
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install dependencies
run: |
brew update
Expand All @@ -42,7 +45,7 @@ jobs:
make -j
make install
bin/bossac --help
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v3
if: always()
with:
name: macos
Expand All @@ -53,7 +56,7 @@ jobs:
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: numworks/setup-msys2@v1
with:
msystem: MSYS32
Expand All @@ -64,7 +67,7 @@ jobs:
msys2do make -j
msys2do make install
bin/bossac --help
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v3
if: always()
with:
name: windows
Expand Down
92 changes: 92 additions & 0 deletions .github/workflows/rust_linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Rust Linux

on: [push, pull_request]

env:
deb_packages: >-
libreadline-dev
libwxgtk3.0-gtk3-dev
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y ${{ env.deb_packages }}
- name: Cargo Check
run: cargo check --all

build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y ${{ env.deb_packages }}
- name: ls
run: |
ls
pwd
- name: Cargo Build
run: cargo build --all
- name: Cargo Install
run: cargo install --path bossac --bins --root dist
- uses: actions/upload-artifact@v3
with:
name: linux_release_binaries
path: dist/bin

fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- name: Rustfmt Check
uses: actions-rust-lang/rustfmt@v1

clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly
with:
components: clippy
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y ${{ env.deb_packages }}
- name: Cargo Clippy
run: cargo clippy --all-targets -- -D warnings

udeps:
name: cargo-udeps
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: dtolnay/rust-toolchain@nightly
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y ${{ env.deb_packages }}
- name: cargo-binstall
run: |
mkdir -p ~/.cargo/bin
wget https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz
tar xf cargo-binstall*.tgz -C ~/.cargo/bin
- run: cargo binstall --no-confirm cargo-udeps
- name: Cargo Udeps
run: cargo udeps --all-targets
17 changes: 17 additions & 0 deletions .github/workflows/rust_macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Rust macOS

on: [push, pull_request]

jobs:
build:
name: Build
runs-on: macOS-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly
- name: Cargo Install
run: cargo install --path bossac --bins --root dist
- uses: actions/upload-artifact@v3
with:
name: macos_release_binaries
path: dist/bin
17 changes: 17 additions & 0 deletions .github/workflows/rust_windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Rust Windows

on: [push, pull_request]

jobs:
build:
name: Build
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly
- name: Cargo Install
run: cargo install --path bossac --bins --root dist
- uses: actions/upload-artifact@v3
with:
name: win_release_binaries
path: dist/bin

0 comments on commit 72d88da

Please sign in to comment.