Update Github Actions #244
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
############################################################################## | |
# Copyright 2022-2023 Leon Lynch | |
# | |
# This file is licensed under the terms of the LGPL v2.1 license. | |
# See LICENSE file. | |
############################################################################## | |
name: Fedora build | |
on: [push] | |
env: | |
TR31_VERSION: 0.6.0 | |
jobs: | |
build-fedora-debug: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- { name: "Fedora 37", fedora_version: 37, deps: "none", build_dukpt_ui: NO } | |
- { name: "Fedora 37", fedora_version: 37, deps: "tr31/qt", build_dukpt_ui: YES } | |
- { name: "Fedora 38", fedora_version: 38, deps: "tr31/qt", build_dukpt_ui: YES } | |
- { name: "Fedora 39", fedora_version: 39, deps: "tr31/qt", build_dukpt_ui: YES } | |
name: ${{ matrix.name }} build (static/debug/${{ matrix.deps }}) | |
runs-on: ubuntu-latest | |
container: fedora:${{ matrix.fedora_version }} | |
steps: | |
- name: Install build tools and MbedTLS | |
run: sudo dnf -y install git gh cmake gcc mbedtls-devel | |
- name: Install Qt5 | |
if: contains(matrix.deps, 'qt') | |
run: sudo dnf -y install qt5-qtbase-devel | |
- name: Install TR-31 release | |
if: contains(matrix.deps, 'tr31') | |
run: | | |
gh release download --repo openemv/tr31 ${{ env.TR31_VERSION }} | |
sudo dnf -y install tr31-${{ env.TR31_VERSION }}-1.fc${{ matrix.fedora_version }}.x86_64.rpm | |
echo "CMAKE_REQUIRE_FIND_PACKAGE_tr31=YES" >> $GITHUB_ENV | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
# Container user doesn't match runner user | |
# Github has only fixed https://github.com/actions/checkout/issues/760 | |
# not https://github.com/actions/checkout/issues/766 | |
- name: Configure Git | |
run: | | |
git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
git describe --always --dirty | |
- name: Configure CMake | |
run: cmake -B build -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_REQUIRE_FIND_PACKAGE_tr31=${{ env.CMAKE_REQUIRE_FIND_PACKAGE_tr31 }} -DBUILD_DUKPT_UI=${{ matrix.build_dukpt_ui }} | |
- name: Build | |
run: cmake --build build | |
- name: Test | |
run: ctest --test-dir build --output-on-failure | |
build-fedora-release: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- { name: "Fedora 37", fedora_version: 37 } | |
- { name: "Fedora 38", fedora_version: 38 } | |
- { name: "Fedora 39", fedora_version: 39 } | |
name: ${{ matrix.name }} release | |
runs-on: ubuntu-latest | |
container: fedora:${{ matrix.fedora_version }} | |
steps: | |
- name: Install dependencies | |
run: | | |
sudo dnf -y install git gh cmake gcc mbedtls-devel bash-completion doxygen rpm-build qt5-qtbase-devel | |
- name: Install TR-31 release | |
run: | | |
gh release download --repo openemv/tr31 ${{ env.TR31_VERSION }} | |
sudo dnf -y install tr31-${{ env.TR31_VERSION }}-1.fc${{ matrix.fedora_version }}.x86_64.rpm | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
# Container user doesn't match runner user | |
# Github has only fixed https://github.com/actions/checkout/issues/760 | |
# not https://github.com/actions/checkout/issues/766 | |
- name: Configure Git | |
run: | | |
git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
git describe --always --dirty | |
- name: Get version from git tag | |
run: echo "GIT_DESCRIBE=$(git describe --always --dirty)" >> $GITHUB_ENV | |
- name: Configure CMake | |
run: cmake -B build -DCMAKE_BUILD_TYPE="RelWithDebInfo" -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_SHARED_LIBS=YES -DBUILD_DOCS=YES -DBUILD_DUKPT_UI=YES -DCPACK_COMPONENTS_GROUPING=ALL_COMPONENTS_IN_ONE | |
- name: Build | |
run: cmake --build build | |
- name: Test | |
run: ctest --test-dir build --output-on-failure | |
- name: Package | |
run: cmake --build build --target package | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dukpt-${{ env.GIT_DESCRIBE }}-fedora${{ matrix.fedora_version }} | |
path: build/dukpt-*.rpm | |
if-no-files-found: error |