From f6d3c2a40bfaa3511df522770dc491819a818db1 Mon Sep 17 00:00:00 2001 From: Afonso Jorge Ramos Date: Fri, 25 Mar 2022 11:58:40 +0100 Subject: [PATCH] fix: move builds to use `actions-rs/cargo` with optional `cross` (#34) * testing alternative arm deployment * specify version * testing a different distro * move to floating version * move rust installation to `run` section * install curl * retry with `aarch64-unknown-linux-gnu` target * bump for action * another musl attempt * attempt with `armv7-unknown-linux-gnueabihf` * another attempt with `aarch64-unknown-linux-gnu` * attempt 1001 * attempt 1002 * testing with `actions-rs/cargo` * trying without `rustup target add` * use cross across all archs * remove if from macOS * uncomment release code --- .github/workflows/build.yml | 86 ++++++++++++++++++++++++------------- 1 file changed, 57 insertions(+), 29 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dfec179..4b83f6b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -45,20 +45,28 @@ jobs: default: true override: true - - name: Build - run: cargo build --all --release && mv target/release/discrakt target/release/discrakt_amd64 - - - name: Chmod - run: chmod +x target/release/discrakt_amd64 + - name: Build amd64 + uses: actions-rs/cargo@v1 + with: + command: build + args: --all --release - - name: Add ARM Target - run: rustup target add aarch64-unknown-linux-gnu + - name: Prepare amd64 binary + run: | + mv target/release/discrakt target/release/discrakt_amd64 + chmod +x target/release/discrakt_amd64 - - name: Build - run: cargo build --all --release --target=aarch64-unknown-linux-gnu && mv target/aarch64-unknown-linux-gnu/release/discrakt target/release/discrakt_arm64 + - name: Build arm64 + uses: actions-rs/cargo@v1 + with: + use-cross: true + command: build + args: --all --release --target=aarch64-unknown-linux-musl - - name: Chmod - run: chmod +x target/release/discrakt_arm64 + - name: Prepare arm64 Binary + run: | + mv target/aarch64-unknown-linux-musl/release/discrakt target/release/discrakt_arm64 + chmod +x target/release/discrakt_arm64 - name: Release uses: softprops/action-gh-release@v1 @@ -86,20 +94,32 @@ jobs: default: true override: true - - name: Build - run: cargo build --all --release && mv target/release/discrakt.exe target/release/discrakt_win64.exe + - name: Build win64 + uses: actions-rs/cargo@v1 + with: + command: build + args: --all --release + + - name: Prepare win64 Binary + run: mv target/release/discrakt.exe target/release/discrakt_win64.exe - - name: Create silent executable + - name: Create silent win64 executable run: sed -i '1i\#\!\[windows_subsystem\ \=\ \"windows\"\]' src/main.rs - - name: Build silent executable - run: cargo build --all --release && mv target/release/discrakt.exe target/release/discrakt_silent_win64.exe + - name: Build silent win64 executable + uses: actions-rs/cargo@v1 + with: + command: build + args: --all --release + + - name: Prepare silent win64 Binary + run: mv target/release/discrakt.exe target/release/discrakt_win64_silent.exe - name: Release silent executable uses: softprops/action-gh-release@v1 with: files: | - target/release/discrakt_silent_win64.exe + target/release/discrakt_win64_silent.exe target/release/discrakt_win64.exe env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -121,20 +141,28 @@ jobs: default: true override: true - - name: Build for mac - run: cargo build --all --release && mv target/release/discrakt target/release/discrakt_darwin - - - name: Chmod - run: chmod +x target/release/discrakt_darwin - - - name: Add ARM Target - run: rustup target add aarch64-apple-darwin + - name: Build darwin + uses: actions-rs/cargo@v1 + with: + command: build + args: --all --release - - name: Build - run: cargo build --all --release --target=aarch64-apple-darwin && mv target/aarch64-apple-darwin/release/discrakt target/release/discrakt_darwin_arm64 + - name: Prepare darwin binary + run: | + mv target/release/discrakt target/release/discrakt_darwin + chmod +x target/release/discrakt_darwin - - name: Chmod - run: chmod +x target/release/discrakt_darwin_arm64 + - name: Build darwin arm64 + uses: actions-rs/cargo@v1 + with: + use-cross: true + command: build + args: --all --release --target=aarch64-apple-darwin + + - name: Prepare darwin arm64 binary + run: | + mv target/aarch64-apple-darwin/release/discrakt target/release/discrakt_darwin_arm64 + chmod +x target/release/discrakt_darwin_arm64 - name: Release uses: softprops/action-gh-release@v1