From 018286be6feb981d0674cb785d0f295e059c9a7b Mon Sep 17 00:00:00 2001 From: Ed_ Date: Thu, 30 Mar 2023 19:34:07 -0400 Subject: [PATCH] Some refinement to the gh-workflow --- .github/workflows/main.yml | 63 ++++++++++++++++++++++++++++---------- 1 file changed, 47 insertions(+), 16 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3eaa85f..8ec9bbf 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,53 +1,84 @@ +# 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.)' required: false + test: description: 'Run tests (test)' required: false jobs: build: - runs-on: windows-latest + runs-on: + windows-latest steps: - name: Check out repository uses: actions/checkout@v2 - - name: Install Meson, Ninja, and Clang with Chocolatey + + - name: Install Meson, Ninja, and Clang with Chocolatey and pip shell: pwsh + run: | $ErrorActionPreference = "Stop" - Set-ExecutionPolicy Bypass -Scope Process -Force - iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) - choco install -y python ninja llvm + 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 }} + + env: + CC: clang + CXX: clang++ + BUILD_TYPE: ${{ github.event.inputs.type }} + RUN_TESTS: ${{ github.event.inputs.test }} + run: | - # $ErrorActionPreference = "Stop" + $ErrorActionPreference = "Stop" - # $type = $env:BUILD_TYPE - # $test = $env:RUN_TESTS + $type = $env:BUILD_TYPE + $test = $env:RUN_TESTS - # $args = @() - # if (-not [string]::IsNullOrEmpty($type)) { $args += $type } - # if (-not [string]::IsNullOrEmpty($test)) { $args += $test } + $args = @() + if (-not [string]::IsNullOrEmpty($type)) { $args += $type } + if (-not [string]::IsNullOrEmpty($test)) { $args += $test } & .\scripts\build.ps1 debug test