Skip to content

P5V12

P5V12 #433

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: CI
concurrency:
group: CI
cancel-in-progress: false
# Controls when the workflow will run
on:
push:
tags:
- 'v*'
branches:
- main
pull_request:
branches:
- main
types:
- opened
- edited
- synchronize
- reopened
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
strategy:
fail-fast: false
matrix:
flavor: [ubuntu, mac, windows]
compiler: [gcc, clang, msvc]
include:
# define operating systems
- flavor: ubuntu
os: ubuntu-22.04
- flavor: mac
os: macos-12
- flavor: windows
os: windows-latest
# CC
- compiler: msvc
is-experimental: false
- compiler: gcc
CC: gcc-12
CXX: g++-12
is-experimental: false
- compiler: clang
CC: clang-17
CXX: clang++-17
CC_LD: lld-17
CXX_LD: lld-17
is-experimental: true
# Mac stuff
- DEVELOPER_DIR: /Applications/Xcode_14.1.app/Contents/Developer
flavor: mac
exclude:
- flavor: windows
compiler: gcc
- flavor: windows
compiler: clang
- flavor: mac
compiler: clang
- flavor: mac
compiler: msvc
- flavor: ubuntu
compiler: msvc
permissions:
actions: read
contents: read
security-events: write
checks: write
env:
CC: ${{ matrix.CC }}
CXX: ${{ matrix.CXX }}
DEVELOPER_DIR: ${{ matrix.DEVELOPER_DIR }}
DEBEMAIL: ${{ vars.DEBEMAIL }}
DEBFULLNAME: ${{ vars.DEBFULLNAME }}
continue-on-error: ${{ matrix.is-experimental }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- if: ${{ matrix.compiler == 'clang' && matrix.flavor == 'ubuntu' }}
name: Install clang ubuntu
run: |
sudo apt-get remove -y python3-lldb-x.y python3-lldb-14 libc++1-14 libc++abi1-14 libunwind-14 libunwind-14-dev
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 17
# libc++-16 doesn't have std::views::join yet
sudo apt-get install libc++-17-dev libc++abi-17-dev
sudo apt-get install libstdc++-12-dev
- if: ${{ matrix.compiler == 'gcc' && matrix.flavor == 'ubuntu' }}
name: Install gcc ubuntu
run: |
sudo apt-get install g++-12 libstdc++-12-dev
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 12
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 12
sudo update-alternatives --set gcc /usr/bin/gcc-12
sudo update-alternatives --set g++ /usr/bin/g++-12
- if: ${{ matrix.flavor == 'ubuntu' }}
name: Install deps ubuntu
run: |
sudo add-apt-repository -n ppa:talisein/ctre
sudo add-apt-repository -n ppa:talisein/libboost-ext-ut
sudo add-apt-repository -n ppa:talisein/outcome
sudo add-apt-repository -n ppa:talisein/magic-enum
sudo apt-get update
sudo apt-get install ninja-build libhowardhinnant-date-dev liboutcome-dev libboost-ext-ut-dev libctre-dev libmagicenum-dev jq findutils
python -m pip install meson
- if: ${{ matrix.flavor == 'mac' }}
name: Install deps mac
run: |
brew search gcc@
brew install meson gcc@12 ninja
- if: ${{ matrix.flavor == 'windows' }}
name: Install Meson/Ninja Windows
run: |
python -m pip install meson
- if: ${{ matrix.flavor == 'windows' }}
uses: ilammy/msvc-dev-cmd@v1
- if: ${{ matrix.flavor == 'ubuntu' && matrix.compiler == 'gcc' && !startsWith(github.ref, 'refs/tags/v') }}
name: Initialize CodeQL
uses: github/codeql-action/init@v3
- name: Cache subprojects
id: meson-cache
uses: actions/cache@v4
with:
path: subprojects/packagecache
key: meson-build-cache-${{ runner.os }}-${{ github.run_id }}
enableCrossOsArchive: true
restore-keys: |
meson-build-cache-${{ runner.os }}-
meson-build-cache-
meson-build-cache
- if: ${{ (steps.meson-cache.outputs.cache-hit == 'true') && (matrix.flavor != 'windows') }}
name: List cache
run: ls subprojects/packagecache
continue-on-error: true
- if: ${{ (steps.meson-cache.outputs.cache-hit == 'true') && (matrix.flavor == 'windows') }}
name: List cache
run: dir subprojects/packagecache
continue-on-error: true
- if: ${{ matrix.flavor == 'ubuntu' && !startsWith(github.ref, 'refs/tags/v') }}
name: Configure Ubuntu 22 (Debug)
run: |
meson setup --warnlevel 3 --buildtype debug --default-library static --force-fallback-for libjpeg,libpng build
- if: ${{ matrix.flavor == 'ubuntu' && startsWith(github.ref, 'refs/tags/v') }}
name: Configure Ubuntu 22 (Release)
run: |
meson setup --warnlevel 3 --buildtype release --default-library static --force-fallback-for libjpeg,libpng build
- if: ${{ matrix.flavor == 'mac' }}
name: Configure MacOS 12
run: |
meson setup --warnlevel 3 --buildtype release --default-library static -Dcpp_link_args="-static-libstdc++ -static-libgcc" --force-fallback-for libjpeg,libpng -Dcpp-httplib:cpp-httplib_openssl=disabled build
- if: ${{ matrix.flavor == 'windows' }}
name: Configure Windows Latest
run: |
meson setup --warnlevel 3 --buildtype release -Dcpp_std=vc++latest --default-library static -Dcpp_eh=a -Dlibxml2:warning_level=0 -Dminiz:warning_level=0 -Dlibjpeg-turbo:warning_level=0 -Dcpp-httplib:cpp-httplib_openssl=disabled -Dcpp-httplib:cpp_std=vc++latest -Dlibxmlpp:build-tests=false -Dlibxml2:python=disabled -Dlibxml2:iconv=disabled --force-fallback-for libpng build
- name: Compile
run: ninja -C build
- if: ${{ matrix.flavor == 'ubuntu' }}
name: ldd ubuntu
run: |
meson introspect --targets build | jq '.[] | select(.type == "executable" and .subproject == null) | .filename[]' | xargs ldd
continue-on-error: true
- if: ${{ matrix.flavor == 'mac' }}
name: ldd macos
run: otool -L build/src/dregarnuhr
continue-on-error: true
- if: ${{ matrix.flavor == 'windows' }}
name: ldd windows
run: dumpbin /DEPENDENTS build/src/dregarnuhr.exe
continue-on-error: true
- name: Test
id: unittests
run: meson test -C build --print-errorlogs
- name: Test Reporter
uses: dorny/[email protected]
if: ${{ always() }}
continue-on-error: true
with:
name: Unit tests ${{ matrix.os }} ${{ matrix.compiler }}
path: 'build/meson-logs/testlog.junit.xml,build/*junit.xml'
reporter: java-junit
fail-on-error: false
- if: ${{ steps.unittests.conclusion == 'failure' && failure() }}
name: Test backtrace
run: |
sudo apt-get install gdb
gdb --batch -ex "run" -ex "bt full" -ex "quit" --args build/src/utils_test
gdb --batch -ex "run" -ex "bt full" -ex "quit" --args build/src/volumes_test
- name: Save logs
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: meson-log ${{ matrix.os }} ${{ matrix.compiler }}
path: |
build/meson-logs/meson-log.txt
build/meson-logs/testlog.txt
if-no-files-found: ignore
retention-days: 5
- if: ${{ matrix.flavor == 'ubuntu' && matrix.compiler == 'gcc' && !startsWith(github.ref, 'refs/tags/v') }}
name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
# Generate tarball for PPA
- if: ${{ matrix.flavor == 'ubuntu' && matrix.compiler == 'gcc' && startsWith(github.ref, 'refs/tags/v') }}
name: Get debuild dependencies
run: |
sudo add-apt-repository -n ppa:talisein/libxml++5.0
sudo add-apt-repository -n ppa:talisein/miniz
sudo apt-get update
sudo apt-get install cmake libcpp-httplib-dev libxml++5.0-dev libminiz3-dev debmake debhelper devscripts equivs distro-info-data distro-info dpkg-dev git-buildpackage
- if: ${{ matrix.flavor == 'ubuntu' && matrix.compiler == 'gcc' && startsWith(github.ref, 'refs/tags/v') }}
name: Generate PPA tarball
run: |
git config user.email "$DEBEMAIL"
git config user.name "$DEBFULLNAME"
gbp dch --ignore-branch -c -R --spawn-editor=never
meson dist -C build --no-tests --formats gztar
cd build/meson-dist
tar -xf dregarnuhr*.tar.gz
- if: ${{ matrix.flavor == 'ubuntu' && matrix.compiler == 'gcc' && startsWith(github.ref, 'refs/tags/v') }}
name: Publish PPA Snapshot
continue-on-error: true
env:
LD_PRELOAD:
GPG_PRIVATE_KEY: ${{ secrets.PPA_PGP_SECRET_KEY }}
DEB_GPG_PASSPHRASE: ${{ secrets.PPA_PGP_PASSPHRASE }}
DEB_SIGN_KEYID: ${{ secrets.PPA_PGP_KEY_ID }}
REPOSITORY: ppa:talisein/dregarnuhr
run: |
cd build/meson-dist/dregarnuhr*/
echo "$GPG_PRIVATE_KEY" | gpg --batch --pinentry-mode loopback --passphrase "$GPG_PASSPHRASE" --import
debmake
debuild -S -p"gpg --batch --no-tty --status-fd 1 --with-colons --passphrase "$DEB_GPG_PASSPHRASE" --pinentry-mode loopback" --force-sign -sa
dput $REPOSITORY ../*.changes
# Capture the binary
- if: ${{ matrix.flavor != 'windows' && (success() || failure()) }}
name: Binary Ubuntu/Mac
uses: actions/upload-artifact@v4
with:
name: dregarnuhr-${{ matrix.os }}-${{ matrix.compiler }}
path: build/src/dregarnuhr
- if: ${{ matrix.flavor == 'windows' && (success() || failure()) }}
name: Binary Windows
uses: actions/upload-artifact@v4
with:
name: dregarnuhr-${{ matrix.os }}
path: build/src/dregarnuhr.exe
check-run-linux:
needs: build
runs-on: ubuntu-22.04
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
- run: |
chmod u+x dregarnuhr-ubuntu-22.04-gcc/dregarnuhr
dregarnuhr-ubuntu-22.04-gcc/dregarnuhr --check --verbose
check-run-macos-12:
needs: build
runs-on: macos-12
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
- run: |
chmod u+x dregarnuhr-macos-12-gcc/dregarnuhr
dregarnuhr-macos-12-gcc/dregarnuhr --check --verbose
check-run-win:
needs: build
runs-on: windows-latest
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
- run: dregarnuhr-windows-latest/dregarnuhr.exe --check --verbose
release:
if: startsWith(github.ref, 'refs/tags/v')
needs: [check-run-linux, check-run-macos-12, check-run-win]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: true
- name: Download Artifacts
uses: actions/download-artifact@v4
- id: myref
env:
REF: ${{ github.event.ref }}
run: echo "::set-output name=MYREF::`echo $REF | cut -b 11-`"
- run: chmod u+x dregarnuhr-ubuntu-22.04-gcc/dregarnuhr
- run: tar -C ./dregarnuhr-ubuntu-22.04-gcc -cJvf "dregarnuhr-linux-${{ steps.myref.outputs.MYREF }}.tar.xz" dregarnuhr
- run: chmod u+x dregarnuhr-macos-12-gcc/dregarnuhr
- run: tar -C ./dregarnuhr-macos-12-gcc -czvf "dregarnuhr-mac-${{ steps.myref.outputs.MYREF }}.tar.gz" dregarnuhr
- run: zip -j "./dregarnuhr-windows-${{ steps.myref.outputs.MYREF }}.zip" dregarnuhr-windows-latest/dregarnuhr.exe
- run: ls
- name: Release Linux Artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dregarnuhr-linux-${{ steps.myref.outputs.MYREF }}.tar.xz
asset_name: dregarnuhr-ubuntu22.04-${{ steps.myref.outputs.MYREF }}.tar.xz
asset_content_type: application/x-xz
- name: Release Mac Artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dregarnuhr-mac-${{ steps.myref.outputs.MYREF }}.tar.gz
asset_name: dregarnuhr-mac-${{ steps.myref.outputs.MYREF }}.tar.gz
asset_content_type: application/gzip
- name: Release Windows Artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dregarnuhr-windows-${{ steps.myref.outputs.MYREF }}.zip
asset_name: dregarnuhr-windows-${{ steps.myref.outputs.MYREF }}.zip
asset_content_type: application/zip