Migrate to the ubuntu-24.04 GitHub Actions runner #26
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: CI | |
on: | |
push: | |
# Don't run this workflow when a tag is pushed. | |
branches: | |
- '*' | |
pull_request: | |
env: | |
MSVC_CONFIG: RelWithDebInfo | |
jobs: | |
linux: | |
runs-on: ubuntu-24.04 | |
env: | |
LIBLOOT_VERSION: 0.24.5 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set libloot install path | |
run: echo "LIBLOOT_INSTALL_PATH=${{ github.workspace }}/libloot-${{ env.LIBLOOT_VERSION }}-install" >> $GITHUB_ENV | |
- name: libloot cache | |
id: libloot-cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.LIBLOOT_INSTALL_PATH }} | |
key: ${{ runner.os }}-libloot-${{ env.LIBLOOT_VERSION }} | |
- name: Get descriptive version | |
id: get-version | |
shell: bash | |
run: | | |
GIT_DESCRIBE=$(git describe --tags --long --abbrev=7) | |
DESC_REF=${GIT_DESCRIBE}_${GITHUB_REF#refs/*/} | |
SAFE_DESC_REF=${DESC_REF//[\/<>\"|]/_} | |
echo "version=$SAFE_DESC_REF" >> $GITHUB_OUTPUT | |
- name: Install APT package libloot build dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y --no-upgrade \ | |
cbindgen \ | |
libboost-dev \ | |
libicu-dev \ | |
libtbb-dev | |
if: steps.libloot-cache.outputs.cache-hit != 'true' | |
- name: Install APT package libloot runtime dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y --no-upgrade \ | |
libicu74 \ | |
libtbb12 | |
if: steps.libloot-cache.outputs.cache-hit == 'true' | |
- name: Download and build libloot | |
run: | | |
wget https://github.com/loot/libloot/archive/$LIBLOOT_VERSION.tar.gz | |
tar -xf $LIBLOOT_VERSION.tar.gz | |
mkdir libloot-$LIBLOOT_VERSION/build | |
cd libloot-$LIBLOOT_VERSION/build | |
cmake .. -DBOOST_ROOT=${{ steps.boost-metadata.outputs.root }} -DLIBLOOT_BUILD_TESTS=OFF -DLIBLOOT_INSTALL_DOCS=OFF -DCMAKE_INSTALL_PREFIX="$LIBLOOT_INSTALL_PATH" | |
cmake --build . --target loot --config Release | |
cmake --install . --config Release | |
if: steps.libloot-cache.outputs.cache-hit != 'true' | |
- name: Run CMake | |
run: | | |
mkdir build | |
cd build | |
cmake .. -DCMAKE_PREFIX_PATH="${{ env.LIBLOOT_INSTALL_PATH }}" -DCPACK_PACKAGE_VERSION="${{ steps.get-version.outputs.version }}" | |
make all | |
- name: Build archive | |
id: build-archive | |
shell: bash | |
run: | | |
cd build | |
cpack | |
VERSION="${{ steps.get-version.outputs.version }}" | |
echo "filename=metadata-validator-${VERSION}-Linux.tar.xz" >> $GITHUB_OUTPUT | |
- name: Upload archive | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ steps.build-archive.outputs.filename }} | |
path: build/package/${{ steps.build-archive.outputs.filename }} | |
if: github.event_name == 'push' | |
windows: | |
runs-on: windows-2019 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get descriptive version | |
id: get-version | |
shell: bash | |
run: | | |
GIT_DESCRIBE=$(git describe --tags --long --abbrev=7) | |
DESC_REF=${GIT_DESCRIBE}_${GITHUB_REF#refs/*/} | |
SAFE_DESC_REF=${DESC_REF//[\/<>\"|]/_} | |
echo "version=$SAFE_DESC_REF" >> $GITHUB_OUTPUT | |
- name: Run CMake | |
run: | | |
mkdir build | |
cd build | |
cmake .. -G "Visual Studio 16 2019" -A x64 -DCPACK_PACKAGE_VERSION="${{ steps.get-version.outputs.version }}" | |
cmake --build . --config ${{ env.MSVC_CONFIG }} | |
- name: Build archive | |
id: build-archive | |
shell: bash | |
run: | | |
cd build | |
cpack -C ${{ env.MSVC_CONFIG }} | |
VERSION="${{ steps.get-version.outputs.version }}" | |
echo "filename=metadata-validator-${VERSION}-win64.7z" >> $GITHUB_OUTPUT | |
- name: Upload archive | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ steps.build-archive.outputs.filename }} | |
path: build/package/${{ steps.build-archive.outputs.filename }} | |
if: github.event_name == 'push' |