summaryrefslogtreecommitdiff
path: root/.github/workflows
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/build-all-versions.yml95
-rw-r--r--.github/workflows/build-binary-packages.yml185
-rw-r--r--.github/workflows/build-python-package.yml98
3 files changed, 378 insertions, 0 deletions
diff --git a/.github/workflows/build-all-versions.yml b/.github/workflows/build-all-versions.yml
new file mode 100644
index 000000000..fca637189
--- /dev/null
+++ b/.github/workflows/build-all-versions.yml
@@ -0,0 +1,95 @@
+# Based on the template here: https://kodimensional.dev/github-actions
+name: Build with stack and cabal
+
+# Trigger the workflow on push or pull request, but only for the master branch
+on:
+ pull_request:
+ push:
+ branches: [master]
+
+jobs:
+ cabal:
+ name: ${{ matrix.os }} / ghc ${{ matrix.ghc }}
+ runs-on: ${{ matrix.os }}
+ strategy:
+ matrix:
+ os: [ubuntu-latest, macos-latest, windows-latest]
+ cabal: ["3.2"]
+ ghc:
+ - "8.6.5"
+ - "8.8.3"
+ - "8.10.1"
+ exclude:
+ - os: macos-latest
+ ghc: 8.8.3
+ - os: macos-latest
+ ghc: 8.6.5
+ - os: windows-latest
+ ghc: 8.8.3
+ - os: windows-latest
+ ghc: 8.6.5
+
+ steps:
+ - uses: actions/checkout@v2
+ if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master'
+
+ - uses: actions/setup-haskell@v1.1.4
+ id: setup-haskell-cabal
+ name: Setup Haskell
+ with:
+ ghc-version: ${{ matrix.ghc }}
+ cabal-version: ${{ matrix.cabal }}
+
+ - name: Freeze
+ run: |
+ cabal freeze
+
+ - uses: actions/cache@v1
+ name: Cache ~/.cabal/store
+ with:
+ path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
+ key: ${{ runner.os }}-${{ matrix.ghc }}
+ # key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
+
+ - name: Build
+ run: |
+ cabal configure --enable-tests --enable-benchmarks --test-show-details=direct
+ cabal build all
+
+ # - name: Test
+ # run: |
+ # cabal test all
+
+ stack:
+ name: stack / ghc ${{ matrix.ghc }}
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ stack: ["2.3.3"]
+ ghc: ["7.10.3","8.0.2", "8.2.2", "8.4.4", "8.6.5", "8.8.4"]
+ # ghc: ["8.8.3"]
+
+ steps:
+ - uses: actions/checkout@v2
+ if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master'
+
+ - uses: actions/setup-haskell@v1.1.4
+ name: Setup Haskell Stack
+ with:
+ # ghc-version: ${{ matrix.ghc }}
+ stack-version: ${{ matrix.stack }}
+
+ - uses: actions/cache@v1
+ name: Cache ~/.stack
+ with:
+ path: ~/.stack
+ key: ${{ runner.os }}-${{ matrix.ghc }}-stack
+
+ - name: Build
+ run: |
+ stack build --system-ghc --stack-yaml stack-ghc${{ matrix.ghc }}.yaml
+ # stack build --system-ghc --test --bench --no-run-tests --no-run-benchmarks
+
+ - name: Test
+ run: |
+ stack test --system-ghc --stack-yaml stack-ghc${{ matrix.ghc }}.yaml
diff --git a/.github/workflows/build-binary-packages.yml b/.github/workflows/build-binary-packages.yml
new file mode 100644
index 000000000..810fa1352
--- /dev/null
+++ b/.github/workflows/build-binary-packages.yml
@@ -0,0 +1,185 @@
+name: Build Binary Packages
+
+on:
+ workflow_dispatch:
+ release:
+
+jobs:
+
+# ---
+
+ ubuntu:
+ name: Build Ubuntu package
+ runs-on: ubuntu-18.04
+ # strategy:
+ # matrix:
+ # ghc: ["8.6.5"]
+ # cabal: ["2.4"]
+
+ steps:
+ - uses: actions/checkout@v2
+
+ # Note: `haskell-platform` is listed as requirement in debian/control,
+ # which is why it's installed using apt instead of the Setup Haskell action.
+
+ # - name: Setup Haskell
+ # uses: actions/setup-haskell@v1
+ # id: setup-haskell-cabal
+ # with:
+ # ghc-version: ${{ matrix.ghc }}
+ # cabal-version: ${{ matrix.cabal }}
+
+ - name: Install build tools
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y \
+ make \
+ dpkg-dev \
+ debhelper \
+ haskell-platform \
+ libghc-json-dev \
+ python-dev \
+ default-jdk \
+ libtool-bin
+
+ - name: Build package
+ run: |
+ make deb
+
+ - name: Copy package
+ run: |
+ cp ../gf_*.deb dist/
+
+ - name: Upload artifact
+ uses: actions/upload-artifact@v2
+ with:
+ name: gf-${{ github.sha }}-ubuntu
+ path: dist/gf_*.deb
+ if-no-files-found: error
+
+# ---
+
+ macos:
+ name: Build macOS package
+ runs-on: macos-10.15
+ strategy:
+ matrix:
+ ghc: ["8.6.5"]
+ cabal: ["2.4"]
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Setup Haskell
+ uses: actions/setup-haskell@v1
+ id: setup-haskell-cabal
+ with:
+ ghc-version: ${{ matrix.ghc }}
+ cabal-version: ${{ matrix.cabal }}
+
+ - name: Install build tools
+ run: |
+ brew install \
+ automake
+ cabal v1-install alex happy
+
+ - name: Build package
+ run: |
+ sudo mkdir -p /Library/Java/Home
+ sudo ln -s /usr/local/opt/openjdk/include /Library/Java/Home/include
+ make pkg
+
+ - name: Upload artifact
+ uses: actions/upload-artifact@v2
+ with:
+ name: gf-${{ github.sha }}-macos
+ path: dist/gf-*.pkg
+ if-no-files-found: error
+
+# ---
+
+ windows:
+ name: Build Windows package
+ runs-on: windows-2019
+ strategy:
+ matrix:
+ ghc: ["8.6.5"]
+ cabal: ["2.4"]
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Setup MSYS2
+ uses: msys2/setup-msys2@v2
+ with:
+ install: >-
+ base-devel
+ gcc
+ python-devel
+
+ - name: Prepare dist folder
+ shell: msys2 {0}
+ run: |
+ mkdir /c/tmp-dist
+ mkdir /c/tmp-dist/c
+ mkdir /c/tmp-dist/java
+ mkdir /c/tmp-dist/python
+
+ - name: Build C runtime
+ shell: msys2 {0}
+ run: |
+ cd src/runtime/c
+ autoreconf -i
+ ./configure
+ make
+ make install
+ cp /mingw64/bin/libpgf-0.dll /c/tmp-dist/c
+ cp /mingw64/bin/libgu-0.dll /c/tmp-dist/c
+
+ - name: Build Java bindings
+ shell: msys2 {0}
+ run: |
+ export PATH="${PATH}:/c/Program Files/Java/jdk8u275-b01/bin"
+ cd src/runtime/java
+ make \
+ JNI_INCLUDES="-I \"/c/Program Files/Java/jdk8u275-b01/include\" -I \"/c/Program Files/Java/jdk8u275-b01/include/win32\" -I \"/mingw64/include\" -D__int64=int64_t" \
+ WINDOWS_LDFLAGS="-L\"/mingw64/lib\" -no-undefined"
+ make install
+ cp .libs//msys-jpgf-0.dll /c/tmp-dist/java/jpgf.dll
+ cp jpgf.jar /c/tmp-dist/java
+
+ - name: Build Python bindings
+ shell: msys2 {0}
+ env:
+ EXTRA_INCLUDE_DIRS: /mingw64/include
+ EXTRA_LIB_DIRS: /mingw64/lib
+ run: |
+ cd src/runtime/python
+ python setup.py build
+ python setup.py install
+ cp /usr/lib/python3.8/site-packages/pgf* /c/tmp-dist/python
+
+ - name: Setup Haskell
+ uses: actions/setup-haskell@v1
+ id: setup-haskell-cabal
+ with:
+ ghc-version: ${{ matrix.ghc }}
+ cabal-version: ${{ matrix.cabal }}
+
+ - name: Install Haskell build tools
+ run: |
+ cabal install alex happy
+
+ - name: Build GF
+ run: |
+ cabal install --only-dependencies -fserver
+ cabal configure -fserver
+ cabal build
+ copy dist\build\gf\gf.exe C:\tmp-dist
+
+ - name: Upload artifact
+ uses: actions/upload-artifact@v2
+ with:
+ name: gf-${{ github.sha }}-windows
+ path: C:\tmp-dist\*
+ if-no-files-found: error
diff --git a/.github/workflows/build-python-package.yml b/.github/workflows/build-python-package.yml
new file mode 100644
index 000000000..67cbba6dd
--- /dev/null
+++ b/.github/workflows/build-python-package.yml
@@ -0,0 +1,98 @@
+name: Build & Publish Python Package
+
+# Trigger the workflow on push or pull request, but only for the master branch
+on:
+ pull_request:
+ push:
+ branches: [master]
+
+jobs:
+ build_wheels:
+ name: Build wheel on ${{ matrix.os }}
+ runs-on: ${{ matrix.os }}
+ strategy:
+ fail-fast: true
+ matrix:
+ os: [ubuntu-18.04, macos-10.15]
+
+ steps:
+ - uses: actions/checkout@v1
+
+ - uses: actions/setup-python@v1
+ name: Install Python
+ with:
+ python-version: '3.7'
+
+ - name: Install cibuildwheel
+ run: |
+ python -m pip install git+https://github.com/joerick/cibuildwheel.git@main
+
+ - name: Install build tools for OSX
+ if: startsWith(matrix.os, 'macos')
+ run: |
+ brew install automake
+
+ - name: Build wheels on Linux
+ if: startsWith(matrix.os, 'macos') != true
+ env:
+ CIBW_BEFORE_BUILD: cd src/runtime/c && autoreconf -i && ./configure && make && make install
+ run: |
+ python -m cibuildwheel src/runtime/python --output-dir wheelhouse
+
+ - name: Build wheels on OSX
+ if: startsWith(matrix.os, 'macos')
+ env:
+ CIBW_BEFORE_BUILD: cd src/runtime/c && glibtoolize && autoreconf -i && ./configure && make && make install
+ run: |
+ python -m cibuildwheel src/runtime/python --output-dir wheelhouse
+
+ - uses: actions/upload-artifact@v2
+ with:
+ path: ./wheelhouse
+
+ build_sdist:
+ name: Build source distribution
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+
+ - uses: actions/setup-python@v2
+ name: Install Python
+ with:
+ python-version: '3.7'
+
+ - name: Build sdist
+ run: cd src/runtime/python && python setup.py sdist
+
+ - uses: actions/upload-artifact@v2
+ with:
+ path: ./src/runtime/python/dist/*.tar.gz
+
+ upload_pypi:
+ name: Upload to PyPI
+ needs: [build_wheels, build_sdist]
+ runs-on: ubuntu-latest
+ if: github.ref == 'refs/heads/master' && github.event_name == 'push'
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Set up Python
+ uses: actions/setup-python@v2
+ with:
+ python-version: '3.x'
+
+ - name: Install twine
+ run: pip install twine
+
+ - uses: actions/download-artifact@v2
+ with:
+ name: artifact
+ path: ./dist
+
+ - name: Publish
+ env:
+ TWINE_USERNAME: __token__
+ TWINE_PASSWORD: ${{ secrets.pypi_password }}
+ run: |
+ (cd ./src/runtime/python && curl -I --fail https://pypi.org/project/$(python setup.py --name)/$(python setup.py --version)/) || twine upload dist/*