Merge branch 'develop' of https://github.com/Do-sth-sharp/VocalShaper… #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Artifacts | |
on: | |
push: | |
branches: [ "develop", "main" ] | |
pull_request: | |
branches: [ "develop", "main" ] | |
workflow_call: | |
jobs: | |
prepare-package: | |
runs-on: ${{matrix.os}} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest] | |
compiler: [MSVC, MinGW] | |
include: | |
- os: windows-latest | |
compiler: MSVC | |
vcpkg_triplet: x64-windows | |
- os: windows-latest | |
compiler: MinGW | |
vcpkg_triplet: x64-mingw-dynamic | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup Ninja | |
uses: seanmiddleditch/gha-setup-ninja@master | |
with: | |
version: 1.11.1 | |
- name: Install MinGW | |
if: matrix.compiler == 'MinGW' | |
uses: egor-tensin/setup-mingw@v2 | |
with: | |
platform: x64 | |
static: 0 | |
- name: Install vcpkg Windows | |
if: runner.os == 'Windows' | |
working-directory: ${{github.workspace}}/vcpkg | |
shell: cmd | |
run: .\bootstrap-vcpkg.bat | |
- name: Initialize MSVC Environment | |
if: matrix.compiler == 'MSVC' | |
uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
arch: ${{runner.arch}} | |
- name: Export GitHub Actions Cache Environment Variables | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); | |
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); | |
- name: Install Packages | |
working-directory: ${{github.workspace}}/vcpkg | |
shell: pwsh | |
env: | |
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" | |
run: vcpkg install --x-manifest-root=../scripts/vcpkg-manifest --x-install-root=./installed --triplet=${{matrix.vcpkg_triplet}} | |
- name: Get Short SHA | |
uses: benjlevesque/[email protected] | |
id: short-sha | |
with: | |
length: 7 | |
- name: Archive vcpkg Logs | |
if: ${{!cancelled()}} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: vcpkglogs-${{runner.os}}-${{runner.arch}}-${{matrix.compiler}}-${{steps.short-sha.outputs.sha}} | |
path: | | |
vcpkg/buildtrees/*/*.log | |
retention-days: 7 | |
compression-level: 9 | |
build: | |
runs-on: ${{matrix.os}} | |
needs: [prepare-package] | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest] | |
build_type: [Debug, Release] | |
compiler: [MSVC, MinGW] | |
include: | |
- compiler: MSVC | |
c_compiler: cl | |
cxx_compiler: cl | |
asm_compiler: cl | |
- compiler: MinGW | |
c_compiler: gcc | |
cxx_compiler: c++ | |
asm_compiler: '' | |
- os: windows-latest | |
compiler: MSVC | |
vcpkg_triplet: x64-windows | |
- os: windows-latest | |
compiler: MinGW | |
vcpkg_triplet: x64-mingw-dynamic | |
- os: windows-latest | |
build_type: Debug | |
compiler: MSVC | |
cmake_config: 'Ninja Debug x64' | |
build_path: 'ninja-debug-x64' | |
- os: windows-latest | |
build_type: Release | |
compiler: MSVC | |
cmake_config: 'Ninja Release x64' | |
build_path: 'ninja-release-x64' | |
- os: windows-latest | |
build_type: Debug | |
compiler: MinGW | |
cmake_config: 'Ninja Debug MinGW64' | |
build_path: 'ninja-debug-mingw64' | |
- os: windows-latest | |
build_type: Release | |
compiler: MinGW | |
cmake_config: 'Ninja Release MinGW64' | |
build_path: 'ninja-release-mingw64' | |
permissions: | |
id-token: write | |
contents: read | |
attestations: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup Ninja | |
uses: seanmiddleditch/gha-setup-ninja@master | |
with: | |
version: 1.11.1 | |
- name: Install MinGW | |
if: matrix.compiler == 'MinGW' | |
uses: egor-tensin/setup-mingw@v2 | |
with: | |
platform: x64 | |
static: 0 | |
- name: Install vcpkg Windows | |
if: runner.os == 'Windows' | |
working-directory: ${{github.workspace}}/vcpkg | |
shell: cmd | |
run: .\bootstrap-vcpkg.bat | |
- name: Initialize MSVC Environment | |
if: matrix.compiler == 'MSVC' | |
uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
arch: ${{runner.arch}} | |
- name: Export GitHub Actions Cache Environment Variables | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); | |
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); | |
- name: Install Packages | |
working-directory: ${{github.workspace}}/vcpkg | |
shell: pwsh | |
env: | |
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" | |
run: vcpkg install --x-manifest-root=../scripts/vcpkg-manifest --x-install-root=./installed --triplet=${{matrix.vcpkg_triplet}} | |
- name: Configure CMake | |
working-directory: ${{github.workspace}} | |
shell: pwsh | |
env: | |
CC: ${{matrix.c_compiler}} | |
CXX: ${{matrix.cxx_compiler}} | |
ASM: ${{matrix.asm_compiler}} | |
run: cmake --preset "${{matrix.cmake_config}}" | |
- name: Build | |
working-directory: ${{github.workspace}} | |
shell: pwsh | |
run: cmake --build "build/${{matrix.build_path}}" --target VocalShaper | |
- name: Pre Packing | |
working-directory: ${{github.workspace}} | |
shell: pwsh | |
run: ./scripts/ci/prePacking.ps1 -DirectoryPath "./build/${{matrix.build_path}}/bin" | |
- name: Find Binary Files | |
id: find-binary | |
working-directory: ${{github.workspace}} | |
shell: pwsh | |
run: | | |
$result = (./scripts/ci/findBinary.ps1 -DirectoryPath "./build/${{matrix.build_path}}/bin") | Out-String | |
$outputString = "exec_files=$result" | |
$outputString | Out-File -FilePath $env:GITHUB_OUTPUT -Append | |
Write-Host "Found executable and dynamic library files: $result" | |
- name: Generate Artifact Attestation | |
if: github.event_name != 'pull_request' | |
uses: actions/attest-build-provenance@v1 | |
with: | |
subject-path: '${{steps.find-binary.outputs.exec_files}}' | |
- name: Get Short SHA | |
uses: benjlevesque/[email protected] | |
id: short-sha | |
with: | |
length: 7 | |
- name: Archive Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: VocalShaper-${{runner.os}}-${{runner.arch}}-${{matrix.compiler}}-${{matrix.build_type}}-${{steps.short-sha.outputs.sha}} | |
path: | | |
build/${{matrix.build_path}}/bin/** | |
compression-level: 9 |