Skip to content

Add serde_json, enhance geph5-bridge with load average reporting, imp… #318

Add serde_json, enhance geph5-bridge with load average reporting, imp…

Add serde_json, enhance geph5-bridge with load average reporting, imp… #318

name: Build and Upload
on: [push]
jobs:
build:
strategy:
matrix:
include:
- os: ubuntu-20.04
target: x86_64-unknown-linux-musl
dir: musl
- os: ubuntu-20.04
target: x86_64-unknown-linux-gnu
dir: gnu
- os: windows-latest
target: i686-pc-windows-msvc
dir: windows
- os: macos-latest
target: x86_64-apple-darwin
dir: macos
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install musl-tools (Linux)
if: matrix.dir == 'musl'
run: sudo apt-get install -y musl-tools
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
target: ${{ matrix.target }}
- name: Set default host
shell: bash
run: rustup set default-host ${{ matrix.target }}
- name: Cache cargo build
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Build client
run: cargo build --locked --release --target ${{ matrix.target }} --manifest-path binaries/geph5-client/Cargo.toml
- name: Move client binaries to artifacts directory
shell: bash
run: |
mkdir -p artifacts/${{ matrix.dir }}
mv target/${{ matrix.target }}/release/geph5-client artifacts/${{ matrix.dir }}/
- name: Build bridge and exit
if: matrix.os == 'ubuntu-20.04'
run: |
cargo build --locked --release --target ${{ matrix.target }} --manifest-path binaries/geph5-bridge/Cargo.toml
cargo build --locked --release --target ${{ matrix.target }} --manifest-path binaries/geph5-exit/Cargo.toml
- name: Move bridge and exit binaries to artifacts directory
if: matrix.os == 'ubuntu-20.04'
run: |
mkdir -p artifacts/${{ matrix.dir }}
mv target/${{ matrix.target }}/release/geph5-bridge artifacts/${{ matrix.dir }}/
mv target/${{ matrix.target }}/release/geph5-exit artifacts/${{ matrix.dir }}/
- name: Build client GUI (non-Windows)
if: matrix.dir != 'musl' && matrix.os != 'windows-latest'
run: cargo build --locked --release --target ${{ matrix.target }} --manifest-path binaries/geph5-client-gui/Cargo.toml
- name: Move client GUI binaries to artifacts directory (non-Windows)
if: matrix.dir != 'musl' && matrix.os != 'windows-latest'
shell: bash
run: |
mkdir -p artifacts/${{ matrix.dir }}
mv target/${{ matrix.target }}/release/geph5-client-gui artifacts/${{ matrix.dir }}/
- name: Install cargo-bundle
if: matrix.os == 'macos-latest'
run: cargo install cargo-bundle
- name: Create macOS .app bundle
if: matrix.os == 'macos-latest'
run: |
cd binaries/geph5-client-gui
cargo bundle --release --target ${{ matrix.target }}
- name: Create macOS .app zip
if: matrix.os == 'macos-latest'
run: |
cd target/${{ matrix.target }}/release/bundle/osx/
zip -r "geph5-client-gui.app.zip" "Geph5.app"
mv "geph5-client-gui.app.zip" ../../../../../artifacts/${{ matrix.dir }}/
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.dir }}-latest
path: artifacts/${{ matrix.dir }}
build-windows-gui:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
target: i686-pc-windows-msvc
- name: Set default host
shell: bash
run: rustup set default-host i686-pc-windows-msvc
- name: Cache cargo build
uses: Swatinem/rust-cache@v2
with:
key: i686-pc-windows-msvc-gui
- name: Build Windows GUI client
run: |
cargo build --locked --release --target i686-pc-windows-msvc --manifest-path binaries/geph5-client/Cargo.toml --all-features
cargo build --locked --release --target i686-pc-windows-msvc --manifest-path binaries/geph5-client-gui/Cargo.toml
- name: Build Windows installer
shell: bash
run: |
choco install innosetup
cp target/i686-pc-windows-msvc/release/geph5-client-gui packaging/windows
cp target/i686-pc-windows-msvc/release/geph5-client packaging/windows
cp binaries/geph5-client/windows-lib/* packaging/windows
iscc packaging/windows/setup.iss
- name: Move Windows GUI artifacts
shell: bash
run: |
mkdir -p artifacts/windows-gui
cp packaging/windows/Output/* artifacts/windows-gui/
cp target/i686-pc-windows-msvc/release/geph5-client-gui artifacts/windows-gui/
- name: Upload Windows GUI artifact
uses: actions/upload-artifact@v2
with:
name: windows-gui-latest
path: artifacts/windows-gui
upload:
if: github.ref == 'refs/heads/master'
needs: [build, build-windows-gui]
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- dir: gnu
- dir: musl
- dir: macos
- dir: windows
- dir: windows-gui
steps:
- name: Download all artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Set up AWS configuration
run: |
aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }}
aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws configure set region apac
aws configure set output json
- name: Upload to Cloudflare R2
run: |
aws s3 cp ./artifacts/${{ matrix.dir }}-latest s3://geph5/${{ matrix.dir }}-latest --recursive --endpoint-url=https://b5e397a549f0e6543dba8e1d83ca9924.r2.cloudflarestorage.com