Skip to content

dedicated build cache per project #132

dedicated build cache per project

dedicated build cache per project #132

Workflow file for this run

name: Rust
on:
workflow_dispatch:
push:
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
GH_TOKEN: ${{ github.token }}
jobs:
build-release-x86_64-unknown-linux-gnu:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Restore build cache
uses: actions/cache/restore@v4
with:
path: 'target'
key: ${{runner.os}}-${{runner.arch}}-build-cache-${{hashFiles('target/')}}
restore-keys: |
${{runner.os}}-${{runner.arch}}-build-cache-
- name: build
run: cargo build --verbose --target x86_64-unknown-linux-gnu --release
- name: Cache Build Output
uses: actions/cache/save@v4
with:
path: 'target'
key: ${{runner.os}}-${{runner.arch}}-build-cache-${{hashFiles('target/')}}
- name: Update indev release
if: github.ref_name == 'main'
run: gh release upload indev ./target/x86_64-unknown-linux-gnu/release/numake --clobber
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: 'release-x86_64-unknown-linux-gnu'
path: 'target/x86_64-unknown-linux-gnu/release/numake'
build-debug-x86_64-unknown-linux-gnu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Restore build cache
uses: actions/cache/restore@v4
with:
path: 'target'
key: ${{runner.os}}-${{runner.arch}}-build-cache-${{hashFiles('target/')}}
restore-keys: |
${{runner.os}}-${{runner.arch}}-build-cache-
- name: build
run: cargo build --verbose --target x86_64-unknown-linux-gnu
- name: Cache Build Output
uses: actions/cache/save@v4
with:
path: 'target'
key: ${{runner.os}}-${{runner.arch}}-build-cache-${{hashFiles('target/')}}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: 'debug-x86_64-unknown-linux-gnu'
path: 'target/x86_64-unknown-linux-gnu/debug'
build-release-x86_64-pc-windows-gnu:
runs-on: windows-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Install toolchain
run: rustup target add x86_64-pc-windows-gnu
- name: Restore build cache
uses: actions/cache/restore@v4
with:
path: 'target'
key: ${{runner.os}}-${{runner.arch}}-build-cache-${{hashFiles('target/')}}
restore-keys: |
${{runner.os}}-${{runner.arch}}-build-cache-
- name: build
run: cargo build --verbose --target x86_64-pc-windows-gnu --release
- name: Cache Build Output
uses: actions/cache/save@v4
with:
path: 'target'
key: ${{runner.os}}-${{runner.arch}}-build-cache-${{hashFiles('target/')}}
- name: Update indev release
if: github.ref_name == 'main'
run: gh release upload indev ./target/x86_64-pc-windows-gnu/release/numake.exe --clobber
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: 'release-x86_64-pc-windows-gnu'
path: 'target/x86_64-pc-windows-gnu/release/numake.exe'
build-debug-x86_64-pc-windows-gnu:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Install toolchain
run: rustup target add x86_64-pc-windows-gnu
- name: Restore build cache
uses: actions/cache/restore@v4
with:
path: 'target'
key: ${{runner.os}}-${{runner.arch}}-build-cache-${{hashFiles('target/')}}
restore-keys: |
${{runner.os}}-${{runner.arch}}-build-cache-
- name: build
run: cargo build --verbose --target x86_64-pc-windows-gnu
- name: Cache Build Output
uses: actions/cache/save@v4
with:
path: 'target'
key: ${{runner.os}}-${{runner.arch}}-build-cache-${{hashFiles('target/')}}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: 'debug-x86_64-pc-windows-gnu'
path: 'target/x86_64-pc-windows-gnu/debug'
# Experimental
build-debug-x86_64-pc-windows-msvc:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Install toolchain
run: rustup target add x86_64-pc-windows-msvc
- name: Restore build cache
uses: actions/cache/restore@v4
with:
path: 'target'
key: ${{runner.os}}-${{runner.arch}}-build-cache-${{hashFiles('target/')}}
restore-keys: |
${{runner.os}}-${{runner.arch}}-build-cache-
- name: build
run: cargo build --verbose --target x86_64-pc-windows-msvc
- name: Cache Build Output
uses: actions/cache/save@v4
with:
path: 'target'
key: ${{runner.os}}-${{runner.arch}}-build-cache-${{hashFiles('target/')}}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: 'debug-x86_64-pc-windows-msvc'
path: 'target/x86_64-pc-windows-msvc/debug'