2022-12-13 15:12:40 +01:00
|
|
|
# This workflow relies on actions/cache to store the hak dependency artifacts as they take a long time to build
|
|
|
|
# Due to this extra care must be taken to only ever run all build_* scripts against the same branch to ensure
|
|
|
|
# the correct cache scoping, and additional care must be taken to not run untrusted actions on the develop branch.
|
2022-11-11 16:15:21 +01:00
|
|
|
on:
|
2022-12-15 12:00:58 +01:00
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
arch:
|
|
|
|
type: string
|
|
|
|
required: true
|
|
|
|
description: "The architecture to build for, one of 'x64' | 'x86'"
|
2022-11-11 16:15:21 +01:00
|
|
|
jobs:
|
2022-12-15 12:00:58 +01:00
|
|
|
build:
|
|
|
|
runs-on: windows-latest
|
|
|
|
steps:
|
|
|
|
- uses: kanga333/variable-mapper@master
|
|
|
|
id: config
|
|
|
|
with:
|
|
|
|
key: "${{ inputs.arch }}"
|
|
|
|
export_to: output
|
|
|
|
map: |
|
|
|
|
{
|
|
|
|
"x64": {
|
|
|
|
"target": "x86_64-pc-windows-msvc"
|
|
|
|
},
|
|
|
|
"x86": {
|
|
|
|
"target": "i686-pc-windows-msvc",
|
|
|
|
"build-args": "--ia32"
|
|
|
|
}
|
|
|
|
}
|
2022-11-14 12:09:07 +01:00
|
|
|
|
2022-12-15 12:00:58 +01:00
|
|
|
- uses: actions/checkout@v3
|
2022-11-11 16:15:21 +01:00
|
|
|
|
2022-12-15 12:00:58 +01:00
|
|
|
- uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: webapp
|
2022-11-11 16:15:21 +01:00
|
|
|
|
2022-12-15 12:00:58 +01:00
|
|
|
- name: Cache .hak
|
|
|
|
id: cache
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
key: ${{ runner.os }}-${{ hashFiles('hakDependencies.json', 'electronVersion') }}
|
|
|
|
path: |
|
|
|
|
./.hak
|
2022-11-11 16:15:21 +01:00
|
|
|
|
2022-12-15 12:00:58 +01:00
|
|
|
- name: Set up build tools
|
|
|
|
uses: ilammy/msvc-dev-cmd@v1
|
|
|
|
with:
|
|
|
|
arch: ${{ inputs.arch }}
|
2022-11-11 16:15:21 +01:00
|
|
|
|
2022-12-15 12:00:58 +01:00
|
|
|
# ActiveTCL package on choco is from 2015,
|
|
|
|
# this one is newer but includes more than we need
|
|
|
|
- name: Choco install tclsh
|
|
|
|
shell: pwsh
|
|
|
|
run: |
|
|
|
|
choco install -y magicsplat-tcl-tk --no-progress
|
|
|
|
echo "${HOME}/AppData/Local/Apps/Tcl86/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
2022-11-11 16:15:21 +01:00
|
|
|
|
2022-12-15 12:00:58 +01:00
|
|
|
- name: Choco install NetWide Assembler
|
|
|
|
shell: pwsh
|
|
|
|
run: |
|
|
|
|
choco install -y nasm --no-progress
|
|
|
|
echo "C:/Program Files/NASM" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
2022-11-11 16:15:21 +01:00
|
|
|
|
2022-12-15 12:00:58 +01:00
|
|
|
- name: Install Rust
|
|
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
target: ${{ steps.config.outputs.target }}
|
2022-11-11 16:15:21 +01:00
|
|
|
|
2022-12-15 12:00:58 +01:00
|
|
|
- uses: actions/setup-node@v3
|
|
|
|
with:
|
|
|
|
cache: "yarn"
|
2022-11-11 16:15:21 +01:00
|
|
|
|
2022-12-15 12:00:58 +01:00
|
|
|
# Does not need branch matching as only analyses this layer
|
|
|
|
- name: Install Deps
|
|
|
|
run: "yarn install --pure-lockfile"
|
2022-11-11 16:15:21 +01:00
|
|
|
|
2022-12-15 12:00:58 +01:00
|
|
|
- name: Build Natives
|
|
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
|
|
run: |
|
|
|
|
refreshenv
|
|
|
|
yarn build:native --target ${{ steps.config.outputs.target }}
|
2022-11-11 16:15:21 +01:00
|
|
|
|
2022-12-15 12:00:58 +01:00
|
|
|
- name: Build App
|
|
|
|
run: "yarn build --publish never -w ${{ steps.config.outputs.build-args }}"
|
2022-11-11 16:15:21 +01:00
|
|
|
|
2022-12-15 12:00:58 +01:00
|
|
|
- name: Upload Artifacts
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: win-${{ inputs.arch }}
|
|
|
|
path: dist
|
|
|
|
retention-days: 1
|