Update release to account for cache #9
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Rust Binary | |
on: | |
push: | |
jobs: | |
check: | |
name: Check | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Cache Rust | |
uses: actions/cache@v2 | |
id: cache-rust | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-rust-check-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml', '**/*.rs') }} | |
- name: Exit early on cache hit | |
if: steps.cache-rust.outputs.cache-hit == 'true' | |
run: exit 0 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- name: Run cargo check | |
run: cargo check | |
build: | |
needs: check | |
name: Build on ${{ matrix.os }} for ${{ matrix.target }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: ${{ github.ref == 'refs/heads/main' }} | |
matrix: | |
include: | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
- os: ubuntu-latest | |
target: x86_64-pc-windows-msvc | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
- os: macos-latest | |
target: aarch64-apple-darwin | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Cache Rust | |
uses: actions/cache@v2 | |
id: cache-rust | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-rust-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml', '**/*.rs') }} | |
- name: Exit early on cache hit | |
if: steps.cache-rust.outputs.cache-hit == 'true' | |
run: exit 0 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: ${{ matrix.target }} | |
override: true | |
- name: Install libwebkit2gtk (Linux) | |
if: matrix.target == 'x86_64-unknown-linux-gnu' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libwebkit2gtk-4.1-dev | |
- name: Install cargo-xwin (for Windows build) | |
if: matrix.target == 'x86_64-pc-windows-msvc' | |
run: cargo install cargo-xwin | |
- name: Set build flags | |
id: build_flags | |
run: | | |
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then | |
echo "flags=--release" >> $GITHUB_OUTPUT | |
echo "build_type=release" >> $GITHUB_OUTPUT | |
else | |
echo "flags=" >> $GITHUB_OUTPUT | |
echo "build_type=debug" >> $GITHUB_OUTPUT | |
fi | |
- name: Build (non-Windows, non-aarch64-apple) | |
if: matrix.target != 'x86_64-pc-windows-msvc' && matrix.target != 'aarch64-apple-darwin' | |
run: cargo build ${{ steps.build_flags.outputs.flags }} --target ${{ matrix.target }} | |
- name: Build (aarch64-apple-darwin) | |
if: matrix.target == 'aarch64-apple-darwin' | |
run: SDKROOT=$(xcrun -sdk macosx --show-sdk-path) MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx --show-sdk-platform-version) cargo build ${{ steps.build_flags.outputs.flags }} --target ${{ matrix.target }} | |
- name: Build (Windows) | |
if: matrix.target == 'x86_64-pc-windows-msvc' | |
run: cargo xwin build ${{ steps.build_flags.outputs.flags }} --target ${{ matrix.target }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ steps.build_flags.outputs.build_type }}-binary-${{ matrix.target }} | |
path: | | |
target/${{ matrix.target }}/${{ steps.build_flags.outputs.build_type }}/webview_deno_rust* | |
!target/${{ matrix.target }}/${{ steps.build_flags.outputs.build_type }}/deps | |
!target/${{ matrix.target }}/${{ steps.build_flags.outputs.build_type }}/build | |
!target/${{ matrix.target }}/${{ steps.build_flags.outputs.build_type }}/.fingerprint |