Skip to content

build: Update workflow file #62

build: Update workflow file

build: Update workflow file #62

Workflow file for this run

name: Main workflow
on:
push: {}
pull_request: {}
jobs:
# Run the `rustfmt` code formatter
rustfmt:
name: Rustfmt [Formatter]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup | Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
target: ${{ matrix.target }}
- run: rustup component add rustfmt
- run: cargo fmt --all -- --check
# Run a security audit on dependencies
#cargo_audit:
# name: Cargo Audit [Security]
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - name: Setup | Rust
# uses: dtolnay/rust-toolchain@master
# with:
# toolchain: nightly
# target: ${{ matrix.target }}
# - run: cargo install --force cargo-audit
# - run: cargo generate-lockfile
# - run: cargo audit
# Ensure that the project could be successfully compiled
cargo_check:
name: Cargo Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup | Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
target: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- run: cargo check --all
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target x86_64-unknown-linux-gnu
- name: Post-Build
run: |
strip target/x86_64-unknown-linux-gnu/release/cindy-next-rust
mv target/x86_64-unknown-linux-gnu/release/cindy-next-rust cindy-next-rust
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
path: "cindy-next-rust"
# Create GitHub release with Rust build targets and release notes
build:
name: Compile & Release
strategy:
fail-fast: false
matrix:
target:
- x86_64-unknown-linux-gnu
- x86_64-apple-darwin
#- x86_64-pc-windows-msvc
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
name: cindy-next-rust-x86_64-unknown-linux-gnu.tar.gz
- target: x86_64-apple-darwin
os: macOS-latest
name: cindy-next-rust-x86_64-apple-darwin.tar.gz
#- target: x86_64-pc-windows-msvc
# os: windows-latest
# name: cindy-next-rust-x86_64-pc-windows-msvc.zip
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Setup | Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
target: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- name: Build target
run: cargo build --release --target ${{ matrix.target }}
- name: Prepare build artifacts [Windows]
if: matrix.os == 'windows-latest'
run: |
strip target/${{ matrix.target }}/release/cindy-next-rust.exe
mv target/${{ matrix.target }}/release/cindy-next-rust.exe cindy-next-rust.exe
7z a ${{ matrix.name }} cindy-next-rust.exe
- name: Prepare build artifacts [-nix]
if: matrix.os != 'windows-latest'
run: |
strip target/${{ matrix.target }}/release/cindy-next-rust
mv target/${{ matrix.target }}/release/cindy-next-rust cindy-next-rust
tar czvf ${{ matrix.name }} cindy-next-rust
- name: Release | Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.name }}
path: ${{ matrix.name }}
- name: Create GitHub release ${{ matrix.target }}
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v1
with:
files: ${{ matrix.name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}