Wire up the starcatcher.us snapshot service

This commit is contained in:
Tamás Bálint Misius 2021-04-04 22:09:16 +02:00
parent 1681ca77d8
commit 4e5527ce97
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2
5 changed files with 89 additions and 3 deletions

15
.github/build.sh vendored
View File

@ -23,6 +23,14 @@ if [ -z "${RELTYPECFG-}" ]; then
>&2 echo "RELTYPECFG not set" >&2 echo "RELTYPECFG not set"
exit 1 exit 1
fi fi
if [ -z "${RELNAME-}" ]; then
>&2 echo "RELNAME not set"
exit 1
fi
if [ -z "${MOD_ID-}" ]; then
>&2 echo "MOD_ID not set"
exit 1
fi
if [ -z "${build_sh_init-}" ]; then if [ -z "${build_sh_init-}" ]; then
if [ $PLATFORM_SHORT == "win" ]; then if [ $PLATFORM_SHORT == "win" ]; then
@ -46,7 +54,8 @@ BUILD_INIT_BAT
exit 0 exit 0
fi fi
other_flags= other_flags=$'\t-Dmod_id='
other_flags+=$MOD_ID
bin_suffix= bin_suffix=
static_flag= static_flag=
if [ $STATIC_DYNAMIC == "static" ]; then if [ $STATIC_DYNAMIC == "static" ]; then
@ -68,6 +77,10 @@ if [ $PLATFORM_SHORT == "win" ]; then
bin_suffix=$bin_suffix.exe bin_suffix=$bin_suffix.exe
fi fi
if echo $RELTYPECFG | base64 -d | grep snapshot; then if echo $RELTYPECFG | base64 -d | grep snapshot; then
other_flags+=$'\t-Dsnapshot=true\t-Dsnapshot_id='
other_flags+=`echo $RELNAME | cut -d '-' -f 2`
fi
if echo $RELTYPECFG | base64 -d | grep snapshot || [ "$MOD_ID" != "0" ]; then
other_flags+=$'\t-Dupdate_server=starcatcher.us/TPT' other_flags+=$'\t-Dupdate_server=starcatcher.us/TPT'
fi fi
meson -Dbuildtype=release -Db_pie=false -Db_staticpic=false -Db_lto=true $static_flag -Dinstall_check=true $other_flags `echo $RELTYPECFG | base64 -d` build meson -Dbuildtype=release -Db_pie=false -Db_staticpic=false -Db_lto=true $static_flag -Dinstall_check=true $other_flags `echo $RELTYPECFG | base64 -d` build

3
.github/get-type.py vendored
View File

@ -18,3 +18,6 @@ else:
print('::set-output name=TYPE::dev') print('::set-output name=TYPE::dev')
print('::set-output name=NAME::dev') print('::set-output name=NAME::dev')
print('::set-output name=RELTYPECFG::%s' % base64.b64encode(('-Dignore_updates=true').encode('utf-8')).decode('utf-8')) print('::set-output name=RELTYPECFG::%s' % base64.b64encode(('-Dignore_updates=true').encode('utf-8')).decode('utf-8'))
with open('.github/mod_id.txt') as f:
print('::set-output name=MOD_ID::' + f.read())

1
.github/mod_id.txt vendored Normal file
View File

@ -0,0 +1 @@
0

5
.github/starcatcher-publish.sh vendored Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
cd "$STARCATCHER_PUBLISH_FILENAME"
mv "$1" "$STARCATCHER_PUBLISH_FILENAME"
LFTP_PASSWORD=$STARCATCHER_PUBLISH_PASSWORD lftp -c "open --user '$STARCATCHER_PUBLISH_USERNAME' --env-password -e 'set ftp:ssl-protect-data true; set ssl:verify-certificate false; put \"$STARCATCHER_PUBLISH_FILENAME\";' ftp://$STARCATCHER_PUBLISH_HOSTPORT"

View File

