From 2c30f6c40ff38b875d5f602e771524030c9c0bdb Mon Sep 17 00:00:00 2001 From: Luca Date: Thu, 7 Dec 2023 08:25:27 +0100 Subject: [PATCH] try to fix the github action (2) --- .github/workflows/build.yaml | 110 +++++++++++------------------------ 1 file changed, 34 insertions(+), 76 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 5a826ff..710aa58 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -8,98 +8,56 @@ jobs: strategy: matrix: platform: - - os_name: linux-x86_64 - os: ubuntu-20.04 - target: x86_64-unknown-linux-musl - bin: tempo - name: tempo-linux-x86_64-musl.tar.gz - cross: false - cargo_command: cargo + # - release_for: FreeBSD-x86_64 + # os: ubuntu-20.04 + # target: x86_64-unknown-freebsd + # bin: server + # name: server-FreeBSD-x86_64.tar.gz + # command: build + + - release_for: Windows-x86_64 + os: windows-latest + target: x86_64-pc-windows-msvc + bin: server.exe + name: server-windows-x86_64.zip + command: both - # - os_name: windows-aarch64 - # os: windows-latest - # target: aarch64-pc-windows-msvc - # bin: tempo.exe - # name: tempo-windows-aarch64.zip - # cross: false - # cargo_command: cargo - # - # - os_name: macOS-x86_64 + # - release_for: macOS-x86_64 # os: macOS-latest # target: x86_64-apple-darwin - # bin: tempo - # name: tempo-Darwin-x86_64.tar.gz - # cross: false - # cargo_command: cargo + # bin: server + # name: server-Darwin-x86_64.tar.gz + # command: both + + - release_for: Linux-x86_64 + os: windows-latest + target: x86_64-unknown-linux-musl + bin: server.exe + name: server-linux-x86_64.zip + command: both + runs-on: ${{ matrix.platform.os }} steps: - name: Checkout uses: actions/checkout@v3 - - name: Install toolchain if not cross-compiling - uses: dtolnay/rust-toolchain@stable + - name: Build binary + uses: houseabsolute/actions-rust-cross@v0 with: - targets: ${{ matrix.platform.target }} - if: ${{ !matrix.platform.cross }} - - name: Install musl-tools on linux - run: sudo apt-get update --yes && sudo apt-get install --yes musl-tools - if: contains(matrix.platform.os, 'ubuntu') && !matrix.platform.cross - - name: Install cross if cross-compiling (*nix) - id: cross-nix - shell: bash - run: | - set -e - export TARGET="$HOME/bin" - mkdir -p "$TARGET" - ./bootstrap/bootstrap-tempo.sh - "$HOME/bin/tempo" --project cross-rs/cross --matching musl --in . - if: matrix.platform.cross && !contains(matrix.platform.os, 'windows') - - name: Install cross if cross-compiling (windows) - id: cross-windows - shell: powershell - run: | - .\bootstrap\bootstrap-tempo.ps1 - .\tempo --project cross-rs/cross --in . - if: matrix.platform.cross && contains(matrix.platform.os, 'windows') - - name: Build binary (*nix) - shell: bash - run: | - ${{ matrix.platform.cargo_command }} build --locked --release --target ${{ matrix.platform.target }} - if: ${{ !contains(matrix.platform.os, 'windows') }} - - name: Build binary (windows) - # We have to use the platform's native shell. If we use bash on - # windows then OpenSSL complains that the Perl it finds doesn't use - # the platform's native paths and refuses to build. - shell: powershell - run: | - & ${{ matrix.platform.cargo_command }} build --locked --release --target ${{ matrix.platform.target }} - if: contains(matrix.platform.os, 'windows') - - name: Strip binary - shell: bash - run: | - strip target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }} - # strip doesn't work with cross-arch binaries on linux or windows. - if: ${{ !(matrix.platform.cross || matrix.platform.target == 'aarch64-pc-windows-msvc') }} - - name: Package as archive - shell: bash - run: | - cd target/${{ matrix.platform.target }}/release - if [[ "${{ matrix.platform.os }}" == "windows-latest" ]]; then - 7z a ../../../${{ matrix.platform.name }} ${{ matrix.platform.bin }} - else - tar czvf ../../../${{ matrix.platform.name }} ${{ matrix.platform.bin }} - fi - cd - + command: ${{ matrix.platform.command }} + target: ${{ matrix.platform.target }} + args: "--locked --release" + strip: true - name: Publish release artifacts uses: actions/upload-artifact@v3 with: - name: tempo-${{ matrix.platform.os_name }} - path: "tempo*" + name: server-${{ matrix.platform.os_name }} + path: "server*" if: github.ref == 'refs/tags/test-release' - name: Publish GitHub release uses: softprops/action-gh-release@v1 with: draft: true - files: "tempo*" + files: "server*" # body_path: Changes.md if: startsWith( github.ref, 'refs/tags/v' )