test_build #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: test_build | |
on: | |
workflow_dispatch: | |
inputs: | |
platform: | |
description: 'Platform' | |
required: true | |
default: 'windows-latest' | |
type: choice | |
options: | |
- windows-latest | |
- ubuntu-latest | |
jobs: | |
# Build and upload as artifacts | |
build: | |
name: Building for tests on ${{ inputs.platform }} | |
runs-on: ${{ inputs.platform }} | |
env: | |
PACKAGE_NAME: ${{ fromJSON('{"windows-latest":"ufc-ripper-win32-x64.zip","ubuntu-latest":"ufc-ripper-linux-x64.zip"}')[ inputs.platform ] }} | |
TARGET_PLATFORM: ${{ fromJSON('{"windows-latest":"win32","ubuntu-latest":"linux"}')[ inputs.platform ] }} | |
steps: | |
# Checkout repo | |
- uses: actions/checkout@v4 | |
# Setup Node.js | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
# Install npm deps | |
- name: Install npm dependencies | |
run: npm install --no-audit | |
# Build Vue frontend | |
- name: Build frontend | |
run: npm run build | |
# Set up Rust and Cargo | |
- name: Set up Rust toolchain | |
uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: 1.77.2 | |
# Build app | |
- name: Build backend | |
run: cargo build-${{ env.TARGET_PLATFORM }} | |
# Package app for release | |
- name: Package app | |
run: cargo pack-${{ env.TARGET_PLATFORM }} | |
# Create Windows installer | |
- if: inputs.platform == 'windows-latest' | |
name: Create Windows installer | |
shell: bash | |
run: | | |
cargo install cargo-packager --version 0.8.1 --locked | |
cargo create-installer-win32 | |
rm -rf ./package/artifacts/.cargo-packager || true | |
# Upload build artifact | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ufc-ripper-test-build-${{ github.run_number }}-artifacts | |
path: package/artifacts/* |