bygfoot/.github/workflows/package.yml

162 lines
5.0 KiB
YAML

name: Package bygfoot
on:
push:
tags:
- '*'
branches:
- unofficial-trunk
pull_request:
env:
BYGFOOT_VERSION: "2.3.3-unofficial-git-${{ github.sha }}"
UBUNTU_BUILD_DEPENDENCIES: libglib2.0-dev libgtk2.0-dev libpango1.0-dev libatk1.0-dev libfreetype6-dev ninja-build cmake libjson-c-dev unzip
LINUX_BUILD_DEPENDENCIES: libglib2.0-dev libgtk2.0-dev libpango1.0-dev libatk1.0-dev libfreetype6-dev ninja-build cmake
jobs:
package-linux:
runs-on:
- ubuntu-latest
container:
image: ${{ matrix.container-image }}
strategy:
fail-fast: false
matrix:
include:
- name: ubuntu-16.04
container-image: docker.io/ubuntu:16.04
dependencies: "$UBUNTU_BUILD_DEPENDENCIES"
test: true
- name: ubuntu-18.04
container-image: docker.io/ubuntu:18.04
dependencies: "$UBUNTU_BUILD_DEPENDENCIES"
test: true
- name: ubuntu-20.04
container-image: docker.io/ubuntu:20.04
dependencies: "$UBUNTU_BUILD_DEPENDENCIES"
test: true
- name: ubuntu-20.10
container-image: docker.io/ubuntu:20.10
dependencies: "$UBUNTU_BUILD_DEPENDENCIES"
test: true
- name: ubuntu-21.04
container-image: docker.io/ubuntu:21.04
dependencies: "$UBUNTU_BUILD_DEPENDENCIES"
test: true
- name: linux
container-image: docker.io/ubuntu:16.04
dependencies: "$LINUX_BUILD_DEPENDENCIES"
test: false
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install dependencies
env:
DEBIAN_FRONTEND: noninteractive
run: |
apt-get update
apt-get -y install ${{ matrix.dependencies }}
- name: Package Bygfoot
run: ./scripts/package.sh .
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: "bygfoot-${{ env.BYGFOOT_VERSION }}-${{ matrix.name }}"
path: "*.bz2"
- uses: actions/download-artifact@v2
if: ${{ github.event_name == 'pull_request' && matrix.test }}
with:
path: tests-${{ matrix.name }}
name: "bygfoot-${{ env.BYGFOOT_VERSION }}-${{ matrix.name }}"
- name: Run Tests
if: ${{ github.event_name == 'pull_request' && matrix.test }}
working-directory: tests-${{ matrix.name }}
run: |
tar -xjf bygfoot-${{ env.BYGFOOT_VERSION }}.tar.bz2
bash ../test/test-load-save.sh ./bygfoot-${{ env.BYGFOOT_VERSION }}/bygfoot
bash ../test/test-country-defs.sh ./bygfoot-${{ env.BYGFOOT_VERSION }}/bygfoot || true
package-windows:
runs-on:
- windows-2016
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install ninja
run: pip install ninja
- name: Download dependencies
run: |
curl -O -L https://download.gnome.org/binaries/win64/gtk+/2.22/gtk+-bundle_2.22.1-20101229_win64.zip
unzip gtk+-bundle_2.22.1-20101229_win64.zip
shell: bash
- name: Copy dependencies intall package directory
shell: bash
run: |
mkdir -p bygfoot-$BYGFOOT_VERSION
cp bin/*.dll bygfoot-$BYGFOOT_VERSION
cp ./share/doc/gtk+-2.22.1/COPYING bygfoot-$BYGFOOT_VERSION/COPYING.gtk+
cp ./share/doc/glib-2.26.1/COPYING bygfoot-$BYGFOOT_VERSION/COPYING.glib
- name: Package Bygfoot
env:
CC: gcc
CXX: g++
PkgConfig_DIR: ./
run: |
export PKG_CONFIG=`pwd`/bin/pkg-config.exe
# Add gtk+ directory to PATH so that cmake can find the correct zlib
# library.
export PATH=`pwd`/bin:$PATH
./scripts/package.sh .
shell: bash
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: "bygfoot-${{ env.BYGFOOT_VERSION }}-win64"
path: "*.bz2"
create_release:
if: ${{ startswith(github.ref, 'refs/tags') }}
runs-on: ubuntu-latest
needs:
- package-linux
- package-windows
steps:
- name: Download artifacts
uses: actions/download-artifact@v2
with:
path: 'artifacts'
- name: Install Dependencies
run: pip install PyGithub
- name: Create Release
shell: python
run: |
import github
import os
prerelease = False
tag = '${{ github.ref }}'.split('/')[-1]
if 'alpha' in tag or 'beta' in tag or 'rc' in tag:
prerelease = True
context = github.Github('${{ github.token }}')
repo = context.get_repo('${{ github.repository }}')
release = repo.create_git_release(tag = tag, name = tag, message = tag,
prerelease = prerelease)
for dir in os.listdir('artifacts'):
for f in oslistdir(dir):
release.upload_asset(f)