Skip to content

Instantly share code, notes, and snippets.

@not-ivy
Created December 21, 2021 17:45
Show Gist options
  • Save not-ivy/d8537ec7d0906dcff2ebbbe513d38915 to your computer and use it in GitHub Desktop.
Save not-ivy/d8537ec7d0906dcff2ebbbe513d38915 to your computer and use it in GitHub Desktop.
Build rust program on linux, macos and windows with caching
name: Rust
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
CARGO_TERM_COLOR: always
jobs:
build-UNIX:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2.1.7
with:
path: './target/*'
key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.*') }}
restore-keys: ${{ runner.os }}-rust-
- run: cargo build --release --verbose
- uses: actions/upload-artifact@v2.3.0
with:
name: ${{ runner.os }}-Executable
path: "./target/release/mod_updater"
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2.1.7
with:
path: '.\\target\\*'
key: ${{ runner.os }}-rust-${{ hashFiles('**\\Cargo.*') }}
restore-keys: ${{ runner.os }}-rust-
- run: cargo build --release --verbose
- uses: actions/upload-artifact@v2.3.0
with:
name: "Windows-Executable"
path: ".\\target\\release\\*.exe"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment