From b7840f663f772a1e8eb6365c365ca3014a6956a9 Mon Sep 17 00:00:00 2001 From: John Eriksson Date: Tue, 4 Jun 2024 21:42:33 +0200 Subject: [PATCH] New Github test --- .github/workflows/build.yml | 191 +++++++++++++----------------------- 1 file changed, 70 insertions(+), 121 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3625c66..3a38193 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,136 +9,85 @@ env: BIN: migo-hqm-server jobs: - windows: - runs-on: windows-latest + build: + runs-on: ${{ matrix.platform.os }} strategy: fail-fast: false matrix: - target: - - x86_64-pc-windows-msvc - - aarch64-pc-windows-msvc + platform: + - target: x86_64-pc-windows-msvc + os: windows-latest + - target: aarch64-pc-windows-msvc + os: windows-latest + - target: x86_64-apple-darwin + os: macos-latest + - target: aarch64-apple-darwin + os: macos-latest + - target: aarch64-unknown-linux-gnu + os: ubuntu-latest + - target: aarch64-unknown-linux-musl + os: ubuntu-latest + - target: armv7-unknown-linux-gnueabihf + os: ubuntu-latest + - target: armv7-unknown-linux-musleabihf + os: ubuntu-latest + - target: arm-unknown-linux-gnueabihf + os: ubuntu-latest + - target: arm-unknown-linux-musleabihf + os: ubuntu-latest + - target: i686-unknown-linux-gnu + os: ubuntu-latest + - target: i686-unknown-linux-musl + os: ubuntu-latest + - target: i686-unknown-freebsd + os: ubuntu-latest + - target: x86_64-unknown-linux-gnu + os: ubuntu-latest + - target: x86_64-unknown-linux-musl + os: ubuntu-latest + - target: x86_64-unknown-freebsd + os: ubuntu-latest + - target: riscv64gc-unknown-linux-gnu + os: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 + - uses: actions/checkout@v4 + - name: Cache cargo & target directories + uses: Swatinem/rust-cache@v2 + - name: Install musl-tools on Linux + run: sudo apt-get update --yes && sudo apt-get install --yes musl-tools + if: contains(matrix.platform.target, 'musl') + - name: Build binary + uses: houseabsolute/actions-rust-cross@v0 with: - toolchain: stable - target: ${{matrix.target}} - override: true - - uses: actions-rs/cargo@v1 + command: "build" + target: ${{ matrix.platform.target }} + toolchain: "stable" + args: "--locked --release" + strip: true + - run: | + 7z a migo-hqm-server.zip config.ini README.md example_replay_integration.py ".\target\${{ matrix.platform.target }}\release\migo-hqm-server.exe" + shell: bash + if: matrix.platform.os == 'windows-latest' + - name: Publish release artifacts + uses: actions/upload-artifact@v4 with: - command: build - args: --release --target ${{matrix.target}} + name: migo-hqm-server-${{ matrix.target }} + path: migo-hqm-server.zip + if: matrix.platform.os == 'windows-latest' - run: | - 7z a "${{ env.BIN }}.zip" config.ini README.md example_replay_integration.py ".\target\${{ matrix.target }}\release\${{ env.BIN }}.exe" + tar -czvf migo-hqm-server.tar.gz config.ini README.md example_replay_integration.py -C target/${{ matrix.platform.target }}/release migo-hqm-server shell: bash - - uses: XAMPPRocky/create-release@v1.0.2 - id: create_release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + if: matrix.platform.os != 'windows-latest' + - name: Publish release artifacts + uses: actions/upload-artifact@v4 with: - tag_name: ${{ github.ref }} - release_name: ${{ github.ref }} - # Draft should **always** be false. GitHub doesn't provide a way to - # get draft releases from its API, so there's no point using it. - draft: false - prerelease: false - - uses: actions/upload-release-asset@v1 - id: upload-release-asset - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + name: migo-hqm-server-${{ matrix.target }} + path: migo-hqm-server.tar.gz + if: matrix.platform.os != 'windows-latest' + - name: Publish GitHub release + uses: softprops/action-gh-release@v2 with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ${{ env.BIN }}.zip - asset_name: ${{ env.BIN }}-${{ matrix.target }}.zip - asset_content_type: application/zip + files: "migo-hqm-server-*" + - macos: - runs-on: macos-latest - strategy: - fail-fast: false - matrix: - target: - - x86_64-apple-darwin - - aarch64-apple-darwin - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - target: ${{matrix.target}} - override: true - - uses: actions-rs/cargo@v1 - with: - command: build - args: --release --target ${{matrix.target}} - - run: tar -czvf ${{ env.BIN }}.tar.gz config.ini README.md example_replay_integration.py -C target/${{ matrix.target }}/release ${{ env.BIN }} - - uses: XAMPPRocky/create-release@v1.0.2 - id: create_release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: ${{ github.ref }} - draft: false - prerelease: false - - uses: actions/upload-release-asset@v1 - id: upload-release-asset - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ${{ env.BIN }}.tar.gz - asset_name: ${{ env.BIN }}-${{ matrix.target }}.tar.gz - asset_content_type: application/gzip - linux: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - target: - - aarch64-unknown-linux-gnu - - aarch64-unknown-linux-musl - - armv7-unknown-linux-gnueabihf - - armv7-unknown-linux-musleabihf - - arm-unknown-linux-gnueabihf - - arm-unknown-linux-musleabihf - - i686-unknown-linux-gnu - - i686-unknown-linux-musl - - i686-unknown-freebsd - - x86_64-unknown-linux-gnu - - x86_64-unknown-linux-musl - - x86_64-unknown-freebsd - - riscv64gc-unknown-linux-gnu - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - target: ${{matrix.target}} - override: true - - uses: actions-rs/cargo@v1 - with: - use-cross: true - command: build - args: --release --target ${{matrix.target}} - - run: tar -czvf ${{ env.BIN }}.tar.gz config.ini README.md example_replay_integration.py -C target/${{ matrix.target }}/release ${{ env.BIN }} - - uses: XAMPPRocky/create-release@v1.0.2 - id: create_release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: ${{ github.ref }} - draft: false - prerelease: false - - name: Upload Release Asset - id: upload-release-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ${{ env.BIN }}.tar.gz - asset_name: ${{ env.BIN }}-${{ matrix.target }}.tar.gz - asset_content_type: application/gzip