element-desktop/.github/workflows/build_windows.yaml
2022-11-14 11:09:07 +00:00

88 lines
2.3 KiB
YAML

on:
workflow_call:
inputs:
arch:
type: string
required: true
description: "The architecture to build for, one of 'x64' | 'x86'"
jobs:
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"
}
}
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: webapp
- name: Cache .hak
uses: actions/cache@v3
with:
key: ${{ runner.os }}-${{ hashFiles('./yarn.lock') }}
path: |
./.hak
- name: Set up build tools
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ inputs.arch }}
# 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
- 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
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ steps.config.outputs.target }}
- uses: actions/setup-node@v3
with:
cache: "yarn"
# Does not need branch matching as only analyses this layer
- name: Install Deps
run: "yarn install --pure-lockfile"
- name: Build Natives
run: |
refreshenv
yarn build:native --target ${{ steps.config.outputs.target }}
- name: Build App
run: "yarn build --publish never -w ${{ steps.config.outputs.build-args }}"
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: win-${{ inputs.arch }}
path: dist
retention-days: 1