-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attempt to apply the new cross-compile actions to a release build.
For testing purposes this workflow triggers on every commit, but got defanged not to use secrets or publish.
- Loading branch information
Showing
1 changed file
with
81 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# 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: Not a Release | ||
on: | ||
push: | ||
branches: [ main ] | ||
paths: | ||
- '**.rs' | ||
- '**/Cargo.*' | ||
pull_request: | ||
branches: [ main ] | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
env: | ||
NAME: ${{ github.event.repository.name }} | ||
VERSION: ${{ github.ref_name }} | ||
|
||
jobs: | ||
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 | ||
|
||
- 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: matrix.use-cross | ||
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 }} |