Skip to content

Commit

Permalink
CMAKE: Determine asymptote version in pull request precheck step.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamievlin committed Aug 25, 2024
1 parent d8f8b02 commit 48a6465
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 4 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/build-asy-linux.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
Expand All @@ -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
Expand Down
15 changes: 12 additions & 3 deletions .github/workflows/build-asy-windows.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -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)
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/pull-req-precheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 48a6465

Please sign in to comment.