Resolve issues on workflows #285
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: Test, Build and create release" | |
# yamllint disable | |
on: | |
# yamllint enable | |
push: | |
branches: | |
- main | |
- develop | |
- workflow-issues | |
tags: | |
- "[0-9]+.[0-9]+.[0-9]+" | |
paths: | |
- "**.cpp" | |
- "**.h" | |
- "**.hpp" | |
- "**.py" | |
- cmake/** | |
- src/** | |
- CMakeLists.txt | |
- conanfile.py | |
- .github/workflows/ci.yml | |
- packaging/flatpak/org.jmuelbert.jmbde-QT.yaml | |
- snap/snapcraft.yaml | |
pull_request: | |
# The branches below must be a subset of the branches above | |
types: [opened, synchronize, reopened] | |
paths: | |
- "**.cpp" | |
- "**.h" | |
- "**.hpp" | |
- "**.py" | |
- cmake/** | |
- src/** | |
- CMakeLists.txt | |
- conanfile.py | |
- .github/workflows/ci.yml | |
- packaging/flatpak/org.jmuelbert.jmbde-QT.yaml | |
- snap/snapcraft.yaml | |
workflow_dispatch: | |
env: | |
# Target | |
TARGET_NAME: jmbde | |
PROJECT_NAME: jmbde-QT | |
# Conan cache environment variables | |
CONAN_SYSREQUIRES_MODE: enabled | |
CONAN_USER_HOME: "${{ github.workspace }}/conan-cache" | |
CONAN_USER_HOME_SHORT: "${{ github.workspace }}/conan-cache/short" | |
CLANG_TIDY_VERSION: 13.0.0 | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
BUILD_TYPE: Release | |
QT_VERSION: 6.7.2 | |
QT_TARGET: desktop | |
permissions: | |
contents: read | |
concurrency: | |
group: ${{ github.ref }}-${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
# format | |
clang-format: | |
# Skip any PR created by dependabot to avoid permission issues: | |
if: (github.actor != 'dependabot[bot]') | |
name: 💎 CLang-Format | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
# Checkout the repository to the GitHub Actions runner | |
- name: 🧰 Checkout Source Code | |
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | |
with: | |
# Full git history is needed to get a proper list of changed files within `super-linter` | |
fetch-depth: 0 | |
- name: 🟨 Use clang-format | |
uses: DoozyX/clang-format-lint-action@c71d0bf4e21876ebec3e5647491186f8797fde31 # v0.18.2 | |
with: | |
source: . | |
exclude: ./third_party ./external | |
extensions: c,h,cpp,hpp | |
clangFormatVersion: 14 | |
inplace: true | |
- name: Add and commit | |
uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.4.1 | |
with: | |
author_name: Clang Robot | |
author_email: robot@example.com | |
message: ":art: Committing clang-format changes" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
cmake-format: | |
# Skip any PR created by dependabot to avoid permission issues: | |
if: (github.actor != 'dependabot[bot]') | |
name: 💎 CMake-Format | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
# Checkout the repository to the GitHub Actions runner | |
- name: 🧰 Checkout Source Code | |
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | |
with: | |
# Full git history is needed to get a proper | |
# list of changed files within `super-linter` | |
fetch-depth: 0 | |
- name: 🟨 Setup Python | |
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 | |
with: | |
# Read python version from a file .python-version | |
python-version-file: .python-version | |
# check-latest: true | |
cache: pip | |
- name: 🟨 Install cmakelang | |
run: | | |
python -m pip install --upgrade pip | |
pip3 install -r .github/workflows/cmake-requirements.txt | |
- name: 🟨 Use cmake-format | |
run: find . \( -name '*.cmake' -o -name 'CMakeLists.txt' \) -exec cmake-format -i {} \; | |
- name: 📨 Use Commit | |
uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.4.1 | |
with: | |
author_name: github_actions | |
message: ":art: Committing format changes" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# lint: | |
# tests: | |
tests: | |
# Skip any PR created by dependabot to avoid permission issues: | |
if: (github.actor != 'dependabot[bot]') | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
# Recommendations: | |
# * support at least 2 operating systems | |
# * support at least 2 compilers | |
# * make sure all supported configurations for your project are built | |
# | |
# Disable/enable builds in this list to meet the above recommendations | |
# and your own projects needs | |
matrix: | |
os: [ubuntu-latest, ubuntu-22.04] | |
generator: | |
- Ninja | |
compiler: | |
- g++-10 | |
ccompiler: | |
- gcc-10 | |
build_type: | |
- Debug | |
qt_version: [6.7.2] | |
permissions: | |
actions: read | |
contents: read | |
security-events: write | |
steps: | |
- name: 🧰 Checkout Source Code | |
# Checkout the repository to the GitHub Actions runner | |
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | |
with: | |
# Full git history is needed to get a proper list of changed files within `super-linter` | |
fetch-depth: 0 | |
- name: ⚙️ Install Python | |
id: python | |
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 | |
with: | |
# Read python version from a file .python-version | |
python-version-file: .python-version | |
# check-latest: true | |
cache: pip | |
- name: ⚙️ Install Python dependencies | |
shell: bash | |
id: python-deps | |
run: | | |
python -m pip install --upgrade pip | |
pip3 install -r .github/workflows/conan-requirements.txt | |
- name: 🐧 ⚙️ Install Linux dependencies | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update && DEBIAN_FRONTEND=--noninteractive \ | |
sudo apt-get --no-install-recommends --assume-yes install \ | |
libclang-dev \ | |
ninja-build \ | |
gcovr \ | |
ccache \ | |
cppcheck \ | |
googletest | |
echo "CCACHE_DIR=${{github.workspace}}/ccache" >> $GITHUB_ENV | |
echo "CXX=${{matrix.compiler}}" >> $GITHUB_ENV | |
echo "CC=${{matrix.ccompiler}}" >> $GITHUB_ENV | |
- name: Configure Conan | |
shell: bash | |
run: | | |
echo "Setup conan" | |
conan profile detect --force | |
conan profile show | |
- name: ⚙️ Install Qt Version ${{ matrix.qt_version }} | |
uses: jurplel/install-qt-action@f03f05556819ceb3781ee2f455ec44c339d683c0 # v4.0.0 | |
with: | |
version: "${{ matrix.qt_version }}" | |
arch: "${{ env.QT_ARCH }}" | |
target: "${{ env.QT_TARGET }}" | |
tools: "${{ env.QT_TOOLS }}" | |
setup-python: "true" | |
cache: "true" | |
cache-key-prefix: "${{ runner.os }}-install-qt-action" | |
set-env: "true" | |
install-deps: "true" | |
- uses: hendrikmuhs/ccache-action@ed74d11c0b343532753ecead8a951bb09bb34bc9 # v1.2.14 | |
if: runner.os == 'Linux' | |
with: | |
key: ${{ matrix.os }}-${{ matrix.build_type }} | |
max-size: 50M | |
- name: restore ccache | |
uses: pat-s/always-upload-cache@9a0d1c3e1a8260b05500f9b67a5be8f2a1299819 # v3.0.11 | |
with: | |
path: ${{github.workspace}}/ccache | |
key: ccache-${{matrix.os}}-${{matrix.qt_version}}-${{ github.sha }} | |
restore-keys: ccache-${{matrix.os}}-${{matrix.qt_version}} | |
- name: check ccache stats prior to build | |
run: ccache --zero-stats --show-stats | |
- name: Add GCC problem matcher | |
uses: ammaraskar/gcc-problem-matcher@0f9c86f9e693db67dacf53986e1674de5f2e5f28 # v0.3.0 | |
- name: Create Build Environment | |
# Some projects don't allow in-source building, so create a separate build directory | |
# We'll use this as our working directory for all subsequent commands | |
run: cmake -E make_directory build | |
# make sure coverage is only enabled for Debug builds, since it sets -O0 to make sure coverage | |
- name: Configure CMake | |
# has meaningful results | |
working-directory: build | |
shell: bash | |
run: | | |
mkdir -pv usr | |
echo "CMAKE_PREFIX_PATH=$QT_ROOT_DIR/lib/cmake" >> $GITHUB_ENV | |
printenv | |
conan install .. --build=missing --settings=build_type=${{matrix.build_type}} | |
cmake -S .. -B . -G "${{matrix.generator}}" \ | |
-DCMAKE_MAKE_PROGRAM="/usr/bin/ninja" \ | |
-DCMAKE_TOOLCHAIN_FILE="generators/conan_toolchain.cmake" \ | |
-DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} \ | |
-DCMAKE_INSTALL_PREFIX:PATH="./usr" \ | |
-DOPT_ENABLE_COVERAGE:BOOL=${{ matrix.build_type == 'Debug' }} \ | |
-DBUILD_TESTING:BOOL=${{ matrix.build_type == 'Debug' }} \ | |
-DENABLE_CACHE="ON" | |
- name: 🚧 Build | |
# Execute the build. You can specify a specific target with "--target <NAME>" | |
run: | | |
cmake --build ./build --config ${{matrix.build_type}} | |
- name: check ccache stats prior to build | |
run: ccache --zero-stats --show-stats | |
- name: 🐧 🧪 Test and coverage | |
working-directory: build | |
# Execute tests defined by the CMake configuration. | |
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail | |
run: | | |
ctest -C ${{matrix.build_type}} | |
gcovr -j ${{env.nproc}} --delete --root ../ --print-summary --xml-pretty --xml coverage.xml | |
- name: Publish to codecov | |
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0 | |
with: | |
flags: ${{ runner.os }} | |
name: ${{ runner.os }}-coverage | |
files: ./build/coverage.xml | |
build: | |
# if: startsWith(github.event.ref, 'refs/tags/') | |
name: "Build for ${{ matrix.name }}" | |
runs-on: ${{ matrix.os }} | |
needs: tests | |
strategy: | |
fail-fast: false | |
matrix: | |
name: [ubuntu-latest-clang++, macos-latest-clang++, windows-latest-cl.exe] | |
include: | |
- name: ubuntu-latest-clang++ | |
os: ubuntu-latest | |
build_type: Release | |
qt_arch: gcc_64 | |
compiler: clang++-14 | |
ccompiler: clang-14 | |
clang-tidy: "" | |
generator: Ninja | |
- name: windows-latest-cl.exe | |
os: windows-latest | |
build_type: Release | |
qt_arch: win64_msvc2019_64 | |
arch: x64 | |
pak_arch: win64 | |
compiler: cl.exe | |
ccompiler: cl.exe | |
clang-tidy: "" | |
generator: Ninja | |
- name: macos-latest-clang++ | |
os: macos-latest | |
build_type: Release | |
qt_arch: clang_64 | |
arch: clang_64 | |
compiler: clang++ | |
ccompiler: clang | |
generator: Ninja | |
env: | |
CXX: ${{ matrix.compiler }} | |
CC: ${{ matrix.ccompiler }} | |
permissions: | |
actions: read | |
contents: read | |
security-events: write | |
steps: | |
- name: ⚙️ Get the version | |
id: get_version | |
shell: bash | |
run: echo "VERSION=$(echo $GITHUB_REF | cut -d / -f 3)" >> "$GITHUB_OUTPUT" | |
- name: 🧰 Checkout Source Code | |
# Checkout the repository to the GitHub Actions runner | |
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | |
with: | |
# Full git history is needed to get a proper list of changed files within `super-linter` | |
fetch-depth: 0 | |
- name: ⚙️ Install Python | |
id: python | |
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 | |
with: | |
# Read python version from a file .python-version | |
python-version-file: .python-version | |
# check-latest: true | |
cache: pip | |
- name: ⚙️ Install Python dependencies | |
shell: bash | |
id: python-deps | |
run: | | |
python -m pip install --upgrade pip | |
pip3 install -r ./conan-requirements.txt | |
- name: 🐧 ⚙️ Install Linux dependencies | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update && DEBIAN_FRONTEND=--noninteractive \ | |
sudo apt-get --no-install-recommends --assume-yes install \ | |
libclang-dev \ | |
ninja-build \ | |
ccache | |
echo "CCACHE_DIR=${{github.workspace}}/ccache" >> "$GITHUB_ENV" | |
echo "CXX=${{matrix.compiler}}" >> "$GITHUB_ENV" | |
echo "CC=${{matrix.ccompiler}}" >> "$GITHUB_ENV" | |
- name: ⚙️ 🍎 Install macos dependencies | |
if: runner.os == 'macOS' | |
env: | |
HOMEBREW_NO_ANALYTICS: "ON" | |
HOMEBREW_NO_AUTO_UPDATE: "ON" | |
HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: "ON" | |
HOMEBREW_NO_INSTALL_CLEANUP: "ON" | |
run: | | |
brew install ninja ccache pkg-config | |
echo "/usr/local/opt/ccache/libexec" >> "$GITHUB_PATH" | |
echo "CCACHE_DIR=${{github.workspace}}/ccache" >> "$GITHUB_ENV" | |
# Use latest available XCode | |
sudo xcode-select -s "/Applications/Xcode_13.2.1.app" | |
echo "DEVELOPER_DIR=/Applications/Xcode_13.2.1.app/Contents/Developer" >> "$GITHUB_ENV" | |
- name: 🧊 ⚙️ Install Windows dependencies | |
if: runner.os == 'Windows' | |
run: | | |
cinst ninja ccache | |
- name: 🧊 ⚙️ Configure MSVC | |
if: runner.os == 'Windows' | |
uses: ilammy/msvc-dev-cmd@ 0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 | |
with: | |
# 14.1 is for vs2017, 14.2 is vs2019, following the upstream vcpkg build from Qv2ray-deps repo | |
toolset: 14.2 | |
arch: ${{ matrix.pak_arch }} | |
- name: Configure Conan | |
shell: bash | |
run: | | |
echo "Setup conan" | |
conan profile detect --force | |
conan profile show | |
- name: (Linux/macOS) restore ccache | |
if: runner.os == 'Linux' || runner.os == 'macOS' | |
uses: pat-s/always-upload-cache@v3.0.11 | |
with: | |
path: ${{github.workspace}}/ccache | |
key: ccache-${{matrix.os}}-${{matrix.compiler}}-${{env.QT_VERSION}}-${{ github.sha }} | |
restore-keys: ccache-${{matrix.os}}-${{matrix.compiler}}-${{env.QT_VERSION}} | |
- name: (Linux/macOS) check ccache stats prior to build | |
if: runner.os == 'Linux' || runner.os == 'macOS' | |
run: ccache --zero-stats --show-stats | |
- name: Add GCC problem matcher | |
if: runner.os == 'Linux' | |
uses: ammaraskar/gcc-problem-matcher@0f9c86f9e693db67dacf53986e1674de5f2e5f28 # v0.3.0 | |
- name: "⚙️ Install Qt Version ${{ env.QT_VERSION }}" | |
uses: jurplel/install-qt-action@f03f05556819ceb3781ee2f455ec44c339d683c0 # v4.0.0 | |
with: | |
version: ${{ env.QT_VERSION }} | |
target: ${{ env.QT_TARGET }} | |
arch: ${{ matrix.qt_arch }} | |
dir: "${{ github.workspace }}/build/" | |
install-deps: "true" | |
# modules: 'qtcharts qtwebengine' | |
setup-python: "true" | |
# tools: "tools_ifw" | |
set-env: "true" | |
- name: Create Build Environment | |
# Some projects don't allow in-source building, so create a separate build directory | |
# We'll use this as our working directory for all subsequent commands | |
run: cmake -E make_directory build | |
- name: ⚙️ 🧊 Configure CMake | |
# make sure coverage is only enabled for Debug builds, since it sets -O0 to make sure coverage | |
# has meaningful results | |
if: runner.os == 'Windows' | |
working-directory: build | |
shell: pwsh | |
run: | | |
echo "CMAKE_PREFIX_PATH=$env.QT_ROOT_DIR" >> $GITHUB_ENV ' | |
conan install .. --build=missing --settings=build_type=${{matrix.build_type}} ' | |
cmake ` | |
-S .. -B . ` | |
-G "${{matrix.generator}}" ` | |
-DCMAKE_TOOLCHAIN_FILE="generators/conan_toolchain.cmake" ` | |
-DCMAKE_BUILD_TYPE:STRING=${{ matrix.build_type }} ` | |
-DCMAKE_INSTALL_PREFIX:PATH="${{github.workspace}}/install" ` | |
-DBUILD_SHARED_LIBS:BOOL="TRUE" | |
# -G "Visual Studio 16 2019" -A "x64" ` | |
- name: ⚙️ 🐧 Configure CMake | |
# make sure coverage is only enabled for Debug builds, since it sets -O0 to make sure coverage | |
# has meaningful results. | |
if: runner.os == 'Linux' | |
working-directory: build | |
shell: bash | |
run: | | |
echo "CMAKE_PREFIX_PATH=$env.QT_ROOT_DIR" >> $GITHUB_ENV \ | |
conan install .. --build=missing --settings=build_type=${{matrix.build_type}} \ | |
cmake -S .. -B . -G "${{matrix.generator}}" \ | |
-DCMAKE_TOOLCHAIN_FILE="generators/conan_toolchain.cmake" \ | |
-DCMAKE_BUILD_TYPE:STRING="${{matrix.build_type}}" \ | |
-DCMAKE_INSTALL_PREFIX:PATH="${{github.workspace}}/AppDir/usr" \ | |
-DBUILD_SHARED_LIBS:BOOL="TRUE" \ | |
-DENABLE_CACHE="ON" | |
- name: ⚙️ 🍎 Configure CMake | |
working-directory: build | |
shell: bash | |
if: runner.os == 'macOS' | |
run: | | |
echo "CMAKE_PREFIX_PATH=$env.QT_ROOT_DIR" >> $GITHUB_ENV \ | |
conan install .. --build=missing --settings=build_type=${{matrix.build_type}} \ | |
cmake -S .. -B . -G "${{matrix.generator}}" \ | |
-DCMAKE_TOOLCHAIN_FILE="generators/conan_toolchain.cmake" \ | |
-DCMAKE_BUILD_TYPE:STRING="${{matrix.build_type}}" \ | |
-DCMAKE_INSTALL_PREFIX:PATH="${{github.workspace}}/install" \ | |
-DBUILD_SHARED_LIBS:BOOL="TRUE" \ | |
-DENABLE_CACHE="ON" | |
- name: 📦 🍎 Build and package application (macdeployqt and zipfile) | |
# TODO: Stored in install. Build DMG with CPack | |
working-directory: build | |
if: runner.os == 'macOS' | |
run: | | |
cmake --build . --config ${{matrix.build_type}} | |
cpack -C "${{matrix.build_type}}" -G "DragNDrop;ZIP" | |
- name: ⚙️ 🧊 Build | |
# TODO: Stored in install. Build installer with CPack | |
if: runner.os == 'Windows' | |
working-directory: build | |
run: | | |
cmake --build . --config ${{matrix.build_type}} | |
cpack -C "${{matrix.build_type}}" -G "WIX;ZIP" | |
- name: ⚙️ 🐧 Build | |
if: runner.os == 'Linux' | |
working-directory: build | |
# Execute the build. You can specify a specific target with "--target <NAME>" | |
run: | | |
sudo apt-get -y --no-install-recommends install tree | |
cmake --build . --config ${{matrix.build_type}} --target install | |
- name: ⚙️ 🐧 Install go-appimage tool | |
if: runner.os == 'Linux' | |
# Will not use linuxdeployqt anymore, because it suopprts currently still-supported mainstream distribution, | |
# which is glibc 2.23. For more information, please see https://github.com/probonopd/linuxdeployqt/issues/340. | |
# Will try new tool https://github.com/probonopd/go-appimage written in golang by probonopd. | |
run: | | |
wget -c https://github.com/$(wget -q https://github.com/probonopd/go-appimage/releases/expanded_assets/continuous -O - | grep "appimaged-.*-x86_64.AppImage" | head -n 1 | cut -d '"' -f 2) -P "$GITHUB_WORKSPACE" | |
chmod +x "$GITHUB_WORKSPACE/appimaged-*.AppImage" | |
env: | |
APPIMAGETOOL_ARCH: x86_64 | |
- name: 🐧 📦 Create AppImage | |
# TODO: Stored in build directory | |
if: runner.os == 'Linux' | |
shell: bash | |
run: | | |
APPIMAGE_DST_PATH="${{github.workspace}}/AppDir" | |
cd "$GITHUB_WORKSPACE" | |
cp "$GITHUB_WORKSPACE/assets/icons/icons8-app-symbol-80.png" "$APPIMAGE_DST_PATH/io.github.jmuelbert.${TARGET_NAME}.png" | |
"$GITHUB_WORKSPACE/appimaged-*.AppImage" -s deploy "${APPIMAGE_DST_PATH}/usr/share/applications/io.github.jmuelbert.${TARGET_NAME}.desktop" | |
mkdir -p "${APPIMAGE_DST_PATH}/usr/plugins/platforminputcontexts" | |
if [ -f "${APPIMAGE_DST_PATH}/lib/x86_64-linux-gnu/libxcb-glx.so.0" ]; then | |
rm "${APPIMAGE_DST_PATH}/lib/x86_64-linux-gnu/libxcb-glx.so.0" | |
fi | |
chmod +x "${APPIMAGE_DST_PATH}/usr/lib64/ld-*.so.*" | |
"$GITHUB_WORKSPACE/appimaged-*.AppImage" "${APPIMAGE_DST_PATH}" | |
- name: 🐧 📤 Upload Linux artifacts | |
if: runner.os == 'Linux' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: AppImage | |
path: ./*.AppImage* | |
- name: 🍎 📤 Upload macOS artifacts | |
if: runner.os == 'macOS' | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 | |
with: | |
name: macos-artifacts | |
path: | | |
build/*.dmg | |
build/*.zip | |
- name: "🧊 📤 Upload artifact: Windows Installer" | |
if: runner.os == 'Windows' | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 | |
with: | |
name: windows-artifacts | |
path: | | |
build/*.msi | |
build/*.zip | |
flatpak-build: | |
name: "🐧 Build flatpak on ubuntu-latest" | |
runs-on: ubuntu-latest | |
needs: tests | |
permissions: | |
actions: read | |
contents: read | |
security-events: write | |
steps: | |
- name: "⚙️ Get the version" | |
id: get_version | |
shell: bash | |
run: echo "VERSION=$(echo ${GITHUB_REF} | cut -d / -f 3)" >> "$GITHUB_OUTPUT" | |
- name: 🧰 Checkout Source Code | |
# Checkout the repository to the GitHub Actions runner | |
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | |
with: | |
# Full git history is needed to get a proper list of changed files within `super-linter` | |
fetch-depth: 0 | |
- name: Install Flatpak | |
run: | | |
sudo apt-get -y -qq update | |
sudo apt-get install -y flatpak flatpak-builder | |
- name: Setup Flatpak | |
run: | | |
sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive \ | |
apt-get --no-install-recommends --assume-yes install \ | |
flatpak flatpak-builder elfutils | |
- name: Flatpak add user | |
run: | | |
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo | |
- name: 📦 Create package | |
run: "mkdir -pv \"$GITHUB_WORKSPACE/install\"\nBUNDLE=\"io.github.jmuelbert.${{env.TARGET_NAME}}.flatpak\"\nMANIFEST_PATH=\"$GITHUB_WORKSPACE/packging/flatpak/org.jmuelbert.jmbde.QT.yaml\"\nRUNTIME_REPO=\"https://flathub.org/repo/flathub.flatpakrepo\"\nAPP_ID=\"io.github.jmuelbert.${{env.TARGET_NAME}}\"\n\nflatpak-builder --user --disable-rofiles-fuse --repo=repo --force-clean flatpak_app \"${MANIFEST_PATH}\" --install-deps-from=flathub\nflatpak build-bundle repo ${BUNDLE} --runtime-repo=\"${RUNTIME_REPO}\" \"${APP_ID}\"\nmv \"$GITHUB_WORKSPACE/$BUNDLE\" \"$GITHUB_WORKSPACE/io.github.jmuelbert.${{env.TARGET_NAME}}_${{ steps.get_version.outputs.VERSION }}.x86_64.flatpak\"\nls -al \n" | |
- name: 📤 Upload artifact FlatPak | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 | |
with: | |
name: flatpak-artifact | |
path: | | |
./install/*.flatpak | |
snap-build: | |
name: 🐧 Build snap on ubuntu-20.04 | |
runs-on: ubuntu-20.04 | |
needs: tests | |
steps: | |
- name: ⚙️ Get the version | |
id: get_version | |
shell: bash | |
run: echo "VERSION=$(echo ${GITHUB_REF} | cut -d / -f 3)" >> "$GITHUB_OUTPUT" | |
- name: 🧰 Checkout Source Code | |
# Checkout the repository to the GitHub Actions runner | |
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | |
- name: 📦 Create snap | |
uses: snapcore/action-build@3bdaa03e1ba6bf59a65f84a751d943d549a54e79 # v1.3.0 | |
id: snapcraft | |
with: | |
snapcraft-args: --enable-experimental-extensions | |
- name: "Rename snap name" | |
shell: bash | |
run: | | |
mv "${{ steps.snapcraft.outputs.snap }}" "$GITHUB_WORKSPACE/${TARGET_NAME}_${{ steps.get_version.outputs.VERSION }}_amd64.snap" | |
ls -lah | |
- name: 🐧 📤 Upload artifact SnapPack | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 | |
with: | |
name: snapcraft-artifact | |
path: | | |
$GITHUB_WORKSPACE/${{ env.TARGET_NAME}}_*_amd64.snap | |
changeLog: | |
# if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
needs: upload | |
steps: | |
- name: Build Changelog | |
id: github_release | |
uses: mikepenz/release-changelog-builder-action@69817ffbda9792da9756c52efd06b5a6103f39dc # v5 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create Release | |
uses: mikepenz/action-gh-release@9a604afa5167a745eab07256a54e2f578a1a0c5e # v1 | |
with: | |
body: ${{steps.github_release.outputs.changelog}} | |
# Upload continuous build | |
upload: | |
name: 🗂 Create release and upload artifacts | |
needs: | |
- build | |
- flatpak-build | |
- snap-build | |
runs-on: ubuntu-latest | |
steps: | |
- name: "⚙️ Get the version" | |
id: get_version | |
shell: bash | |
run: echo "VERSION=$(echo ${GITHUB_REF} | cut -d / -f 3)" >> "$GITHUB_OUTPUT" | |
- name: 📥 Download artifacts | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
- name: 🗂 Inspect directory after downloading artifacts | |
run: ls -alFR | |
- name: "📤 Upload Release: AppImage" | |
if: startsWith(github.event.ref, 'refs/tags/') | |
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2.9.0 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ${{github.workspace}}/${{env.TARGET_NAME}}.appimage | |
asset_name: ${{env.TARGET_NAME}}.appimage | |
tag: ${{ github.ref }} | |
overwrite: true | |
- name: "📤 Upload Release: FlatPak" | |
if: startsWith(github.event.ref, 'refs/tags/') | |
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2.9.0 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ${{github.workspace}}/${{env.TARGET_NAME}}.flatpak | |
asset_name: ${{env.TARGET_NAME}}.flatpak | |
tag: ${{ github.ref }} | |
overwrite: true | |
- name: "📤 Upload Release: snap" | |
if: startsWith(github.event.ref, 'refs/tags/') | |
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2.9.0 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ${{github.workspace}}/${{env.TARGET_NAME}}.amd64.snap | |
asset_name: ${{env.TARGET_NAME}}.amd64.snap | |
tag: ${{ github.ref }} | |
overwrite: true | |
- name: "📤 Upload Release: macOS" | |
if: startsWith(github.event.ref, 'refs/tags/') | |
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2.9.0 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ${{github.workspace}}/${{env.TARGET_NAME}}.dmg | |
asset_name: ${{env.TARGET_NAME}}.dmg | |
tag: ${{ github.ref }} | |
overwrite: true | |
- name: "📤 Upload Release: windows" | |
if: startsWith(github.event.ref, 'refs/tags/') | |
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2.9.0 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ./${{ env.TARGET_NAME }}.exe | |
asset_name: ${{ env.TARGET_NAME}}-win.exe | |
tag: ${{ github.ref }} | |
overwrite: true | |
- name: "📤 Upload Release: zip for windows" | |
if: startsWith(github.event.ref, 'refs/tags/') | |
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2.9.0 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ./${{ env.archiveName }}-win.zip | |
asset_name: ${{ env.TARGET_NAME}}-win-${{ steps.get_version.outputs.VERSION }}.zip | |
tag: ${{ github.ref }} | |
overwrite: true | |
release-all-green: # This job does nothing and is only used for the branch protection | |
if: always() | |
needs: | |
- clang-format | |
- cmake-format | |
- tests | |
- build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Decide whether the needed jobs succeeded or failed | |
uses: re-actors/alls-green@223e4bb7a751b91f43eda76992bcfbf23b8b0302 # v1.2.2 | |
with: | |
jobs: ${{ toJSON(needs) }} |