Skip to content

Commit

Permalink
ci: try to cross build
Browse files Browse the repository at this point in the history
  • Loading branch information
SARDONYX-sard committed Dec 19, 2024
1 parent edb2b74 commit 72e61c6
Showing 1 changed file with 80 additions and 0 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/cross-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Cross Build

on:
push:
branches: ['main']
pull_request:
branches: '*'
workflow_dispatch: # <- Setting to allow manual execution by button.

env:
CARGO_TERM_COLOR: always
BUILD_PROFILE: release-no-lto
APP_NAME: d_merge

jobs:
build:
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}

steps:
- uses: actions/checkout@v4.2.2
with:
submodules: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Rust cache
uses: Swatinem/rust-cache@v2.7.5
with:
prefix-key: cargo-cross-${{ env.BUILD_PROFILE }}-${{ matrix.platform }}

- name: Install dependencies (Ubuntu)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y nsis lld llvm
- name: Change default build target
run: rustup target add x86_64-pc-windows-msvc

- name: Install winodws build runner
run: cargo install --locked cargo-xwin

- name: Sync node version
uses: actions/setup-node@v4.1.0
with:
node-version: 'lts/*'
cache: 'npm'

- name: Node.js cache
uses: actions/cache@v4.2.0
with:
path: ${{ github.workspace }}/gui/frontend/.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('gui/frontend/src/**/*.[jt]s', 'gui/frontend/src/**/*.[jt]sx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
- name: Install frontend dependencies
run: npm ci --force

- name: Test(Node.js)
run: npm test
- name: Build Test(GUI)
run: npm run build

- name: Compress outputs(Linux)
shell: bash
if: runner.os == 'Linux'
run: |
mkdir -p ./build/assets
mv ./target/${{ env.BUILD_PROFILE }}/${{ env.APP_NAME }} ./build
mv ./resource/assets ./build
# ----------------------------------------------------------------------------------------------------------------
- name: Upload a Build Artifact
uses: actions/upload-artifact@v4.5.0
with:
name: ${{ env.APP_NAME }}-${{runner.os}}
path: |
./build/

0 comments on commit 72e61c6

Please sign in to comment.