177 lines
5.4 KiB
YAML
177 lines
5.4 KiB
YAML
name: Build
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
types: [opened, synchronize]
|
|
merge_group:
|
|
types: [checks_requested]
|
|
|
|
env:
|
|
ONELAUNCHER_CUSTOM_APT_FLAGS: --no-install-recommends
|
|
CARGO_INCREMENTAL: 0
|
|
CARGO_NET_RETRY: 10
|
|
RUST_BACKTRACE: short
|
|
RUSTUP_MAX_RETRIES: 10
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
es:
|
|
name: EcmaScript Checks
|
|
runs-on: ubuntu-22.04
|
|
timeout-minutes: 7
|
|
permissions: {}
|
|
steps:
|
|
- name: Prepare Target
|
|
run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 1))" >> "${GITHUB_ENV}"
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
|
with:
|
|
fetch-depth: ${{ env.PR_FETCH_DEPTH }}
|
|
|
|
- name: Setup Pnpm
|
|
uses: ./.github/actions/setup-pnpm
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Linting
|
|
run: pnpm lint:es
|
|
|
|
# - name: Testing
|
|
# run: pnpm test:es
|
|
|
|
rust:
|
|
name: Rustfmt
|
|
runs-on: ubuntu-22.04
|
|
timeout-minutes: 10
|
|
permissions:
|
|
contents: read
|
|
steps:
|
|
- name: (Linux) Maximize build space
|
|
if: ${{ runner.os == 'Linux' }}
|
|
uses: easimon/maximize-build-space@fc881a613ad2a34aca9c9624518214ebc21dfc0c
|
|
with:
|
|
swap-size-mb: 4096
|
|
root-reserve-mb: 6144
|
|
remove-dotnet: 'true'
|
|
remove-codeql: 'true'
|
|
remove-haskell: 'true'
|
|
remove-docker-images: 'true'
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
|
|
|
- name: (Windows) Setup Target
|
|
if: ${{ runner.os == 'Windows' }}
|
|
shell: powershell
|
|
run: |
|
|
New-Item -ItemType Directory -Force -Path C:\onelauncher_target
|
|
New-Item -Path target -ItemType Junction -Value C:\onelauncher_target
|
|
|
|
- name: Prepare Target
|
|
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36
|
|
continue-on-error: true
|
|
id: filter
|
|
with:
|
|
filters: |
|
|
changes:
|
|
- ${{ runner.os == 'Windows' && 'packages/scripts/setup.ps1' || 'packages/scripts/setup.sh' }}
|
|
- 'packages/scripts/prepare.ts'
|
|
- 'apps/cli/*/**'
|
|
- 'apps/desktop/*/**'
|
|
- 'apps/testing/*/**'
|
|
- 'packages/core/**'
|
|
- 'packages/macros/**'
|
|
- 'Cargo.toml'
|
|
- 'Cargo.lock'
|
|
- '.github/workflows/build.yml'
|
|
|
|
- name: Setup System
|
|
if: steps.filter.outcome != 'success' || steps.filter.outputs.changes == 'true'
|
|
uses: ./.github/actions/setup-system
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Run Rustfmt
|
|
if: steps.filter.outcome != 'success' || steps.filter.outputs.changes == 'true'
|
|
run: cargo fmt --all -- --check
|
|
|
|
clippy:
|
|
strategy:
|
|
fail-fast: true
|
|
matrix:
|
|
settings:
|
|
- host: macos-13
|
|
target: x86_64-apple-darwin
|
|
- host: macos-14
|
|
target: aarch64-apple-darwin
|
|
- host: windows-latest
|
|
target: x86_64-pc-windows-msvc
|
|
- host: ubuntu-22.04
|
|
target: x86_64-unknown-linux-gnu
|
|
runs-on: ${{ matrix.settings.host }}
|
|
name: Clippy (${{ matrix.settings.host }})
|
|
timeout-minutes: 45
|
|
permissions:
|
|
contents: read
|
|
steps:
|
|
- name: (Linux) Maximize build space
|
|
if: ${{ runner.os == 'Linux' }}
|
|
uses: easimon/maximize-build-space@fc881a613ad2a34aca9c9624518214ebc21dfc0c
|
|
with:
|
|
swap-size-mb: 4096
|
|
root-reserve-mb: 6144
|
|
remove-dotnet: 'true'
|
|
remove-codeql: 'true'
|
|
remove-haskell: 'true'
|
|
remove-docker-images: 'true'
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
|
|
|
- name: (Windows) Setup Target
|
|
if: ${{ runner.os == 'Windows' }}
|
|
shell: powershell
|
|
run: |
|
|
New-Item -ItemType Directory -Force -Path C:\onelauncher_target
|
|
New-Item -Path target -ItemType Junction -Value C:\onelauncher_target
|
|
|
|
- name: Prepare Target
|
|
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36
|
|
continue-on-error: true
|
|
id: preparation
|
|
with:
|
|
filters: |
|
|
changes:
|
|
- ${{ runner.os == 'Windows' && 'packages/scripts/setup.ps1' || 'packages/scripts/setup.sh' }}
|
|
- 'packages/scripts/prepare.ts'
|
|
- 'apps/cli/*/**'
|
|
- 'apps/desktop/*/**'
|
|
- 'apps/testing/*/**'
|
|
- 'packages/core/**'
|
|
- 'packages/macros/**'
|
|
- 'Cargo.toml'
|
|
- 'Cargo.lock'
|
|
- '.github/workflows/build.yml'
|
|
|
|
- name: Setup System
|
|
if: steps.preparation.outcome != 'success' || steps.preparation.outputs.changes == 'true'
|
|
uses: ./.github/actions/setup-system
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Run Clippy
|
|
if: steps.preparation.outcome != 'success' || steps.preparation.outputs.changes == 'true'
|
|
uses: ./.github/actions/clippy
|
|
with:
|
|
reporter: github-pr-review
|
|
tool_name: 'Clippy (${{ matrix.settings.host }})'
|
|
filter_mode: diff_context
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
clippy_flags: --workspace --all-features --locked
|
|
fail_on_error: true
|