The-Powder-Toy/.github/workflows/build.yaml

198 lines
8.4 KiB
YAML
Raw Normal View History

2019-12-17 08:03:41 -06:00
name: build
on:
push:
branches:
- '*'
tags:
- 'v*.*'
- 'snapshot-*'
pull_request:
branches:
- '*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.8'
2019-12-17 08:03:41 -06:00
- id: get_type
run: python3 ./.github/get-type.py ${{ github.ref }}
2019-12-17 08:03:41 -06:00
- id: create_release
if: steps.get_type.outputs.TYPE != 'dev'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ steps.get_type.outputs.NAME }}
draft: true
prerelease: false
- run: echo "${{ steps.create_release.outputs.upload_url }}" > release_url.txt
- uses: actions/upload-artifact@v1
with:
name: release_url
path: release_url.txt
build:
runs-on: ${{ matrix.os }}
needs: [release]
strategy:
matrix:
2021-03-12 14:02:02 -06:00
# | lin-x86_64 | mac-x86_64 | win-x86_64 | lin-i686 | mac-i686 | win-i686 |
# --------------+------------+------------+------------+------------+------------+------------+
# gcc-static | | | NO | NO | NO | NO |
# msvc-static | NO | NO | | NO | NO | |
# mingw-static | NO | NO | NO | NO | NO | NO [1] |
# gcc-dynamic | | | NO | NO | NO | NO |
# msvc-dynamic | 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.
# Please keep this matrix in sync with the other one in this file, see the ### blocks.
#########################################################
############# BEGIN BLOCK FOR COPYING BELOW #############
#########################################################
2019-12-17 08:03:41 -06:00
platform_short: [lin, mac, win]
2021-03-12 14:02:02 -06:00
toolset_short: [gcc, msvc, mingw]
machine_short: [x86_64, i686]
2019-12-17 08:03:41 -06:00
static_dynamic: [static, dynamic]
2021-03-12 14:02:02 -06:00
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 FOR COPYING BELOW ##############
#########################################################
2019-12-17 08:03:41 -06:00
include:
- platform_short: lin
os: ubuntu-latest
suffix: ''
2019-12-17 08:03:41 -06:00
- platform_short: mac
os: macos-latest
suffix: ''
2019-12-17 08:03:41 -06:00
- platform_short: win
os: windows-latest
suffix: '.exe'
2019-12-17 08:03:41 -06:00
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.8'
2019-12-17 08:03:41 -06:00
- id: get_type
run: python3 ./.github/get-type.py ${{ github.ref }}
2019-12-17 08:03:41 -06:00
- uses: actions/download-artifact@v1
with:
name: release_url
- id: get_release_info
if: steps.get_type.outputs.TYPE != 'dev'
run: bash -c "./.github/get-release-info.sh" ## gg github, this is terrible
- if: matrix.platform_short == 'mac'
uses: Homebrew/actions/setup-homebrew@master
2019-12-17 08:03:41 -06:00
- if: matrix.platform_short == 'mac'
run: brew install pkg-config
- if: matrix.platform_short == 'mac' && matrix.static_dynamic != 'static'
run: brew install luajit curl fftw zlib sdl2
- 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: python3 -m pip install meson ninja
2021-04-16 14:02:00 -05:00
- run: bash -c './.github/build.sh'
env:
PLATFORM_SHORT: ${{ matrix.platform_short }}
MACHINE_SHORT: ${{ matrix.machine_short }}
TOOLSET_SHORT: ${{ matrix.toolset_short }}
STATIC_DYNAMIC: ${{ matrix.static_dynamic }}
RELNAME: ${{ steps.get_type.outputs.NAME }}
RELTYPE: ${{ steps.get_type.outputs.TYPE }}
2021-04-16 14:02:00 -05:00
MOD_ID: ${{ steps.get_type.outputs.MOD_ID }}
2019-12-17 08:03:41 -06:00
- uses: actions/upload-release-asset@v1
if: steps.get_type.outputs.TYPE != 'dev' && matrix.static_dynamic == 'static'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
asset_path: powder${{ matrix.suffix }}
2021-03-12 14:02:02 -06:00
asset_name: powder-${{ steps.get_type.outputs.NAME }}-${{ matrix.machine_short }}-${{ matrix.platform_short }}-${{ matrix.toolset_short }}-${{ matrix.static_dynamic }}${{ matrix.suffix }}
2019-12-17 08:03:41 -06:00
asset_content_type: application/zip
- uses: actions/upload-artifact@v2
if: matrix.static_dynamic == 'static'
2019-12-17 08:03:41 -06:00
with:
path: powder${{ matrix.suffix }}
2021-03-12 14:02:02 -06:00
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
with:
python-version: '3.8'
- id: get_type
run: python3 ./.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'
2021-04-16 14:02:00 -05:00
run: bash -c './.github/starcatcher-publish.sh powder${{ matrix.suffix }}'
env:
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 }}
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
with:
python-version: '3.8'
- id: get_type
run: python3 ./.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 }}&commit=${{ github.sha }}" | grep "Release complete"