Merge pull request #117 from msakai/update-coveralls-and-haddock #496
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: | |
- master | |
tags: | |
- '*' | |
pull_request: | |
name: build | |
jobs: | |
build: | |
name: build | |
runs-on: ${{ matrix.os }} | |
env: | |
STACK_YAML: ${{ matrix.stack_yaml }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- ghc: '9.8.2' | |
os: ubuntu-latest | |
stack_yaml: 'stack-ghc-9.8.yaml' | |
stack_args: '' | |
flags: '--flag toysolver:BuildToyFMF --flag toysolver:BuildSamplePrograms --flag toysolver:BuildMiscPrograms --flag toysolver:optparse-applicative-018' | |
platform: linux-x86_64 | |
- ghc: '9.6.6' | |
os: ubuntu-latest | |
stack_yaml: 'stack-ghc-9.6.yaml' | |
stack_args: '--haddock --no-haddock-deps' | |
flags: '--flag toysolver:BuildToyFMF --flag toysolver:BuildSamplePrograms --flag toysolver:BuildMiscPrograms --flag toysolver:optparse-applicative-018' | |
platform: linux-x86_64 | |
release: true | |
- ghc: '9.6.6' | |
os: macos-latest | |
stack_yaml: 'stack-ghc-9.6.yaml' | |
stack_args: '' | |
flags: '--flag toysolver:BuildToyFMF --flag toysolver:BuildSamplePrograms --flag toysolver:BuildMiscPrograms --flag toysolver:optparse-applicative-018' | |
platform: macos-aarch64 | |
release: true | |
- ghc: '9.6.6' | |
os: macos-latest | |
stack_yaml: 'stack-ghc-9.6.yaml' | |
stack_args: '' | |
flags: '--flag toysolver:BuildToyFMF --flag toysolver:BuildSamplePrograms --flag toysolver:BuildMiscPrograms --flag toysolver:optparse-applicative-018' | |
platform: macos-x86_64 | |
release: true | |
- ghc: '9.4.8' | |
os: ubuntu-latest | |
stack_yaml: 'stack-ghc-9.4.yaml' | |
stack_args: '--coverage' | |
flags: '--flag toysolver:BuildToyFMF --flag toysolver:BuildSamplePrograms --flag toysolver:BuildMiscPrograms' | |
platform: linux-x86_64 | |
coveralls: true | |
- ghc: '9.2.8' | |
os: ubuntu-latest | |
stack_yaml: 'stack-ghc-9.2.yaml' | |
stack_args: '' | |
flags: '--flag toysolver:BuildToyFMF --flag toysolver:BuildSamplePrograms --flag toysolver:BuildMiscPrograms' | |
platform: linux-x86_64 | |
- ghc: '9.0.2' | |
os: ubuntu-latest | |
stack_yaml: 'stack-ghc-9.0.yaml' | |
stack_args: '' | |
flags: '--flag toysolver:BuildToyFMF --flag toysolver:BuildSamplePrograms --flag toysolver:BuildMiscPrograms' | |
platform: linux-x86_64 | |
# Current version of stack (2.7.5) cannot build foreign libraries for windows on GHC >=9.0 | |
# We need a stack built with Cabal-3.8.1 which contains the fix https://github.com/haskell/cabal/pull/7764 . | |
# | |
# Also, GHC 9.6.5/Cabal-3.10.3.0 has a different problem regarding foreign libraries for windows | |
# https://github.com/haskell/cabal/issues/9982 | |
- ghc: '8.10.7' | |
os: windows-latest | |
stack_yaml: 'stack-ghc-8.10.yaml' | |
stack_args: '' | |
flags: '--flag toysolver:BuildToyFMF --flag toysolver:BuildSamplePrograms --flag toysolver:BuildMiscPrograms' | |
platform: win64 | |
release: true | |
- ghc: '8.8.4' | |
os: ubuntu-latest | |
stack_yaml: 'stack-ghc-8.8.yaml' | |
stack_args: '' | |
flags: '--flag toysolver:BuildToyFMF --flag toysolver:BuildSamplePrograms --flag toysolver:BuildMiscPrograms' | |
platform: linux-x86_64 | |
- ghc: '8.6.3' | |
os: windows-latest | |
stack_yaml: 'stack-windows-i386.yaml' | |
stack_args: '' | |
flags: '--flag toysolver:BuildToyFMF --flag toysolver:BuildSamplePrograms --flag toysolver:BuildMiscPrograms' | |
platform: win32 | |
release: true | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Write arch to stack.yaml (macos-x86_64) | |
if: matrix.platform == 'macos-x86_64' | |
run: | | |
echo "arch: x86_64" >> ${STACK_YAML} | |
- uses: haskell-actions/setup@v2 | |
id: setup-haskell | |
name: Setup Haskell | |
with: | |
ghc-version: ${{ matrix.ghc }} | |
enable-stack: true | |
stack-version: 'latest' | |
stack-no-global: ${{ (matrix.platform == 'macos-x86_64' || matrix.platform == 'win32') && 'true' || '' }} | |
cabal-update: false | |
- name: Setup stack to use system GHC | |
if: matrix.platform != 'macos-x86_64' && matrix.platform != 'win32' | |
run: stack config set system-ghc --global true | |
#- name: Fix ld path (Windows) | |
# if: runner.os == 'Windows' | |
# run: ruby misc/fix-x86_64-windows-ghc-8.10.2-settings.rb | |
- name: Install packages (Linux) | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install ocl-icd-opencl-dev | |
- uses: actions/cache@v4 | |
name: Cache ~/.stack | |
with: | |
path: ${{ steps.setup-haskell.outputs.stack-root }} | |
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('toysolver.cabal', matrix.stack_yaml) }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.ghc }}- | |
# https://github.com/commercialhaskell/stack/issues/5405 | |
- name: Clear setup-exe-cache directory | |
if: runner.os == 'macOS' | |
continue-on-error: true | |
run: rm -r ~/.stack/setup-exe-cache | |
- name: Build dependencies | |
shell: bash | |
run: stack build --test --no-run-tests --bench --no-run-benchmarks --only-dependencies ${{ matrix.stack_args }} ${{ matrix.flags }} | |
- name: Build | |
shell: bash | |
run: stack build --test --no-run-tests --bench --no-run-benchmarks ${{ matrix.stack_args }} ${{ matrix.flags }} | |
- name: Test | |
shell: bash | |
# -j1 is for https://github.com/commercialhaskell/stack/issues/5024 | |
run: stack test ${{ matrix.stack_args }} -j1 ${{ matrix.flags }} | |
timeout-minutes: 10 | |
- name: Check IPASIR DLL dependencies | |
continue-on-error: true | |
shell: bash | |
run: | | |
if [[ ${{ runner.os }} = "macOS" ]]; then | |
otool -L `stack path --local-install-root`/lib/libtoysat-ipasir.dylib | |
elif [[ ${{ runner.os }} = "Windows" ]]; then | |
ldd `stack path --local-install-root`/lib/toysat-ipasir.dll | |
else | |
ldd `stack path --local-install-root`/lib/libtoysat-ipasir.so | |
fi | |
- name: Test IPASIR DLL using genipaessentials | |
shell: bash | |
run: | | |
if [[ ${{ matrix.platform }} = "macos-x86_64" ]]; then | |
stack exec -- arch -x86_64 g++ -Wall -Iapp/toysat-ipasir/ misc/genipaessentials/genipaessentials.cpp -L`stack path --local-install-root`/lib -ltoysat-ipasir -o genipaessentials | |
else | |
stack exec -- g++ -Wall -Iapp/toysat-ipasir/ misc/genipaessentials/genipaessentials.cpp -L`stack path --local-install-root`/lib -ltoysat-ipasir -o genipaessentials | |
fi | |
if [[ ${{ runner.os }} = "macOS" ]]; then | |
install_name_tool -add_rpath `stack path --local-install-root`/lib genipaessentials | |
elif [[ ${{ runner.os }} = "Windows" ]]; then | |
export PATH=$(cygpath -u $(stack path --local-install-root))/lib:$PATH | |
else | |
export LD_LIBRARY_PATH=`stack path --local-install-root`/lib:$LD_LIBRARY_PATH | |
fi | |
# "stack exec --" is necessary on windows-i386 for adding path of libstdc++ | |
stack exec -- ./genipaessentials misc/genipaessentials/inputs/sat100.cnf | |
- name: Coveralls | |
if: matrix.coveralls | |
continue-on-error: true | |
env: | |
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} | |
run: | | |
curl -L https://github.com/rubik/stack-hpc-coveralls/releases/download/v0.0.7.0/shc-Linux-X64.tar.bz2 | tar -xj | |
./shc --repo-token="$COVERALLS_REPO_TOKEN" toysolver TestSuite TestPolynomial | |
- name: Test scripts | |
shell: bash | |
run: stack runhaskell ${{ matrix.stack_args }} misc/generate_packageVersions.hs > /dev/null | |
- name: Build artifacts | |
id: build-artifact | |
run: stack runhaskell ${{ matrix.stack_args }} --package turtle misc/build_artifacts.hs | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
if: matrix.release | |
with: | |
name: binary-packages-${{ matrix.platform }} | |
path: | | |
*.tar.xz | |
*.7z | |
retention-days: 2 | |
github-release: | |
name: github-release | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags') | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: actions/download-artifact@v4 | |
with: | |
name: binary-packages-linux-x86_64 | |
path: binary-packages | |
- uses: actions/download-artifact@v4 | |
with: | |
name: binary-packages-macos-aarch64 | |
path: binary-packages | |
- uses: actions/download-artifact@v4 | |
with: | |
name: binary-packages-macos-x86_64 | |
path: binary-packages | |
- uses: actions/download-artifact@v4 | |
with: | |
name: binary-packages-win32 | |
path: binary-packages | |
- uses: actions/download-artifact@v4 | |
with: | |
name: binary-packages-win64 | |
path: binary-packages | |
- name: Upload artifacts to GitHub Release | |
shell: bash | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
shopt -s nullglob | |
tag_name="${GITHUB_REF#refs/tags/}" | |
gh release create --draft --title "${tag_name}" "${tag_name}" binary-packages/* |