Skip to content

Increment nightly version #1602

Increment nightly version

Increment nightly version #1602

Workflow file for this run

name: win32-msvc
on:
push:
tags:
- 'nightly'
jobs:
build:
runs-on: windows-2019
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
# Increment version. Ideally we would like to do it once for all builds,
# but this is complicated as we want to allow to trigger a nightly by
# pushing the tag, so this can't be in nightly.yml. One option would be to
# have another intermediate workflow, but we take the quik & dirty
# solution: increment it in each workflow and push it in one (linux.yml).
- name: Increment version
id: version
shell: bash
run: |
version=$(grep "define NIGHTLY" source/LeLib/data.cpp | awk '{ print $3 }')
let version=${version}+1
sed -i "s/define NIGHTLY .*/define NIGHTLY $version/" source/LeLib/data.cpp
version=$(grep "define \(MAJOR\|FEATURE\|NIGHTLY\)" source/LeLib/data.cpp | awk '{ print $3 }' | xargs | sed 's/ /\./g')
echo "::set-output name=TRSE_VERSION::${version}"
- uses: microsoft/setup-msbuild@v1
- uses: jurplel/install-qt-action@v2
with:
version: '6.0.1'
tools: 'tools_ifw,4.0.0,qt.tools.ifw.40 tools_qtcreator,9.0.0,qt.tools.qtcreator'
- name: Build TRSE
shell: cmd
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
qmake TRSE.pro
D:\a\TRSE\Qt\Tools\QtCreator\bin\jom\jom.exe -j 2 -f Makefile.Release
# OK64 doesn't build with Qt 6.0 or Qt 6.1 (no Qt Multimedia). Hopefully this will be fixed with Qt 6.2.
#- name: Build OK64
# shell: cmd
# run: |
# git clone https://github.com/leuat/OK64.git
# cd OK64/OK64
# call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
# qmake INCLUDEPATH=$OK64dir/resid/include QMAKE_LFLAGS=-Wl,-L$OK64dir/resid/lib/ OK64.pro
# D:\a\TRSE\Qt\Tools\QtCreator\bin\jom.exe -j 2 -f Makefile.Release
# We do not reuse Publish/publish_win/PublishWindows.cmd because copying the libs & plugins is easier with bash
- name: Build zip
shell: bash
run: |
mkdir Publish/publish_win/trse
cd Publish/publish_win/trse
cp ../../../release/trse.exe .
# Copy themes, tutorials, project_templates and units
cp -r ../../source/* .
cp -r ../../tutorials .
cp -r ../../project_templates .
cp -r ../../../units .
# opengl32sw.dll is not available on the GitHub machine but seems
# necessary for windows machine that don't have hardware acceleration
# and don't have the DLL on the system directory from another source
cp ../dll/opengl32sw.dll ./
echo "Copy all required plugins"
# qt_lib_dir must be retrieved before copying the DLLs as after that, all the DLLs are resolved locally
qt_lib_dir=$(ldd trse.exe | awk '{ print $3 }' | grep "/Qt/" | sed 's,/Qt/.*,/Qt/,' | head -n 1)
echo "qt_lib_dir: '${qt_lib_dir}'"
# The files are converted to dos format at checkout, we don't want the carriage returns.
dos2unix ../plugins.txt
dos2unix ../ignore_dlls.txt
while read plugin
do
echo " Looking for '${plugin}'"
lib=$(find "${qt_lib_dir}" | grep "${plugin}" | head -n 1 || echo "")
if [ -z "${lib}" ]
then
echo " - ${lib} NOT FOUND"
else
echo " - ${lib} (${plugin})"
mkdir -p $(dirname "${plugin}")
cp "${lib}" "${plugin}"
echo " Copying its dependencies:"
ldd "${lib}" | grep -v -i -f ../ignore_dlls.txt | awk '{ print $3 }' | sort -u
ldd "${lib}" | grep -v -i -f ../ignore_dlls.txt | awk '{ print $3 }' | sort -u | xargs -I _ bash -c 'cp _ ./ || echo "failed to copy _"'
fi
done < ../plugins.txt
echo "Copy trse.exe dependencies"
ldd trse.exe | grep -v -i -f ../ignore_dlls.txt | awk '{ print $3 }' | sort -u
ldd trse.exe | grep -v -i -f ../ignore_dlls.txt | awk '{ print $3 }' | sort -u | xargs -I _ bash -c 'cp _ ./ || echo "failed to copy _"'
cd ..
echo "Copy OK64 from old archive"
mkdir tmp # Separate directory as the archive contain a trse dir that would clash with our own
cd tmp
curl https://www.irio.co.uk/trse/nightly_build/trse_win_nightly.zip -o trse_win_nightly.zip
unzip trse_win_nightly.zip
cp -r trse/OK64 ../trse/
cd ..
7z a trse_win.zip trse
- name: Publish zip
uses: ColinPitrat/update-release@master
with:
release: nightly
message: Nightly build
body: TRSE ${{ steps.version.outputs.TRSE_VERSION }} <br/> The latest automated nightly build of TRSE which succeeded. This is the recommended version to use.
files: Publish/publish_win/trse_win.zip
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}
- name: Build notification
if: failure()
uses: adamkdean/simple-slack-notify@master
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
with:
channel: #bugs
text: "[GitHub Actions Notification] Windows build failed: ${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}"