Skip to content

Merge pull request #508 from OPNA2608/add/qmake_werror_switch #416

Merge pull request #508 from OPNA2608/add/qmake_werror_switch

Merge pull request #508 from OPNA2608/add/qmake_werror_switch #416

Workflow file for this run

name: Windows 7 and up (32-bit, Qt5)
on:
push:
branches: master
tags: 'v*.*.*'
paths-ignore:
- '**.md'
- '**.txt'
- 'LICENSE'
- '.gitignore'
pull_request:
branches: master
paths-ignore:
- '**.md'
- '**.txt'
- 'LICENSE'
- '.gitignore'
defaults:
run:
shell: bash
env:
BUILD_TARGET: windows-7-32bit
MAKE: mingw32-make
BT_INSTALLBASE: ${{ github.workspace }}/target/
MINGW_VERSION: 8.1.0
MINGW_BITNESS: 32
MINGW_CHOCOBASE: /c/ProgramData/chocolatey/lib/mingw/tools/install/mingw32
MINGW_INSTALLBASE: ${{ github.workspace }}/mingw32/
QT_VERSION: 5.15.2
QT_HOSTOS: windows_x86
QT_TOOLCHAIN: win32_mingw81
QT_MODULES: qtbase qttools qttranslations
QT_INSTALLBASE: ${{ github.workspace }}/Qt/
jobs:
build:
runs-on: windows-latest
steps:
- name: Identify build type.
id: identify-build
run: |
case ${GITHUB_REF} in
refs/tags/* )
TAG=${GITHUB_REF#refs/tags/}
echo "Release ${TAG}"
echo "build-tag=${TAG}" >> $GITHUB_OUTPUT
echo "release=true" >> $GITHUB_OUTPUT
;;
refs/pull/*)
PR=$(echo ${GITHUB_REF} | cut -d/ -f3)
echo "Test PR #${PR}"
echo "build-tag=pr-${PR}" >> $GITHUB_OUTPUT
echo "release=false" >> $GITHUB_OUTPUT
;;
refs/heads/* )
BRANCH=${GITHUB_REF#refs/heads/}
echo "Test ${BRANCH}"
echo "build-tag=${BRANCH}" >> $GITHUB_OUTPUT
echo "release=false" >> $GITHUB_OUTPUT
;;
* )
echo "Test (unknown)"
echo "build-tag=unknown" >> $GITHUB_OUTPUT
echo "release=false" >> $GITHUB_OUTPUT
;;
esac
- name: Checking out repository.
uses: actions/checkout@v4
with:
submodules: recursive
## Windows-specific steps
# Unable to cache system-installed MinGW. Uploaded cache is supposedly an empty tarball
# when trying to fetch it.
# > Received 30 of 30 (100.0%), 0.0 MBs/sec
# > Cache Size: ~0 MB (30 B)
# We instead copy & reown the MinGW installation to the GitHub workspace,
# ugly but it works. :/
- name: Fetching MinGW cache.
id: mingw-cache
uses: actions/cache@v4
with:
path: ${{ env.MINGW_INSTALLBASE }}
key: ${{ env.MINGW_VERSION }} ${{ env.MINGW_BITNESS }}
- name: Installing MinGW.
run: |
./scripts/fetch_mingw.sh ${MINGW_CHOCOBASE} ${MINGW_VERSION} ${MINGW_BITNESS} ${MINGW_INSTALLBASE}
# "Prepending to PATH" doesn't work properly and inserts the path *close*
# to the start of PATH, but *after* the system's MinGW path.
# Our MinGW PATH is not searched early enough to work for this build
# so we either manually reexport PATH for ever step or fiddle with the PATH even more. :/
# - name: Adding MinGW to PATH.
# run: |
# echo ${MINGW_CHOCOBASE}/bin >> ${GITHUB_PATH}
# Cache Qt installations, very costly & flakey to fetch
- name: Fetching Qt cache.
id: qt-cache
uses: actions/cache@v4
with:
path: ${{ env.QT_INSTALLBASE }}
key: ${{ runner.os }} Qt${{ env.QT_VERSION }} ${{ env.QT_TOOLCHAIN }} ${{ env.QT_MODULES }}
- name: Installing Qt.
run: |
./scripts/fetch_qt.sh ${QT_INSTALLBASE} ${QT_VERSION} ${QT_HOSTOS} ${QT_TOOLCHAIN} ${QT_MODULES}
- name: Adding Qt to PATH.
run: |
find ${QT_INSTALLBASE} -type d -name bin >> ${GITHUB_PATH}
## End Windows-specific steps
- name: Configuring.
run: |
export PATH="${MINGW_INSTALLBASE}/bin:${PATH}"
lupdate Project.pro
qmake Project.pro PREFIX=${BT_INSTALLBASE} \
CONFIG+=release CONFIG-=debug ${QMAKE_EXTRA_ARGUMENTS}
${MAKE} qmake_all
- name: Building.
run: |
export PATH="${MINGW_INSTALLBASE}/bin:${PATH}"
${MAKE} -j2
- name: Installing.
run: |
export PATH="${MINGW_INSTALLBASE}/bin:${PATH}"
${MAKE} -j2 install
- name: Test packaging.
if: env.DONT_PACKAGE != 'true'
run: |
export PATH="${MINGW_INSTALLBASE}/bin:${PATH}"
pushd ${BT_INSTALLBASE}
bash ${GITHUB_WORKSPACE}/scripts/package_${SCRIPT_NAME:-${BUILD_TARGET%%-*}}.sh
popd
- name: Finalize packaging.
id: packaging
if: steps.identify-build.outputs.release == 'true' && env.DONT_PACKAGE != 'true'
run: |
export package_name="BambooTracker-${{ steps.identify-build.outputs.build-tag }}-${BUILD_TARGET}"
echo "package-name=${package_name}" >> $GITHUB_OUTPUT
mv -v ${BT_INSTALLBASE} ${package_name}
7z a -tzip ${package_name}{.zip,}
- name: Upload release package.
if: steps.identify-build.outputs.release == 'true' && env.DONT_PACKAGE != 'true'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.packaging.outputs.package-name }}.zip
asset_name: ${{ steps.packaging.outputs.package-name }}.zip
tag: ${{ github.ref }}