Some helpers for working with constant expression evaluator #625
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
name: CI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
env: | |
EXE_NAME: fortran-src | |
jobs: | |
ubuntu-stack-test: | |
runs-on: ubuntu-latest | |
name: Ubuntu / Stack / test | |
steps: | |
- uses: actions/checkout@v2 | |
# relative paths are relative to the project directory | |
- name: Cache Stack build artifacts (user + project) | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.stack | |
.stack-work | |
# best effort for cache: tie it to Stack resolver and package config | |
key: ${{ runner.os }}-stack-${{ hashFiles('stack.yaml.lock', 'package.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-stack | |
- name: Install project dependencies | |
run: stack --no-terminal test --only-dependencies | |
- name: Build and run tests | |
run: stack --no-terminal haddock --test --no-haddock-deps | |
- name: Install (to place executable at a known location) | |
run: stack --no-terminal install | |
- name: Upload executable | |
uses: actions/upload-artifact@v2 | |
with: | |
path: ~/.local/bin/${{ env.EXE_NAME }} | |
name: ${{ env.EXE_NAME }}-ubuntu-stack-${{ github.sha }} | |
if-no-files-found: error | |
ubuntu-cabal-test: | |
runs-on: ubuntu-latest | |
name: Ubuntu / GHC ${{ matrix.ghc }}, Cabal / test | |
strategy: | |
fail-fast: false # don't stop if one job (= GHC version) fails | |
matrix: | |
cabal: [latest] | |
ghc: | |
- "9.0" | |
- "9.2" | |
- "9.4" | |
steps: | |
# TODO: GHC decides to recompile based on timestamp, so cache isn't used | |
# Preferably GHC would work via hashes instead. Stack had this feature | |
# merged in Aug 2020. | |
# Upstream GHC issue: https://gitlab.haskell.org/ghc/ghc/-/issues/16495 | |
# My issue on haskell/actions: https://github.com/haskell/actions/issues/41 | |
# This also requires us to do a deep fetch, else we don't get the Git commit | |
# history we need to rewrite mod times. | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Set all tracked file modification times to the time of their last commit | |
run: | | |
rev=HEAD | |
for f in $(git ls-tree -r -t --full-name --name-only "$rev") ; do | |
touch -d $(git log --pretty=format:%cI -1 "$rev" -- "$f") "$f"; | |
done | |
- name: Setup Haskell build environment | |
id: setup-haskell-build-env | |
uses: haskell/actions/setup@v2 | |
with: | |
ghc-version: ${{ matrix.ghc }} | |
cabal-version: ${{ matrix.cabal }} | |
- run: cabal freeze | |
- name: Cache Cabal build artifacts | |
uses: actions/cache@v2 | |
with: | |
path: | | |
${{ steps.setup-haskell-build-env.outputs.cabal-store }} | |
dist-newstyle | |
key: ${{ runner.os }}-cabal-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }} | |
restore-keys: | | |
${{ runner.os }}-cabal-${{ matrix.ghc }} | |
- name: Test | |
run: cabal test --test-show-details=streaming | |
env: | |
HSPEC_OPTIONS: --color | |
mac-cabal-test: | |
runs-on: macos-latest | |
name: Mac / GHC ${{ matrix.ghc }}, Cabal / test | |
strategy: | |
fail-fast: false # don't stop if one job (= GHC version) fails | |
matrix: | |
cabal: [latest] | |
ghc: ["9.2"] | |
steps: | |
# TODO figure out timestamp fixer on Mac (no Mac available to test) | |
- uses: actions/checkout@v2 | |
- name: Setup Haskell build environment | |
id: setup-haskell-build-env | |
uses: haskell/actions/setup@v2 | |
with: | |
ghc-version: ${{ matrix.ghc }} | |
cabal-version: ${{ matrix.cabal }} | |
- run: cabal freeze | |
- name: Cache Cabal build artifacts | |
uses: actions/cache@v2 | |
with: | |
path: | | |
${{ steps.setup-haskell-build-env.outputs.cabal-store }} | |
dist-newstyle | |
key: ${{ runner.os }}-cabal-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }} | |
restore-keys: | | |
${{ runner.os }}-cabal-${{ matrix.ghc }} | |
- name: Build | |
run: cabal install | |
- name: Test | |
run: cabal test --test-show-details=streaming | |
env: | |
HSPEC_OPTIONS: --color | |
# note that Cabal uses symlinks -- actions/upload-artifact@v2 apparently | |
# dereferences for us | |
- name: Upload executable | |
uses: actions/upload-artifact@v2 | |
with: | |
path: ~/.cabal/bin/${{ env.EXE_NAME }} | |
name: ${{ env.EXE_NAME }}-macos-ghc-${{ matrix.ghc }}-cabal-${{ github.sha }} | |
if-no-files-found: error | |
windows-cabal-test: | |
runs-on: windows-latest | |
name: Windows / GHC ${{ matrix.ghc }}, Cabal / test | |
strategy: | |
fail-fast: false # don't stop if one job (= GHC version) fails | |
matrix: | |
cabal: [latest] | |
ghc: ["9.2"] | |
steps: | |
# TODO figure out timestamp fixer on Windows (need Bash) | |
- uses: actions/checkout@v2 | |
- name: Setup Haskell build environment | |
id: setup-haskell-build-env | |
uses: haskell/actions/setup@v2 | |
with: | |
ghc-version: ${{ matrix.ghc }} | |
cabal-version: ${{ matrix.cabal }} | |
- run: cabal freeze | |
- name: Cache Cabal build artifacts | |
uses: actions/cache@v2 | |
with: | |
path: | | |
${{ steps.setup-haskell-build-env.outputs.cabal-store }} | |
dist-newstyle | |
key: ${{ runner.os }}-cabal-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }} | |
restore-keys: | | |
${{ runner.os }}-cabal-${{ matrix.ghc }} | |
- name: Build | |
run: cabal install | |
- name: Test | |
run: cabal test --test-show-details=streaming | |
env: | |
HSPEC_OPTIONS: --color | |
- name: Upload executable | |
uses: actions/upload-artifact@v2 | |
with: | |
path: "C:/cabal/bin/${{ env.EXE_NAME }}.exe" | |
name: ${{ env.EXE_NAME }}-windows-ghc-${{ matrix.ghc }}-cabal-${{ github.sha }}.exe | |
if-no-files-found: error |