mirror of
https://github.com/Ed94/refactor.git
synced 2024-11-10 04:14:53 -08:00
111 lines
2.7 KiB
YAML
111 lines
2.7 KiB
YAML
# Name of the workflow
|
|
name: Build
|
|
|
|
# Events used by github actions to know when to execute this workflow
|
|
on:
|
|
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
workflow_dispatch:
|
|
inputs:
|
|
type:
|
|
description: 'Meson buildtype (release, debug, etc.)'
|
|
default: release
|
|
required: false
|
|
|
|
test:
|
|
description: 'Run tests (test)'
|
|
default: test
|
|
required: true
|
|
|
|
jobs:
|
|
build:
|
|
runs-on:
|
|
windows-latest
|
|
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
- name: Install Meson, Ninja, and Clang with Chocolatey and pip
|
|
shell: pwsh
|
|
|
|
run: |
|
|
$ErrorActionPreference = "Stop"
|
|
if (-not (Get-Command choco -ErrorAction SilentlyContinue))
|
|
{
|
|
Set-ExecutionPolicy Bypass -Scope Process -Force
|
|
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
|
|
}
|
|
|
|
if (-not (choco list --local-only | Select-String "python"))
|
|
{
|
|
choco install -y python
|
|
}
|
|
|
|
if (-not (choco list --local-only | Select-String "ninja"))
|
|
{
|
|
choco install -y ninja
|
|
}
|
|
|
|
if (-not (choco list --local-only | Select-String "llvm"))
|
|
{
|
|
choco install -y llvm
|
|
}
|
|
|
|
python -m pip install meson
|
|
|
|
|
|
- name: Run PowerShell build script
|
|
|
|
shell: pwsh
|
|
|
|
env:
|
|
CC: clang
|
|
CXX: clang++
|
|
BUILD_TYPE: ${{ github.event.inputs.type }}
|
|
RUN_TESTS: ${{ github.event.inputs.test }}
|
|
|
|
run: |
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
$type = $env:BUILD_TYPE
|
|
$test = $env:RUN_TESTS
|
|
|
|
$args = @()
|
|
if (-not [string]::IsNullOrEmpty($type)) { $args += $type }
|
|
if (-not [string]::IsNullOrEmpty($test)) { $args += $test }
|
|
|
|
Invoke-Expression "& .\scripts\build.ci.ps1 $args"
|
|
|
|
- name: Get Short Commit SHA
|
|
shell: pwsh
|
|
run: |
|
|
$shortSHA = $env:github_sha.Substring(0, 7)
|
|
echo "Short SHA: $shortSHA"
|
|
echo "SHORT_SHA=$shortSHA" | Out-File -FilePath $env:GITHUB_ENV -Append
|
|
|
|
- name: Create Package
|
|
shell: pwsh
|
|
run: |
|
|
New-Item -ItemType Directory -Path "./artifact"
|
|
Copy-Item "./build/refactor.exe" -Destination "./artifact/refactor.exe"
|
|
|
|
Compress-Archive -Path "./artifact/*" -DestinationPath "./artifact/refactor-$($env:SHORT_SHA).zip"
|
|
|
|
- name: Upload Release
|
|
uses: ncipollo/release-action@v1
|
|
with:
|
|
tag: Release
|
|
artifacts: ./artifact/refactor-${{ env.SHORT_SHA }}.zip
|
|
omitBody: true
|
|
# bodyFile: "body.md"
|
|
allowUpdates: true
|