Skip to content

Use cache for tests. #24

Use cache for tests.

Use cache for tests. #24

Workflow file for this run

# Inspiration:
#
# https://github.com/sharkdp/hyperfine/blob/d449ebd7c18246b7c3f6ee19a97a4cf24e34e106/.github/workflows/CICD.yml
# https://github.com/BurntSushi/ripgrep/blob/61733f6378b62fa2dc2e7f3eff2f2e7182069ca9/.github/workflows/release.yml
# https://github.com/XAMPPRocky/tokei/blob/ae77e1945631fd9457f7d455f2f0f2f889356f58/.github/workflows/mean_bean_deploy.yml
name: Release
on:
workflow_dispatch:
push:
tags:
- "v[0-9]*"
defaults:
run:
shell: bash
env:
NAME: ${{ github.event.repository.name }}
VERSION: ${{ github.ref_name }}
# for gh release upload
permissions:
contents: write
jobs:
create-release:
name: create-release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create GitHub release
env:
GH_TOKEN: ${{ github.token }}
run: gh release create --draft ${VERSION}
build:
name: ${{ matrix.target }} (${{ matrix.os }})
runs-on: ${{ matrix.os }}
needs: create-release
strategy:
fail-fast: false
matrix:
include:
- { target: aarch64-unknown-linux-gnu , os: ubuntu-20.04 }
- { target: armv7-unknown-linux-gnueabihf, os: ubuntu-20.04 }
- { target: arm-unknown-linux-gnueabi , os: ubuntu-20.04 }
- { target: arm-unknown-linux-musleabihf , os: ubuntu-20.04 }
- { target: i686-pc-windows-msvc , os: windows-2019 }
- { target: i686-unknown-linux-gnu , os: ubuntu-20.04 }
- { target: i686-unknown-linux-musl , os: ubuntu-20.04 }
- { target: x86_64-apple-darwin , os: macos-13 }
- { target: aarch64-apple-darwin , os: macos-13 }
# fails in mimalloc, possibly mingw related, see:
# https://github.com/purpleprotocol/mimalloc_rust/issues/125
# - { target: x86_64-pc-windows-gnu , os: windows-2019 }
- { target: x86_64-pc-windows-msvc , os: windows-2019 }
- { target: x86_64-unknown-linux-gnu , os: ubuntu-20.04 }
- { target: x86_64-unknown-linux-musl , os: ubuntu-20.04 }
steps:
- uses: actions/checkout@v4

Check failure on line 62 in .github/workflows/release.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/release.yml

Invalid workflow file

You have an error in your yaml syntax on line 62
- uses: actions/cache@v4
if: !contains(matrix.target, '-pc-windows-')
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
key: cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: ${{ matrix.target }}
- name: Install cross-compilation tools
uses: taiki-e/setup-cross-toolchain-action@v1
with:
target: ${{ matrix.target }}
- name: Build
run: cargo build --release
- name: Determine paths
id: paths
run: |
EXE_suffix="" ; case ${{ matrix.target }} in *-pc-windows-*) EXE_suffix=".exe" ;; esac
BIN_PATH="target/${{ matrix.target }}/release/${NAME}${EXE_suffix}"
PKG_NAME=${NAME}-${{ matrix.target }}${EXE_suffix}
cp ${BIN_PATH} ${PKG_NAME}
echo "PKG_NAME=${PKG_NAME}" >> $GITHUB_OUTPUT
- name: Compress binary
if: startsWith( matrix.os, 'ubuntu' )
run: upx ${{ steps.paths.outputs.PKG_NAME }}
- name: Upload release archive
env:
GH_TOKEN: ${{ github.token }}
run: gh release upload ${VERSION} ${{ steps.paths.outputs.PKG_NAME }}