Skip to content

fix/ci: build_windows_x64_mingw job in release CI now uses PR branch #77

fix/ci: build_windows_x64_mingw job in release CI now uses PR branch

fix/ci: build_windows_x64_mingw job in release CI now uses PR branch #77

Workflow file for this run

name: Dandelion-dev CI
env:
GH_TOKEN: ${{ secrets.DANDELION_DEV }} # Needed by gh cli
DANDELION_DEV_REPO: XJTU-Graphics/dandelion-dev
DANDELION_DEV_BRANCH: main
DANDELION_DEV_TOKEN: ${{ secrets.DANDELION_DEV }}
DANDELION_AUTOBUILD_REPO: XJTU-Graphics/dandelion-autobuild
# We upload only to nightly release
# as there's a limit on artifact storage space
UPLOAD_TO_NIGHTLY: ${{ vars.UPLOAD_TO_NIGHTLY || 'true' }}
on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
pre_build:
runs-on: ubuntu-24.04
outputs:
updated: ${{ steps.check.outputs.updated }}
steps:
- id: check_dev_updated
name: Check if dev is updated
run: |
LAST_NIGHTLY_HASH=$(gh release view nightly -R ${{ github.repository }} --json name --jq '.name' | cut -d "[" -f2 | cut -d "]" -f1)
CURRENT_NIGHTLY_HASH=$(curl -s -H "Authorization: token ${{ env.DANDELION_DEV_TOKEN }}" \
-H "Accept: application/vnd.github.VERSION.sha" \
"https://api.github.com/repos/${{ env.DANDELION_DEV_REPO }}/commits/${{ env.DANDELION_DEV_BRANCH }}")
if [ ${LAST_NIGHTLY_HASH} = ${CURRENT_NIGHTLY_HASH} ]; then
# is not updated
echo "updated=false" >> "$GITHUB_OUTPUT"
else
echo "updated=true" >> "$GITHUB_OUTPUT"
fi
# update title
gh release edit nightly -R ${{ github.repository }} --title "Nightly build [${CURRENT_NIGHTLY_HASH}]"
build_windows_x64_msvc:
runs-on: windows-2022
needs: pre_build
if: ${{ needs.check_dev_updated.outputs.updated == 'true' }}
strategy:
matrix:
build_kind: [dev, lib]
build_type: [debug, release]
include:
- build_kind: dev
cmake_root: .
- build_kind: lib
cmake_root: lib
- should_upload: false
- build_kind: lib
should_upload: true
- build_type: release
should_upload: true
env:
ARTIFACT_NAME: dandelion-windows_msvc-x64-${{ matrix.build_kind }}-${{ matrix.build_type }}
defaults:
run:
shell: powershell
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
repository: ${{ env.DANDELION_DEV_REPO }}
ref: ${{ env.DANDELION_DEV_BRANCH }}
token: ${{ env.DANDELION_DEV_TOKEN }}
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ env.ARTIFACT_NAME }}
variant: sccache
- name: Generate VS build file
run: |
New-Item -ItemType "directory" build
cmake -G "Visual Studio 17 2022" -S ${{ matrix.cmake_root }} -B build -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
- name: Build Dandelion
run: cmake --build build --config ${{ matrix.build_type }} --parallel $Env:NUMBER_OF_PROCESSORS
- if: ${{ env.UPLOAD_TO_NIGHTLY == 'true' && matrix.should_upload }}
name: Upload Nightly
run: |
7z a -tzip -mx9 ${{ env.ARTIFACT_NAME }}.zip ./build/${{ matrix.build_type }}/*
gh release upload nightly ${{ env.ARTIFACT_NAME }}.zip -R ${{github.repository}} --clobber
continue-on-error: true
build_macos:
runs-on: macos-14
needs: pre_build
if: ${{ needs.check_dev_updated.outputs.updated == 'true' }}
strategy:
matrix:
build_kind: [dev, lib]
build_type: [debug, release]
include:
- build_kind: dev
cmake_root: .
artifacts: dandelion
- build_kind: lib
cmake_root: lib
artifacts: libdandelion*
- should_upload: false
- build_kind: lib
should_upload: true
- build_type: release
should_upload: true
env:
ARTIFACT_NAME: dandelion-macos-arm64-${{ matrix.build_kind }}-${{ matrix.build_type }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
repository: ${{ env.DANDELION_DEV_REPO }}
ref: ${{ env.DANDELION_DEV_BRANCH }}
token: ${{ env.DANDELION_DEV_TOKEN }}
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ env.ARTIFACT_NAME }}
- name: Generate build file
run: |
mkdir build
cmake -S ${{ matrix.cmake_root }}\
-B build -DCMAKE_BUILD_TYPE=$(echo ${{ matrix.build_type }} | awk '{ print toupper( substr( $0, 1, 1 ) ) substr( $0, 2 ); }')\
-D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache
- name: Build Dandelion
run: cmake --build build --parallel $(sysctl -n hw.activecpu)
- if: ${{ env.UPLOAD_TO_NIGHTLY == 'true' && matrix.should_upload }}
name: Upload Nightly
run: |
7z a -tzip -mx9 ${{ env.ARTIFACT_NAME }}.zip ./build/${{ matrix.artifacts }}
gh release upload nightly ${{ env.ARTIFACT_NAME }}.zip -R ${{github.repository}} --clobber
continue-on-error: true
build_windows_x64_mingw:
runs-on: windows-2022
needs: pre_build
if: ${{ needs.check_dev_updated.outputs.updated == 'true' }}
strategy:
matrix:
sys: [ucrt64, clang64]
build_kind: [dev, lib]
include:
- should_upload_debug: false
should_upload_release: true
- build_kind: lib
should_upload_debug: true
env:
ARTIFACT_NAME: dandelion-windows_${{ matrix.sys }}-x64-${{ matrix.build_kind }}
defaults:
run:
shell: msys2 {0}
steps:
- name: Checkout dandelion-autobuild
uses: actions/checkout@v4
with:
repository: ${{ env.DANDELION_AUTOBUILD_REPO }}
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ env.ARTIFACT_NAME }}
- name: Checkout code
uses: actions/checkout@v4
with:
path: dandelion
repository: ${{ env.DANDELION_DEV_REPO }}
ref: ${{ env.DANDELION_DEV_BRANCH }}
token: ${{ env.DANDELION_DEV_TOKEN }}
- name: Setup MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.sys }}
path-type: inherit
update: false
install: >-
git
make
pacboy: >-
toolchain:p
cmake:p
ninja:p
- name: Build.sh
env:
OS_NAME: ${{ matrix.sys }}
DANDELION_PATH: dandelion
BUILD_PATH: build
BUILD_OUTPUT_PATH: build_output
run: |
mkdir build
mkdir build_output
# apply a temporary patch to allow ccache to be used
sed -i '/-DCMAKE_BUILD_TYPE=\(Debug\|Release\)/ s/\(-DCMAKE_BUILD_TYPE=\(Debug\|Release\)\)/\1 -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache/' build.sh
bash build.sh ${{ matrix.build_kind }}
- if: ${{ env.UPLOAD_TO_NIGHTLY == 'true' && matrix.should_upload_debug }}
name: Upload Nightly (debug)
run: |
7z a -tzip -mx9 ${{ env.ARTIFACT_NAME }}-debug.zip ./build_output/${{ matrix.sys }}-debug-artifacts/*
gh release upload nightly ${{ env.ARTIFACT_NAME }}-debug.zip -R ${{github.repository}} --clobber
continue-on-error: true
- if: ${{ env.UPLOAD_TO_NIGHTLY == 'true' && matrix.should_upload_release }}
name: Upload Nightly (release)
run: |
7z a -tzip -mx9 ${{ env.ARTIFACT_NAME }}-release.zip ./build_output/${{ matrix.sys }}-release-artifacts/*
gh release upload nightly ${{ env.ARTIFACT_NAME }}-release.zip -R ${{github.repository}} --clobber
continue-on-error: true
build_linux:
runs-on: ubuntu-24.04
needs: pre_build
if: ${{ needs.check_dev_updated.outputs.updated == 'true' }}
strategy:
matrix:
sys: [archlinux, debian-12, fedora, ubuntu-22.04, ubuntu-24.04]
build_kind: [dev, lib]
include:
- should_upload_debug: false
should_upload_release: true
- build_kind: lib
should_upload_debug: true
env:
ARTIFACT_NAME: dandelion-linux-x64-${{ matrix.build_kind }}
defaults:
run:
shell: bash
steps:
- name: Checkout dandelion-autobuild
uses: actions/checkout@v4
with:
repository: ${{ env.DANDELION_AUTOBUILD_REPO }}
- name: Checkout code
uses: actions/checkout@v4
with:
path: dandelion
repository: ${{ env.DANDELION_DEV_REPO }}
ref: ${{ env.DANDELION_DEV_BRANCH }}
token: ${{ env.DANDELION_DEV_TOKEN }}
- if: ${{ matrix.sys == 'archlinux' }}
name: Update rolling distribution images
run: |
python3 build_all.py -u
- name: Build docker image
run: |
python3 build_all.py --build-images -i dockerfiles/${{ matrix.sys }}.Dockerfile
- name: Build dandelion
run: |
python3 build_all.py --build --build-kind ${{ matrix.build_kind }} -i dockerfiles/${{ matrix.sys }}.Dockerfile
# linux builds are compatible, upload only once
- if: ${{ matrix.sys == 'ubuntu-24.04' && env.UPLOAD_TO_NIGHTLY == 'true' && matrix.should_upload_debug }}
name: Upload Nightly (debug)
run: |
7z a -tzip -mx9 ${{ env.ARTIFACT_NAME }}-debug.zip ./build_output/${{ matrix.sys }}-debug-artifacts/*
gh release upload nightly ${{ env.ARTIFACT_NAME }}-debug.zip -R ${{github.repository}} --clobber
continue-on-error: true
- if: ${{ matrix.sys == 'ubuntu-24.04' && env.UPLOAD_TO_NIGHTLY == 'true' && matrix.should_upload_release }}
name: Upload Nightly (release)
run: |
7z a -tzip -mx9 ${{ env.ARTIFACT_NAME }}-release.zip ./build_output/${{ matrix.sys }}-release-artifacts/*
gh release upload nightly ${{ env.ARTIFACT_NAME }}-release.zip -R ${{github.repository}} --clobber
continue-on-error: true