From 48a6465e45a4ba1433b1f2779c9b7731cdc1c905 Mon Sep 17 00:00:00 2001 From: Supakorn 'Jamie' Rassameemasmuang Date: Sun, 25 Aug 2024 14:39:16 -0600 Subject: [PATCH] CMAKE: Determine asymptote version in pull request precheck step. --- .github/workflows/build-asy-linux.yml | 12 +++++++++++- .github/workflows/build-asy-windows.yml | 15 ++++++++++++--- .github/workflows/pull-req-precheck.yml | 21 +++++++++++++++++++++ 3 files changed, 44 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-asy-linux.yml b/.github/workflows/build-asy-linux.yml index 5ff4f8841..4ea3ad87a 100644 --- a/.github/workflows/build-asy-linux.yml +++ b/.github/workflows/build-asy-linux.yml @@ -1,7 +1,15 @@ name: build-asy-cxx-linux on: workflow_call: + inputs: + version_override: + type: string + default: "" workflow_dispatch: + inputs: + version_override: + type: string + default: "" jobs: configure-linux-release-x64: @@ -11,7 +19,8 @@ jobs: with: fetch-depth: 1 - uses: ./.github/actions/initialize-linux-env - - run: cmake --preset linux/release-ccache + - run: | + ASY_VERSION_OVERRIDE="${{ inputs.version_override }}" cmake --preset linux/release-ccache - name: tar+gz cmake configuration run: tar -czf cmake-linux-cfg-artifact.tar.gz --exclude='vcpkg_installed' cmake-build-linux/release - name: Upload configuration artifacts @@ -36,6 +45,7 @@ jobs: # Why we are defining version here and not in configuration stage is because cmake gets # re-run here - name: Generate version suffix + if: ${{ inputs.version_override == '' }} run: | echo set\(ASY_VERSION_SUFFIX \"/github-ci/ref=${{ github.sha }}\"\) > asy-pkg-version-suffix.cmake - run: cmake --build --preset linux/release --target asy-with-basefiles -j diff --git a/.github/workflows/build-asy-windows.yml b/.github/workflows/build-asy-windows.yml index abacd55b9..cd576bf3d 100644 --- a/.github/workflows/build-asy-windows.yml +++ b/.github/workflows/build-asy-windows.yml @@ -1,14 +1,22 @@ name: build-asy-cxx-windows on: workflow_call: + inputs: + version_override: + type: string + default: "" workflow_dispatch: - + inputs: + version_override: + type: string + default: "" env: pwsh_initialize_devenv: | $VsInfo = Get-CimInstance MSFT_VSInstance -Namespace root/cimv2/vs & "$($VsInfo.InstallLocation)\\Common7\\Tools\\Launch-VsDevShell.ps1" ` -Arch amd64 -HostArch amd64 -SkipAutomaticLocation $env:VCPKG_ROOT = "$env:VCPKG_INSTALLATION_ROOT" + $env:ASY_VERSION_OVERRIDE = "${{ inputs.version_override }}" cmake_msvc_profile: msvc/release-with-existing-asymptote-pdf jobs: configure-windows-msvc-x64: @@ -71,9 +79,10 @@ jobs: Expand-Archive ` -Path cmake-msvc-x64-release-cfg.zip ` -DestinationPath . - - name: Generate version suffix for github runner + - name: Generate version suffix for github runner, in case version is not specified + if: ${{ inputs.version_override == '' }} run: | - "set(ASY_VERSION_SUFFIX `"/github-ci/ref=${{ github.sha }}`")" | Out-File -Path asy-pkg-version-suffix.cmake + "set(ASY_VERSION_SUFFIX `-ci`")" | Out-File -Path asy-pkg-version-suffix.cmake - name: Remove CMakeCache.txt run: Remove-Item cmake-build-msvc/release/CMakeCache.txt - name: Reconfigure CMake (now that we have TeX Live) diff --git a/.github/workflows/pull-req-precheck.yml b/.github/workflows/pull-req-precheck.yml index 78adc6ac5..24bacd752 100644 --- a/.github/workflows/pull-req-precheck.yml +++ b/.github/workflows/pull-req-precheck.yml @@ -8,10 +8,31 @@ on: - "a/*" jobs: + determine_version_suffix: + runs-on: ubuntu-22.04 + outputs: + asyver: ${{ steps.determine_asyver.outputs.asyver }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 1 + fetch-tags: true + - name: Determine version suffix + shell: bash + id: determine_asyver + run: | + asyver="$(git describe --long | sed -e 's/git-\([0-9]*\)-g.*/-\1/' | sed -e 's/-0-g.*//')ci" || asyver="" + echo "asyver=$asyver" >> "$GITHUB_OUTPUT" build-asy-linux: + needs: determine_version_suffix uses: ./.github/workflows/build-asy-linux.yml + with: + version_override: ${{ needs.determine_version_suffix.outputs.asyver }} build-asy-windows: + needs: determine_version_suffix uses: ./.github/workflows/build-asy-windows.yml + with: + version_override: ${{ needs.determine_version_suffix.outputs.asyver }} test-asy-linux: needs: [build-asy-linux] uses: ./.github/workflows/test-asy-linux.yml