From 3f0c95b9997860b0ad0dbb2f09ba237bab66d4d0 Mon Sep 17 00:00:00 2001 From: Simon Rupf Date: Tue, 17 Dec 2024 17:44:51 +0100 Subject: [PATCH] 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. --- .github/workflows/release-test.yml | 81 ++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 .github/workflows/release-test.yml diff --git a/.github/workflows/release-test.yml b/.github/workflows/release-test.yml new file mode 100644 index 00000000..f60a11a8 --- /dev/null +++ b/.github/workflows/release-test.yml @@ -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 }}