Skip to content

Enable auto-retry #1478

Enable auto-retry

Enable auto-retry #1478

Workflow file for this run

name: HyperHDR CI Build
on:
push:
# pull_request:
env:
USE_CACHE: ${{ vars.USE_CACHE && vars.USE_CACHE || true }}
RESET_CACHE: ${{ vars.RESET_CACHE && vars.RESET_CACHE || false }}
USE_CODEQL: ${{ vars.USE_CODEQL && vars.USE_CODEQL || false }}
BUILD_ARCHIVES: ${{ startsWith(github.event.ref, 'refs/tags') && true || false }}
jobs:
######################
###### Linux #########
######################
Linux:
name: ${{ matrix.dockerName }}
runs-on: ubuntu-22.04
strategy:
matrix:
linuxVersion: [ bullseye ]
dockerImage: [ x86_64, arm-32bit-armv6l, arm-64bit-aarch64 ]
include:
- dockerImage: x86_64
linuxVersion: bullseye
dockerName: Debian Bullseye (x86_64)
platform: linux
- dockerImage: x86_64
linuxVersion: bookworm
dockerName: Debian Bookworm (x86_64)
platform: linux
- dockerImage: x86_64
linuxVersion: jammy
dockerName: Ubuntu 22.04 LTS (x86_64)
platform: linux
- dockerImage: x86_64
linuxVersion: noble
dockerName: Ubuntu 24.04 LTS (x86_64)
platform: linux
- dockerImage: arm-32bit-armv6l
linuxVersion: bullseye
dockerName: Debian Bullseye (ARM 32-bit Raspberry Pi OS)
platform: rpi
- dockerImage: arm-64bit-aarch64
linuxVersion: bullseye
dockerName: Debian Bullseye (ARM 64-bit Raspberry Pi OS)
platform: rpi
- dockerImage: arm-32bit-armv6l
linuxVersion: bookworm
dockerName: Debian Bookworm (ARM 32-bit Raspberry Pi OS)
platform: rpi
- dockerImage: arm-64bit-aarch64
linuxVersion: bookworm
dockerName: Debian Bookworm (ARM 64-bit Raspberry Pi OS)
platform: rpi
- dockerImage: x86_64
linuxVersion: Fedora_40
dockerName: Fedora 40 (x86_64)
platform: linux
- dockerImage: x86_64
linuxVersion: ArchLinux
dockerName: Arch Linux (x86_64)
platform: linux
steps:
# checkout
- uses: actions/checkout@v4.2.0
with:
submodules: true
# generate cache id
- name: Prepare ccache timestamp
if: env.USE_CACHE == 'true'
id: ccache_cache_timestamp
shell: cmake -P {0}
run: |
string(TIMESTAMP current_date "%Y-%m-%d-%H-%M-%S" UTC)
file(APPEND "$ENV{GITHUB_OUTPUT}" "timestamp=${current_date}")
# download cache
- name: Download ccache files
if: env.USE_CACHE == 'true'
uses: actions/cache@v4.0.2
with:
path: .ccache
key: ${{ matrix.linuxVersion }}-${{ matrix.dockerImage }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: ${{ matrix.linuxVersion }}-${{ matrix.dockerImage }}-ccache-
- name: Clear branch ccache storage
uses: yumemi-inc/clean-cache-action@v1
with:
ref: ${{ github.event.ref }}
key: ${{ matrix.linuxVersion }}-${{ matrix.dockerImage }}-ccache-
- name: Check default version
if: matrix.linuxVersion != 'bullseye'
run: |
echo "USE_STANDARD_INSTALLER_NAME=true" >> $GITHUB_ENV
- name: Build packages
env:
DOCKER_IMAGE: ${{ matrix.dockerImage }}
DOCKER_TAG: ${{ matrix.linuxVersion }}
DOCKER_NAME: ${{ matrix.dockerName }}
PLATFORM: ${{ matrix.platform }}
USE_CCACHE: ${{ env.USE_CACHE }}
RESET_CACHE: ${{ env.RESET_CACHE }}
shell: bash
run: |
./build.sh
# Upload artifacts (only on tagged commit)
- name: Upload artifacts
if: startsWith(github.event.ref, 'refs/tags') && github.event_name != 'pull_request'
uses: actions/upload-artifact@v4.4.0
with:
name: release-artifact-${{ matrix.linuxVersion }}-${{ matrix.dockerImage }}
path: deploy/Hyper*
# Upload artifacts from commit
- name: Upload artifacts from commit
if: (startsWith(github.event.ref, 'refs/tags') != true) && github.event_name != 'pull_request'
uses: actions/upload-artifact@v4.4.0
with:
name: Linux-${{ matrix.linuxVersion }}-${{ matrix.dockerImage }}-installer
path: |
deploy/Hyper*.deb
deploy/Hyper*.zst
deploy/Hyper*.rpm
######################
######## macOS #######
######################
macOS:
name: ${{ matrix.JOB_NAME }}
runs-on: ${{ matrix.JOB_RUNNER }}
strategy:
matrix:
include:
- JOB_RUNNER: macos-14
JOB_NAME: macOS 14 (arm64/M1/M2)
QT_VERSION: 6
NICE_NAME: arm64_M1_M2
- JOB_RUNNER: macos-13
JOB_NAME: macOS 13 (x64)
QT_VERSION: 6
NICE_NAME: x64
steps:
# Checkout
- uses: actions/checkout@v4.2.0
with:
submodules: true
# Generate cache id
- name: Prepare ccache timestamp
if: env.USE_CACHE == 'true'
id: ccache_cache_timestamp
shell: cmake -P {0}
run: |
string(TIMESTAMP current_date "%Y-%m-%d-%H-%M-%S" UTC)
file(APPEND "$ENV{GITHUB_OUTPUT}" "timestamp=${current_date}")
# Download cache
- name: Download ccache files
if: env.USE_CACHE == 'true'
uses: actions/cache@v4.0.2
with:
path: build/.ccache
key: macOS-ccache-${{ matrix.NICE_NAME }}-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: macOS-ccache-${{ matrix.NICE_NAME }}
- name: Clear branch ccache storage
uses: yumemi-inc/clean-cache-action@v1
with:
ref: ${{ github.event.ref }}
key: macOS-ccache-${{ matrix.NICE_NAME }}
# Install deps
- name: Install deps
shell: bash
run: brew install -q qt@${{ matrix.QT_VERSION }} xz ccache zstd webp jpeg-turbo flatbuffers pkg-config || true
# Set env
- name: Set QT5 env
if: ( matrix.QT_VERSION == 5 )
shell: bash
run: |
export Qt5_DIR=`brew --prefix qt@5`;
echo "Qt5_DIR=$Qt5_DIR" >> $GITHUB_ENV
# Build process
- name: Build packages
env:
PLATFORM: osx
USE_CCACHE: ${{ env.USE_CACHE }}
RESET_CACHE: ${{ env.RESET_CACHE }}
shell: bash
run: ./build.sh
# Upload artifacts (only on tagged commit)
- name: Upload artifacts
if: startsWith(github.event.ref, 'refs/tags') && github.event_name != 'pull_request'
uses: actions/upload-artifact@v4.4.0
with:
name: release-artifact-${{ matrix.JOB_RUNNER }}
path: build/Hyper*.dmg
# Upload artifacts from commit
- name: Upload artifacts from commit
if: (startsWith(github.event.ref, 'refs/tags') != true) && github.event_name != 'pull_request'
uses: actions/upload-artifact@v4.4.0
with:
name: Apple_macOS_${{ matrix.NICE_NAME }}_DMG_installer
path: build/Hyper*.dmg
######################
###### Windows #######
######################
windows:
name: Windows
runs-on: windows-2022
env:
VCINSTALLDIR: 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC'
QT_VERSION: 6.5.3
steps:
- name: Checkout
uses: actions/checkout@v4.2.0
with:
submodules: true
- name: Cache Qt
uses: actions/cache@v4.0.2
id: cache-qt-windows
with:
path: ${{ runner.workspace }}/Qt
key: ${{ runner.os }}-Qt.${{ env.QT_VERSION }}
- name: Install QT
if: steps.cache-qt-windows.outputs.cache-hit != 'true'
run: |
pip install aqtinstall
aqt install-qt -O ${{ runner.workspace }}/Qt windows desktop ${{ env.QT_VERSION }} win64_msvc2019_64 -m qtserialport
# Generate cache id
- name: Prepare ccache timestamp
if: env.USE_CACHE == 'true'
id: ccache_cache_timestamp
shell: cmake -P {0}
run: |
string(TIMESTAMP current_date "%Y-%m-%d-%H-%M-%S" UTC)
file(APPEND "$ENV{GITHUB_OUTPUT}" "timestamp=${current_date}")
# Download cache
- name: Download ccache files
if: env.USE_CACHE == 'true'
uses: actions/cache@v4.0.2
with:
path: build/.ccache
key: ${{ runner.os }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: ${{ runner.os }}-ccache
- name: Clear branch ccache storage
uses: yumemi-inc/clean-cache-action@v1
with:
ref: ${{ github.event.ref }}
key: ${{ runner.os }}-ccache
- name: Install TurboJPEG
shell: powershell
run: |
Invoke-WebRequest -Method Get -Uri https://github.com/libjpeg-turbo/libjpeg-turbo/releases/download/3.0.3/libjpeg-turbo-3.0.3-vc64.exe -OutFile turbojpeg.exe -UseBasicParsing
Start-Process -Wait turbojpeg.exe -ArgumentList "/S"
- name: Download CCache
shell: powershell
run: |
Invoke-WebRequest -Method Get -Uri https://github.com/ccache/ccache/releases/download/v4.10/ccache-4.10-windows-x86_64.zip -OutFile ccache.zip -UseBasicParsing
- name: Install CCache
shell: cmd
run: |
7z e ccache.zip -o.\build *.exe -r
- name: Set up x64 build architecture environment
shell: cmd
run: call "${{env.VCINSTALLDIR}}\Auxiliary\Build\vcvars64.bat"
# Build packages
- name: Build packages
env:
PLATFORM: windows
CMAKE_PREFIX_PATH: "${{ runner.workspace }}/Qt/${{ env.QT_VERSION }}/msvc2019_64/lib/cmake/"
USE_CCACHE: ${{ env.USE_CACHE }}
shell: bash
run: |
./build.sh
# Upload artifacts (only on tagged commit)
- name: Upload artifacts
if: startsWith(github.event.ref, 'refs/tags') && github.event_name != 'pull_request'
uses: actions/upload-artifact@v4.4.0
with:
name: release-artifact-windows
path: build/Hyper*
# Upload artifacts from commit
- name: Upload artifacts from commit
if: (startsWith(github.event.ref, 'refs/tags') != true) && github.event_name != 'pull_request'
uses: actions/upload-artifact@v4.4.0
with:
name: Windows_x64_setup
path: build/Hyper*.exe
################################
####### CodeQL support #########
################################
analyze:
name: Analyze (CodeQL)
runs-on: ubuntu-latest
if: ${{ vars.USE_CODEQL == 'true' && vars.USE_CODEQL || false }}
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'cpp', 'javascript' ]
steps:
- name: Checkout repository
uses: actions/checkout@v4.2.0
if: env.USE_CODEQL == 'true'
with:
submodules: true
- name: Run composite CodeQL job for '${{matrix.language}}' language
uses: ./.github/actions/codeql
if: env.USE_CODEQL == 'true'
with:
language: ${{matrix.language}}
################################
###### Publish Releases ########
################################
publish:
name: Publish Releases
if: startsWith(github.event.ref, 'refs/tags') && github.event_name != 'pull_request'
needs: [Linux, windows, macOS]
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4.2.0
# generate environment variables
- name: Generate environment variables from version and tag
run: |
echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
echo "VERSION=$(tr -d '\n' < version)" >> $GITHUB_ENV
echo "preRelease=false" >> $GITHUB_ENV
# If version contains alpha or beta, mark draft release as pre-release
- name: Mark release as pre-release
if: contains(env.VERSION, 'alpha') || contains(env.VERSION, 'beta')
run: echo "preRelease=true" >> $GITHUB_ENV
# Download artifacts from previous build process
- name: Download artifacts
uses: actions/download-artifact@v4.1.8
with:
path: artifacts
pattern: release-artifact-*
merge-multiple: true
# create draft release and upload artifacts
- name: Create draft release
uses: softprops/action-gh-release@v2.0.8
with:
name: HyperHDR ${{ env.VERSION }}
tag_name: ${{ env.TAG }}
files: "artifacts/**"
draft: true
prerelease: ${{ env.preRelease }}