Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: update ci/cd workflows to latest #57

Merged
merged 5 commits into from
Dec 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/wet-items-beam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"vcpkg-fmt-template": patch
---

ci: update ci/cd workflows to latest
67 changes: 34 additions & 33 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ on:
- main
- development
workflow_dispatch:
inputs:
debug:
description: 'Set to true to enable debug mode'
required: false
default: 'false'

jobs:
quality:
Expand Down Expand Up @@ -52,46 +57,42 @@ jobs:
run: mkdir -p $VCPKG_DEFAULT_BINARY_CACHE
shell: bash

# Setup the build machine with the most recent versions of CMake and Ninja. Both are cached if not already: on subsequent runs both will be quickly restored from GitHub cache service.
# Set up the build machine with the most recent versions of CMake and Ninja. Both are cached if not already: on subsequent runs both will be quickly restored from GitHub cache service.
- uses: lukka/get-cmake@latest

# Restore vcpkg from the GitHub Action cache service. Note that packages are restored by vcpkg's binary caching
# when it is being run afterward by CMake.
- name: Restore vcpkg
uses: actions/cache@v3
with:
# The first path is the location of vcpkg: it contains the vcpkg executable and data files, as long as the
# built package archives (aka binary cache) which are located by VCPKG_DEFAULT_BINARY_CACHE env var.
# The other paths starting with '!' are exclusions: they contain temporary files generated during the build of the installed packages.
path: |
${{ env.VCPKG_ROOT }}
!${{ env.VCPKG_ROOT }}/buildtrees
!${{ env.VCPKG_ROOT }}/packages
!${{ env.VCPKG_ROOT }}/downloads
!${{ env.VCPKG_ROOT }}/installed
# The key is composed in a way that it gets properly invalidated whenever a different version of vcpkg is being used.
key: |
${{ hashFiles( '.git/modules/vcpkg/HEAD' )}}
- name: List $RUNNER_WORKSPACE before vcpkg is setup
run: find $RUNNER_WORKSPACE
if: ${{ inputs.debug == 'true' }}
shell: bash

# On Windows runners, let's ensure to have the Developer Command Prompt environment setup correctly.
# As used here the Developer Command Prompt created is targeting x64 and using the default the Windows SDK.
- uses: ilammy/msvc-dev-cmd@v1
- name: Setup vcpkg
uses: lukka/run-vcpkg@v11
id: runvcpkg
with:
vcpkgDirectory: '${{ env.VCPKG_ROOT }}'
vcpkgJsonGlob: '**/vcpkg.json'

# Run CMake to generate Ninja project files, using the vcpkg's toolchain file to resolve and install
# the dependencies as specified in vcpkg.json. Note that the vcpkg's toolchain is specified
# in the CMakePresets.json file.
# This step also runs vcpkg with Binary Caching leveraging GitHub Action cache to
# store the built packages artifacts.
- name: Restore from cache the dependencies and generate project files
- name: List $RUNNER_WORKSPACE before build
run: find $RUNNER_WORKSPACE
if: ${{ inputs.debug == 'true' }}
shell: bash
run: |
cmake --preset vcpkg-fmt-template-ninja-multiconfiguration-vcpkg

# Build (Release configuration only) the whole project with Ninja (which is spawn by CMake).
- name: Build (Release configuration)
- name: Prints output of run-vcpkg's action.
if: ${{ inputs.debug == 'true' }}
run: echo "root='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}', triplet='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_DEFAULT_TRIPLET_OUT }}' "

- name: Run CMake+vcpkg+Ninja
uses: lukka/run-cmake@v10
id: runcmake
with:
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
configurePreset: 'vcpkg-fmt-template-ninja-multiconfiguration-vcpkg'
buildPreset: 'vcpkg-fmt-template-ninja-multiconfiguration-vcpkg'

- name: List $RUNNER_WORKSPACE after build
run: find $RUNNER_WORKSPACE
if: ${{ inputs.debug == 'true' }}
shell: bash
run: |
cmake --build --preset vcpkg-fmt-template-ninja-multiconfiguration-vcpkg --config Release