@ -49,6 +49,10 @@ jobs:
# mingw-dynamic | NO | NO | NO | NO | NO | NO | # mingw-dynamic | NO | NO | NO | NO | NO | NO |
# #
# [1] I don't currently care enough about mingw to figure out how to do this. # [1] I don't currently care enough about mingw to figure out how to do this.
# Please keep this matrix in sync with the other one in this file, see the ### blocks.
#########################################################
############# BEGIN BLOCK FOR COPYING BELOW #############
#########################################################
platform_short: [lin, mac, win] platform_short: [lin, mac, win]
toolset_short: [gcc, msvc, mingw] toolset_short: [gcc, msvc, mingw]
machine_short: [x86_64, i686] machine_short: [x86_64, i686]
@ -65,6 +69,9 @@ jobs:
platform_short: mac platform_short: mac
- toolset_short: gcc - toolset_short: gcc
platform_short: win platform_short: win
#########################################################
############## END BLOCK FOR COPYING BELOW ##############
#########################################################
include: include:
- platform_short: lin - platform_short: lin
os: ubuntu-latest os: ubuntu-latest
@ -93,7 +100,7 @@ jobs:
- if: matrix.platform_short == 'lin' && matrix.static_dynamic != 'static' - if: matrix.platform_short == 'lin' && matrix.static_dynamic != 'static'
run: sudo apt update && sudo apt install libluajit-5.1-dev libcurl4-openssl-dev libfftw3-dev zlib1g-dev libsdl2-dev run: sudo apt update && sudo apt install libluajit-5.1-dev libcurl4-openssl-dev libfftw3-dev zlib1g-dev libsdl2-dev
- run: python -m pip install meson ninja - run: python -m pip install meson ninja
- run: bash -c 'PLATFORM_SHORT=${{ matrix.platform_short }} MACHINE_SHORT=${{ matrix.machine_short }} TOOLSET_SHORT=${{ matrix.toolset_short }} STATIC_DYNAMIC=${{ matrix.static_dynamic }} RELTYPECFG=${{ steps.get_type.outputs.RELTYPECFG }} ./.github/build.sh' - run: bash -c 'PLATFORM_SHORT=${{ matrix.platform_short }} MACHINE_SHORT=${{ matrix.machine_short }} TOOLSET_SHORT=${{ matrix.toolset_short }} STATIC_DYNAMIC=${{ matrix.static_dynamic }} RELTYPECFG=${{ steps.get_type.outputs.RELTYPECFG }} RELNAME=${{ steps.get_type.outputs.NAME }} MOD_ID=${{ steps.get_type.outputs.MOD_ID }} ./.github/build.sh'
- uses: actions/upload-release-asset@v1 - uses: actions/upload-release-asset@v1
if: steps.get_type.outputs.TYPE != 'dev' && matrix.static_dynamic == 'static' if: steps.get_type.outputs.TYPE != 'dev' && matrix.static_dynamic == 'static'
env: env:
@ -104,7 +111,64 @@ jobs:
asset_name: powder-${{ steps.get_type.outputs.NAME }}-${{ matrix.machine_short }}-${{ matrix.platform_short }}-${{ matrix.toolset_short }}-${{ matrix.static_dynamic }}${{ matrix.suffix }} asset_name: powder-${{ steps.get_type.outputs.NAME }}-${{ matrix.machine_short }}-${{ matrix.platform_short }}-${{ matrix.toolset_short }}-${{ matrix.static_dynamic }}${{ matrix.suffix }}
asset_content_type: application/zip asset_content_type: application/zip
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v2
if: steps.get_type.outputs.TYPE == 'dev' && matrix.static_dynamic == 'static' if: matrix.static_dynamic == 'static'
with: with:
path: powder${{ matrix.suffix }} path: powder${{ matrix.suffix }}
name: powder-${{ steps.get_type.outputs.NAME }}-${{ matrix.machine_short }}-${{ matrix.platform_short }}-${{ matrix.toolset_short }}-${{ matrix.static_dynamic }}${{ matrix.suffix }} name: powder-${{ steps.get_type.outputs.NAME }}-${{ matrix.machine_short }}-${{ matrix.platform_short }}-${{ matrix.toolset_short }}-${{ matrix.static_dynamic }}${{ matrix.suffix }}
starcatcher-upload:
runs-on: ubuntu-latest
needs: [build]
if: startsWith(github.ref, 'refs/tags/') # not a perfect match but get-type.py takes care of this in job build
strategy:
matrix:
#########################################################
############# BEGIN BLOCK COPIED FROM ABOVE #############
#########################################################
platform_short: [lin, mac, win]
toolset_short: [gcc, msvc, mingw]
machine_short: [x86_64, i686]
static_dynamic: [static, dynamic]
exclude:
- toolset_short: mingw
- machine_short: i686
platform_short: lin
- machine_short: i686
platform_short: mac
- toolset_short: msvc
platform_short: lin
- toolset_short: msvc
platform_short: mac
- toolset_short: gcc
platform_short: win
#########################################################
############## END BLOCK COPIED FROM ABOVE ##############
#########################################################
- static_dynamic: dynamic
include:
- platform_short: lin
suffix: ''
- platform_short: mac
suffix: ''
- platform_short: win
suffix: '.exe'
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- id: get_type
run: python ./.github/get-type.py ${{ github.ref }}
- uses: actions/download-artifact@v1
with:
name: powder-${{ steps.get_type.outputs.NAME }}-${{ matrix.machine_short }}-${{ matrix.platform_short }}-${{ matrix.toolset_short }}-${{ matrix.static_dynamic }}${{ matrix.suffix }}
- run: sudo apt update && sudo apt install lftp
- if: steps.get_type.outputs.TYPE != 'dev' && matrix.static_dynamic == 'static'
run: bash -c 'STARCATCHER_PUBLISH_HOSTPORT=${{ secrets.STARCATCHER_PUBLISH_HOSTPORT }} STARCATCHER_PUBLISH_USERNAME=${{ secrets.STARCATCHER_PUBLISH_USERNAME }} STARCATCHER_PUBLISH_PASSWORD=${{ secrets.STARCATCHER_PUBLISH_PASSWORD }} STARCATCHER_PUBLISH_FILENAME=powder-${{ steps.get_type.outputs.NAME }}-${{ matrix.machine_short }}-${{ matrix.platform_short }}-${{ matrix.toolset_short }}-${{ matrix.static_dynamic }}${{ matrix.suffix }} ./.github/starcatcher-publish.sh powder${{ matrix.suffix }}'
starcatcher-release:
runs-on: ubuntu-latest
needs: [starcatcher-upload]
if: startsWith(github.ref, 'refs/tags/') # not a perfect match but get-type.py takes care of this in job build
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- id: get_type
run: python ./.github/get-type.py ${{ github.ref }}
- run: curl "https://starcatcher.us/TPT/perform-release.lua?mod=${{ steps.get_type.outputs.MOD_ID }}&type=${{ steps.get_type.outputs.TYPE }}&name=${{ steps.get_type.outputs.NAME }}"