2020-10-19 07:10:59 +02:00
|
|
|
name: Package bygfoot
|
|
|
|
|
2021-03-05 03:56:53 +01:00
|
|
|
on:
|
|
|
|
push:
|
2021-03-20 16:31:47 +01:00
|
|
|
tags:
|
|
|
|
- '*'
|
|
|
|
branches:
|
|
|
|
- unofficial-trunk
|
2021-03-05 03:56:53 +01:00
|
|
|
pull_request:
|
2020-10-19 07:10:59 +02:00
|
|
|
|
|
|
|
env:
|
2021-06-06 07:33:36 +02:00
|
|
|
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
|
2020-10-19 07:10:59 +02:00
|
|
|
|
|
|
|
jobs:
|
2021-06-06 07:33:36 +02:00
|
|
|
|
|
|
|
set-variables:
|
|
|
|
runs-on:
|
|
|
|
- ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
is-tag: ${{ steps.vars.outputs.is-tag }}
|
|
|
|
bygfoot-version: ${{ steps.vars.outputs.bygfoot-version }}
|
|
|
|
steps:
|
|
|
|
- id: vars
|
|
|
|
run: |
|
|
|
|
if echo ${{ github.ref }} | grep '^refs/tags'; then
|
|
|
|
is_tag=1
|
|
|
|
bygfoot_version=`echo ${{ github.ref }} | cut -d / -f 3`
|
|
|
|
else
|
|
|
|
is_tag=0
|
|
|
|
bygfoot_version=${{ github.head_ref }}-${{ github.sha }}
|
|
|
|
fi
|
|
|
|
|
|
|
|
tarname=bygfoot-$bygfoot_version-${{ matrix.name }}
|
|
|
|
echo "::set-output name=is-tag::$is_tag"
|
|
|
|
echo "::set-output name=bygfoot-version::$bygfoot_version"
|
|
|
|
|
2020-10-19 07:10:59 +02:00
|
|
|
package-linux:
|
2021-06-06 07:33:36 +02:00
|
|
|
needs:
|
|
|
|
- set-variables
|
2020-10-19 07:10:59 +02:00
|
|
|
runs-on:
|
2021-06-06 07:33:36 +02:00
|
|
|
- ubuntu-latest
|
|
|
|
container:
|
|
|
|
image: ${{ matrix.container-image }}
|
|
|
|
env:
|
|
|
|
BYGFOOT_VERSION: ${{ needs.set-variables.outputs.bygfoot-version }}
|
2020-12-24 02:36:49 +01:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
include:
|
2021-06-06 07:33:36 +02:00
|
|
|
- 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
|
2020-12-24 02:36:49 +01:00
|
|
|
|
2020-10-19 07:10:59 +02:00
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Install dependencies
|
2021-06-06 07:33:36 +02:00
|
|
|
env:
|
|
|
|
DEBIAN_FRONTEND: noninteractive
|
|
|
|
run: |
|
|
|
|
apt-get update
|
|
|
|
apt-get -y install ${{ matrix.dependencies }}
|
2020-12-24 02:36:49 +01:00
|
|
|
|
2020-10-19 07:10:59 +02:00
|
|
|
- name: Package Bygfoot
|
2021-06-06 07:33:36 +02:00
|
|
|
id: package
|
|
|
|
run: |
|
|
|
|
tarname=bygfoot-${{ env.BYGFOOT_VERSION }}-${{ matrix.name }}
|
|
|
|
echo "::set-output name=tardir::$tarname"
|
|
|
|
echo "::set-output name=tarfile::$tarname.tar.bz2"
|
|
|
|
./scripts/package.sh . $tarname
|
2020-10-19 07:10:59 +02:00
|
|
|
|
|
|
|
- name: Upload artifact
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
2021-06-06 07:33:36 +02:00
|
|
|
name: "bygfoot-${{ env.BYGFOOT_VERSION }}-${{ matrix.name }}"
|
|
|
|
path: "${{ steps.package.outputs.tarfile }}"
|
2021-03-05 03:56:53 +01:00
|
|
|
|
|
|
|
- uses: actions/download-artifact@v2
|
2021-06-06 07:33:36 +02:00
|
|
|
if: ${{ github.event_name == 'pull_request' && matrix.test }}
|
2021-03-05 03:56:53 +01:00
|
|
|
with:
|
2021-06-06 07:33:36 +02:00
|
|
|
path: tests-${{ matrix.name }}
|
|
|
|
name: "bygfoot-${{ env.BYGFOOT_VERSION }}-${{ matrix.name }}"
|
2021-03-05 03:56:53 +01:00
|
|
|
|
|
|
|
- name: Run Tests
|
2021-06-06 07:33:36 +02:00
|
|
|
if: ${{ github.event_name == 'pull_request' && matrix.test }}
|
|
|
|
working-directory: tests-${{ matrix.name }}
|
2021-03-05 03:56:53 +01:00
|
|
|
run: |
|
2021-06-06 07:33:36 +02:00
|
|
|
tar -xjf ${{ steps.package.outputs.tarfile }}
|
|
|
|
bash ../test/test-load-save.sh ${{ steps.package.outputs.tardir }}/bygfoot
|
|
|
|
bash ../test/test-country-defs.sh ${{ steps.package.outputs.tardir }}/bygfoot || true
|
2021-03-05 03:56:53 +01:00
|
|
|
|
|
|
|
|
2020-11-10 06:47:19 +01:00
|
|
|
package-windows:
|
2021-06-06 07:33:36 +02:00
|
|
|
needs:
|
|
|
|
- set-variables
|
2020-11-10 06:47:19 +01:00
|
|
|
runs-on:
|
|
|
|
- windows-2016
|
2021-06-06 07:33:36 +02:00
|
|
|
env:
|
|
|
|
BYGFOOT_VERSION: ${{ needs.set-variables.outputs.bygfoot-version }}
|
2020-11-10 06:47:19 +01:00
|
|
|
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: |
|
2021-03-05 20:57:24 +01:00
|
|
|
export PKG_CONFIG=`pwd`/bin/pkg-config.exe
|
2021-03-06 06:11:14 +01:00
|
|
|
# Add gtk+ directory to PATH so that cmake can find the correct zlib
|
|
|
|
# library.
|
|
|
|
export PATH=`pwd`/bin:$PATH
|
2021-06-06 07:33:36 +02:00
|
|
|
./scripts/package.sh . bygfoot-${{ env.BYGFOOT_VERSION }}-win64
|
2020-11-10 06:47:19 +01:00
|
|
|
shell: bash
|
|
|
|
|
|
|
|
- name: Upload artifact
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: "bygfoot-${{ env.BYGFOOT_VERSION }}-win64"
|
2020-10-19 07:10:59 +02:00
|
|
|
path: "*.bz2"
|
2021-06-06 07:33:36 +02:00
|
|
|
|
|
|
|
create_release:
|
|
|
|
if: ${{ startswith(github.ref, 'refs/tags') }}
|
|
|
|
needs:
|
|
|
|
- package-linux
|
|
|
|
- package-windows
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
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'):
|
|
|
|
print(dir)
|
|
|
|
for f in os.listdir('artifacts' + '/' + dir):
|
|
|
|
print(f)
|
|
|
|
release.upload_asset('artifacts' + '/' + dir + '/' + f)
|