# Upload vcpkg's logs as artifacts.
- name: Upload vcpkg build log files
Expand Down
68 changes: 34 additions & 34 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ on:
description: 'Custom commit message'
required: false
default: 'Version Packages'
debug:
description: 'Set to true to enable debug mode'
required: false
default: 'false'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -72,46 +76,42 @@ jobs:
run: mkdir -p $VCPKG_DEFAULT_BINARY_CACHE
shell: bash

# Setup the build machine with the most recent versions of CMake and Ninja. Both are cached if not already: on subsequent runs both will be quickly restored from GitHub cache service.
# Set up the build machine with the most recent versions of CMake and Ninja. Both are cached if not already: on subsequent runs both will be quickly restored from GitHub cache service.
- uses: lukka/get-cmake@latest

# Restore vcpkg from the GitHub Action cache service. Note that packages are restored by vcpkg's binary caching
# when it is being run afterward by CMake.
- name: Restore vcpkg
uses: actions/cache@v3
- name: List $RUNNER_WORKSPACE before vcpkg is setup
run: find $RUNNER_WORKSPACE
if: ${{ inputs.debug == 'true' }}
shell: bash

- name: Setup vcpkg
uses: lukka/run-vcpkg@v11
id: runvcpkg
with:
# The first path is the location of vcpkg: it contains the vcpkg executable and data files, as long as the
# built package archives (aka binary cache) which are located by VCPKG_DEFAULT_BINARY_CACHE env var.
# The other paths starting with '!' are exclusions: they contain temporary files generated during the build of the installed packages.
path: |
${{ env.VCPKG_ROOT }}
!${{ env.VCPKG_ROOT }}/buildtrees
!${{ env.VCPKG_ROOT }}/packages
!${{ env.VCPKG_ROOT }}/downloads
!${{ env.VCPKG_ROOT }}/installed
# The key is composed in a way that it gets properly invalidated whenever a different version of vcpkg is being used.
key: |
${{ hashFiles( '.git/modules/vcpkg/HEAD' )}}

# On Windows runners, let's ensure to have the Developer Command Prompt environment setup correctly.
# As used here the Developer Command Prompt created is targeting x64 and using the default the Windows SDK.
- uses: ilammy/msvc-dev-cmd@v1

# Run CMake to generate Ninja project files, using the vcpkg's toolchain file to resolve and install
# the dependencies as specified in vcpkg.json. Note that the vcpkg's toolchain is specified
# in the CMakePresets.json file.
# This step also runs vcpkg with Binary Caching leveraging GitHub Action cache to
# store the built packages artifacts.
- name: Restore from cache the dependencies and generate project files
vcpkgDirectory: '${{ env.VCPKG_ROOT }}'
vcpkgJsonGlob: '**/vcpkg.json'

- name: List $RUNNER_WORKSPACE before build
run: find $RUNNER_WORKSPACE
if: ${{ inputs.debug == 'true' }}
shell: bash
run: |
cmake --preset vcpkg-fmt-template-ninja-multiconfiguration-vcpkg

# Build (Release configuration only) the whole project with Ninja (which is spawn by CMake).
- name: Build (Release configuration)
- name: Prints output of run-vcpkg's action.
if: ${{ inputs.debug == 'true' }}
run: echo "root='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}', triplet='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_DEFAULT_TRIPLET_OUT }}' "

- name: Run CMake+vcpkg+Ninja
uses: lukka/run-cmake@v10
id: runcmake
with:
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
configurePreset: 'vcpkg-fmt-template-ninja-multiconfiguration-vcpkg'
buildPreset: 'vcpkg-fmt-template-ninja-multiconfiguration-vcpkg'

- name: List $RUNNER_WORKSPACE after build
run: find $RUNNER_WORKSPACE
if: ${{ inputs.debug == 'true' }}
shell: bash
run: |
cmake --build --preset vcpkg-fmt-template-ninja-multiconfiguration-vcpkg

# Upload vcpkg's logs as artifacts.
- name: Upload vcpkg build log files
Expand Down