2023-03-30 16:34:07 -07:00
|
|
|
# Name of the workflow
|
2023-03-30 15:02:57 -07:00
|
|
|
name: Build
|
|
|
|
|
2023-03-30 16:34:07 -07:00
|
|
|
# Events used by github actions to know when to execute this workflow
|
2023-03-30 15:02:57 -07:00
|
|
|
on:
|
2023-03-30 16:34:07 -07:00
|
|
|
|
2023-03-30 15:02:57 -07:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
2023-03-30 16:34:07 -07:00
|
|
|
|
2023-03-30 15:02:57 -07:00
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- main
|
2023-03-30 16:34:07 -07:00
|
|
|
|
2023-03-30 15:02:57 -07:00
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
type:
|
|
|
|
description: 'Meson buildtype (release, debug, etc.)'
|
|
|
|
required: false
|
2023-03-30 16:34:07 -07:00
|
|
|
|
2023-03-30 15:02:57 -07:00
|
|
|
test:
|
|
|
|
description: 'Run tests (test)'
|
|
|
|
required: false
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
2023-03-30 16:34:07 -07:00
|
|
|
runs-on:
|
|
|
|
windows-latest
|
2023-03-30 15:02:57 -07:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Check out repository
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
2023-03-30 16:34:07 -07:00
|
|
|
|
|
|
|
- name: Install Meson, Ninja, and Clang with Chocolatey and pip
|
2023-03-30 15:02:57 -07:00
|
|
|
shell: pwsh
|
2023-03-30 16:34:07 -07:00
|
|
|
|
2023-03-30 15:02:57 -07:00
|
|
|
run: |
|
|
|
|
$ErrorActionPreference = "Stop"
|
2023-03-30 16:34:07 -07:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2023-03-30 15:28:06 -07:00
|
|
|
python -m pip install meson
|
2023-03-30 15:02:57 -07:00
|
|
|
|
2023-03-30 16:34:07 -07:00
|
|
|
|
2023-03-30 15:02:57 -07:00
|
|
|
- name: Run PowerShell build script
|
2023-03-30 16:34:07 -07:00
|
|
|
|
2023-03-30 15:02:57 -07:00
|
|
|
shell: pwsh
|
2023-03-30 16:34:07 -07:00
|
|
|
|
|
|
|
env:
|
|
|
|
CC: clang
|
|
|
|
CXX: clang++
|
|
|
|
BUILD_TYPE: ${{ github.event.inputs.type }}
|
|
|
|
RUN_TESTS: ${{ github.event.inputs.test }}
|
|
|
|
|
2023-03-30 15:02:57 -07:00
|
|
|
run: |
|
2023-03-30 16:34:07 -07:00
|
|
|
$ErrorActionPreference = "Stop"
|
2023-03-30 15:02:57 -07:00
|
|
|
|
2023-03-30 16:34:07 -07:00
|
|
|
$type = $env:BUILD_TYPE
|
|
|
|
$test = $env:RUN_TESTS
|
2023-03-30 15:02:57 -07:00
|
|
|
|
2023-03-30 16:34:07 -07:00
|
|
|
$args = @()
|
|
|
|
if (-not [string]::IsNullOrEmpty($type)) { $args += $type }
|
|
|
|
if (-not [string]::IsNullOrEmpty($test)) { $args += $test }
|
2023-03-30 15:02:57 -07:00
|
|
|
|
2023-03-30 16:43:44 -07:00
|
|
|
& .\scripts\build.ci.ps1 debug test
|
2023-03-30 17:14:51 -07:00
|
|
|
|
|
|
|
|
|
|
|
- name: Create
|
|
|
|
shell: pwsh
|
|
|
|
run: |
|
|
|
|
New-Item -ItemType Directory -Path "./artifact"
|
|
|
|
Copy-Item "./build/refactor.exe" -Destination "./artifact/refactor.exe"
|
|
|
|
|
|
|
|
Compress-Archive -Path "./artifact/*" -DestinationPath "./artifact/artifact.zip"
|
|
|
|
|
|
|
|
- name: Upload artifact
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
|
|
|
|
with:
|
|
|
|
name: artifact
|
|
|
|
path: ./artifact/artifact.zip
|
|
|
|
|
|
|
|
|
|
|
|
release:
|
|
|
|
needs: build
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Download artifact
|
|
|
|
uses: actions/download-artifact@v2
|
|
|
|
with:
|
|
|
|
name: artifact
|
|
|
|
path: ./artifact
|
|
|
|
|
2023-03-30 18:07:10 -07:00
|
|
|
# - name: Extract artifact
|
|
|
|
# run: |
|
|
|
|
# unzip ./artifact/artifact.zip -d ./artifact
|
2023-03-30 17:14:51 -07:00
|
|
|
|
2023-03-30 18:21:31 -07:00
|
|
|
# - name: Create GitHub release
|
|
|
|
# id: create_release
|
|
|
|
# uses: actions/create-release@v1
|
2023-03-30 17:14:51 -07:00
|
|
|
|
2023-03-30 18:21:31 -07:00
|
|
|
# env:
|
|
|
|
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2023-03-30 17:14:51 -07:00
|
|
|
|
2023-03-30 18:21:31 -07:00
|
|
|
# with:
|
|
|
|
# tag_name: release
|
|
|
|
# release_name: Release
|
|
|
|
# draft: false
|
|
|
|
# prerelease: false
|
2023-03-30 17:14:51 -07:00
|
|
|
|
2023-03-30 18:07:10 -07:00
|
|
|
# - name: Upload refactor.exe to the release
|
|
|
|
# uses: actions/upload-release-asset@v1
|
2023-03-30 17:14:51 -07:00
|
|
|
|
2023-03-30 18:07:10 -07:00
|
|
|
# env:
|
|
|
|
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
# with:
|
|
|
|
# upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
|
|
# asset_path: ./artifact/refactor.exe
|
|
|
|
# asset_name: refactor.exe
|
|
|
|
# asset_content_type: application/octet-stream
|
2023-03-30 17:14:51 -07:00
|
|
|
|
2023-03-30 18:07:10 -07:00
|
|
|
- name: Upload release build
|
|
|
|
uses: ncipollo/release-action@v1.12.0
|
2023-03-30 17:14:51 -07:00
|
|
|
with:
|
2023-03-30 18:07:10 -07:00
|
|
|
name: "Release"
|
|
|
|
tag: release
|
|
|
|
artifacts: /artifact/artifact.zip
|
|
|
|
allowUpdates: true
|
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|