Skip to content

Commit

Permalink
New Github test
Browse files Browse the repository at this point in the history
  • Loading branch information
migomipo committed Jun 4, 2024
1 parent 27924f6 commit b7840f6
Showing 1 changed file with 70 additions and 121 deletions.
191 changes: 70 additions & 121 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
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/[email protected]
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/[email protected]
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

0 comments on commit b7840f6

Please sign in to comment.