Skip to content

build

build #136

Workflow file for this run

name: build
on:
push:
branches:
- master
pull_request:
branches:
- master
schedule:
- cron: '0 */12 * * *'
jobs:
build:
runs-on: ${{ matrix.os }}
concurrency:
group: build-${{ matrix.os }}-${{ matrix.mode }}
cancel-in-progress: true
strategy:
fail-fast: false
matrix:
os: [ ubuntu-24.04, ubuntu-24.04-arm, macos-15, windows-2022 ]
mode: [ nightly, release ]
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Set build variables
id: vars
shell: bash
run: |
if [ "${{ matrix.mode }}" = "release" ]; then
echo "file_suffix=" >> $GITHUB_OUTPUT
echo "tag_suffix=-release" >> $GITHUB_OUTPUT
else
echo "file_suffix=-nightly" >> $GITHUB_OUTPUT
echo "tag_suffix=" >> $GITHUB_OUTPUT
fi
- name: Build on Ubuntu
if: matrix.os == 'ubuntu-24.04' || matrix.os == 'ubuntu-24.04-arm'
run: |
bash misc/base_install_linux.sh
bash auto-build.sh ${{ matrix.mode == 'release' && 'release' || '' }}
bash package_tools/deb/make.sh
cp *.deb covscript-ubuntu-$(arch)${{ steps.vars.outputs.file_suffix }}.deb
- name: Build on macOS
if: matrix.os == 'macos-15'
run: |
bash misc/base_install_macos.sh
bash auto-build.sh ${{ matrix.mode == 'release' && 'release' || '' }}
bash package_tools/dmg/make.sh
cp *.dmg covscript-macos-arm64${{ steps.vars.outputs.file_suffix }}.dmg
- name: Setup MSYS2
if: matrix.os == 'windows-2022'
uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
update: true
- name: Install WiX
if: matrix.os == 'windows-2022'
shell: pwsh
run: |
$candle = Get-Command candle.exe -ErrorAction SilentlyContinue
$light = Get-Command light.exe -ErrorAction SilentlyContinue
if ($null -eq $candle -or $null -eq $light) {
choco install wixtoolset -y
}
- name: Locate WiX
if: matrix.os == 'windows-2022'
id: wix
shell: pwsh
run: |
function Resolve-CommandPath($commandName) {
$command = Get-Command $commandName -ErrorAction SilentlyContinue | Select-Object -First 1
if ($null -eq $command) {
return $null
}
if ($command.Path -and (Test-Path $command.Path)) {
return $command.Path
}
if ($command.Definition -and (Test-Path $command.Definition)) {
return $command.Definition
}
return $null
}
$candle = Resolve-CommandPath 'candle.exe'
$light = Resolve-CommandPath 'light.exe'
if ($null -eq $candle -or $null -eq $light) {
$candleFile = Get-ChildItem -Path 'C:\Program Files (x86)', 'C:\Program Files', 'C:\ProgramData\chocolatey\bin', 'C:\ProgramData\chocolatey\lib' -Filter candle.exe -File -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1
$lightFile = Get-ChildItem -Path 'C:\Program Files (x86)', 'C:\Program Files', 'C:\ProgramData\chocolatey\bin', 'C:\ProgramData\chocolatey\lib' -Filter light.exe -File -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1
if ($null -ne $candleFile) {
$candle = $candleFile.FullName
}
if ($null -ne $lightFile) {
$light = $lightFile.FullName
}
}
if ($null -eq $candle -or $null -eq $light) {
throw 'Unable to locate WiX tools candle.exe and light.exe.'
}
$wixBin = Split-Path $candle -Parent
if (-not (Test-Path (Join-Path $wixBin 'light.exe'))) {
throw "Located candle.exe in '$wixBin', but light.exe is missing from that directory."
}
"WIX_BIN_WIN=$wixBin" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
Write-Host "Using WiX bin directory: $wixBin"
- name: Build on Windows
if: matrix.os == 'windows-2022'
shell: msys2 {0}
run: |
bash misc/base_install_msys2.sh
bash auto-build.sh ${{ matrix.mode == 'release' && 'release' || '' }}
WIX_BIN_MSYS="$(cygpath "$WIX_BIN_WIN")"
PATH="$WIX_BIN_MSYS:$PATH" bash package_tools/wix/make.sh
cp *.msi covscript-windows-x86_64${{ steps.vars.outputs.file_suffix }}.msi
- name: Package CSPKG Repo and Build files (Ubuntu)
if: (matrix.os == 'ubuntu-24.04' || matrix.os == 'ubuntu-24.04-arm') && github.event_name != 'pull_request'
run: |
7z a -mmt4 -mx9 cspkg-ubuntu-$(arch)${{ steps.vars.outputs.file_suffix }}.7z cspkg-repo
7z a -mmt4 -mx9 covscript-ubuntu-$(arch)${{ steps.vars.outputs.file_suffix }}.7z build
- name: Package CSPKG Repo and Build files (macOS)
if: matrix.os == 'macos-15' && github.event_name != 'pull_request'
run: |
7z a -mmt4 -mx9 cspkg-macos-arm64${{ steps.vars.outputs.file_suffix }}.7z cspkg-repo
7z a -mmt4 -mx9 covscript-macos-arm64${{ steps.vars.outputs.file_suffix }}.7z build
- name: Package CSPKG Repo and Build files (Windows)
if: matrix.os == 'windows-2022' && github.event_name != 'pull_request'
run: |
7z a -mmt4 -mx9 cspkg-windows-x86_64${{ steps.vars.outputs.file_suffix }}.7z cspkg-repo
7z a -mmt4 -mx9 covscript-windows-x86_64${{ steps.vars.outputs.file_suffix }}.7z build
- name: Release (Windows MSI)
if: matrix.os == 'windows-2022' && github.event_name != 'pull_request'
uses: softprops/action-gh-release@v3
with:
token: "${{ secrets.GITHUB_TOKEN }}"
tag_name: "windows-schedule${{ steps.vars.outputs.tag_suffix }}"
name: "Windows Schedule ${{ matrix.mode == 'release' && 'Release' || 'Nightly' }} Build"
prerelease: ${{ matrix.mode == 'nightly' }}
files: |
*.msi
*.7z
- name: Release (Ubuntu x86_64)
if: matrix.os == 'ubuntu-24.04' && github.event_name != 'pull_request'
uses: softprops/action-gh-release@v3
with:
token: "${{ secrets.GITHUB_TOKEN }}"
tag_name: "ubuntu-schedule${{ steps.vars.outputs.tag_suffix }}"
name: "Ubuntu Schedule ${{ matrix.mode == 'release' && 'Release' || 'Nightly' }} Build"
prerelease: ${{ matrix.mode == 'nightly' }}
files: |
*.deb
*.7z
- name: Release (Ubuntu ARM)
if: matrix.os == 'ubuntu-24.04-arm' && github.event_name != 'pull_request'
uses: softprops/action-gh-release@v3
with:
token: "${{ secrets.GITHUB_TOKEN }}"
tag_name: "ubuntu-arm-schedule${{ steps.vars.outputs.tag_suffix }}"
name: "Ubuntu for ARM Schedule ${{ matrix.mode == 'release' && 'Release' || 'Nightly' }} Build"
prerelease: ${{ matrix.mode == 'nightly' }}
files: |
*.deb
*.7z
- name: Release (macOS DMG)
if: matrix.os == 'macos-15' && github.event_name != 'pull_request'
uses: softprops/action-gh-release@v3
with:
token: "${{ secrets.GITHUB_TOKEN }}"
tag_name: "macos-schedule${{ steps.vars.outputs.tag_suffix }}"
name: "macOS Schedule ${{ matrix.mode == 'release' && 'Release' || 'Nightly' }} Build"
prerelease: ${{ matrix.mode == 'nightly' }}
files: |
*.dmg
*.7z
build-msys2:
runs-on: windows-2022
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup MSYS2
id: msys2
uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
update: true
- name: Install build dependencies
shell: msys2 {0}
run: bash misc/base_install_msys2.sh
- name: Package MSYS2 environment
if: github.event_name != 'pull_request'
shell: pwsh
env:
MSYS2_LOCATION: ${{ steps.msys2.outputs.msys2-location }}
run: |
7z a -mmt4 -mx9 covscript-msys2-ucrt64-x86_64.7z $env:MSYS2_LOCATION\ucrt64
- name: Release MSYS2 environment
if: github.event_name != 'pull_request'
uses: softprops/action-gh-release@v3
with:
token: "${{ secrets.GITHUB_TOKEN }}"
tag_name: "msys2-devenv"
name: "MSYS2 UCRT64 Dev Environment for CovScript"
files: |
*.7z