GitHub Actions: Update actions #449
Workflow file for this run
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, 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.4.5' | |
os: ubuntu-latest | |
stack_yaml: 'stack-ghc-9.4.yaml' | |
stack_args: '--haddock --no-haddock-deps' | |
flags: '--flag toysolver:BuildToyFMF --flag toysolver:BuildSamplePrograms --flag toysolver:BuildMiscPrograms' | |
platform: linux-x86_64 | |
coveralls: false | |
- ghc: '9.2.8' | |
os: ubuntu-latest | |
stack_yaml: 'stack-ghc-9.2.yaml' | |
stack_args: '--haddock --no-haddock-deps' | |
flags: '--flag toysolver:BuildToyFMF --flag toysolver:BuildSamplePrograms --flag toysolver:BuildMiscPrograms' | |
platform: linux-x86_64 | |
coveralls: false | |
- ghc: '9.0.2' | |
os: ubuntu-latest | |
stack_yaml: 'stack-ghc-9.0.yaml' | |
stack_args: '--haddock --no-haddock-deps' | |
flags: '--flag toysolver:BuildToyFMF --flag toysolver:BuildSamplePrograms --flag toysolver:BuildMiscPrograms' | |
platform: linux-x86_64 | |
release: true | |
- ghc: '9.0.2' | |
os: macos-13 # Intel Mac | |
stack_yaml: 'stack-ghc-9.0.yaml' | |
stack_args: '' | |
flags: '--flag toysolver:BuildToyFMF --flag toysolver:BuildSamplePrograms --flag toysolver:BuildMiscPrograms' | |
platform: macos | |
coveralls: false | |
release: true | |
# 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 . | |
- 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 | |
coveralls: false | |
release: true | |
- ghc: '8.8.4' | |
os: ubuntu-latest | |
stack_yaml: 'stack-ghc-8.8.yaml' | |
stack_args: '--coverage' | |
flags: '--flag toysolver:BuildToyFMF --flag toysolver:BuildSamplePrograms --flag toysolver:BuildMiscPrograms' | |
platform: linux-x86_64 | |
coveralls: true | |
- 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 | |
coveralls: false | |
release: true | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- 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: true | |
stack-setup-ghc: 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 }}-stack | |
# 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: | | |
stack exec -- g++ -Wall -Iapp/toysat-ipasir/ misc/genipaessentials/genipaessentials.cpp -L`stack path --local-install-root`/lib -ltoysat-ipasir -o genipaessentials | |
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/lehins/stack-hpc-coveralls/releases/download/v0.0.6.0/shc.tar.gz | tar -xz | |
./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 | |
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 | |
assets=() | |
for asset in binary-packages/*; do | |
assets+=("-a" "$asset") | |
done | |
tag_name="${GITHUB_REF#refs/tags/}" | |
hub release create "${assets[@]}" -d -m "$tag_name" "$tag_name" |