2020-11-12 19:21:44 +03:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push: { branches: [master] }
|
|
|
|
pull_request: { branches: [master] }
|
|
|
|
create: { tags: [v*] }
|
|
|
|
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: bash
|
|
|
|
working-directory: waspc
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
cancel:
|
|
|
|
name: Cancel redundant actions already in progress
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Cancel actions in progress of same workflow and same branch
|
2020-11-14 12:41:02 +03:00
|
|
|
uses: styfle/cancel-workflow-action@0.6.0
|
2020-11-12 19:21:44 +03:00
|
|
|
with:
|
|
|
|
access_token: ${{ github.token }}
|
|
|
|
|
|
|
|
build:
|
|
|
|
name: Build Wasp
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os:
|
|
|
|
- ubuntu-latest
|
|
|
|
- macos-latest
|
|
|
|
- windows-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
# TODO: We did not take Windows into account here.
|
|
|
|
# From what we know so far they use different paths, so we should
|
|
|
|
# add those also to cache (conditionally?).
|
|
|
|
- name: Set up cache
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: |
|
2020-11-14 14:44:52 +03:00
|
|
|
~/.ghc
|
|
|
|
~/.cabal
|
|
|
|
~/.stack
|
|
|
|
# TODO: Right now, actions/cache updates cache only if cache was not fetched.
|
|
|
|
# This is not ideal for us, because we would ideally update cache even if it
|
|
|
|
# was fetched, because we want to cache any newly installed packages.
|
|
|
|
# This was working normally on Travis and Appveyor.
|
|
|
|
# There is an issue for this, and for now we are using proposed "fix" from it,
|
|
|
|
# https://github.com/actions/cache/issues/342#issuecomment-673371329,
|
|
|
|
# which mitigates the problem by creating new cache for each job and then using
|
|
|
|
# the feature of restore-keys which makes sure that next cache picked is the
|
|
|
|
# latest one. However, this keeps creating new cache each time which is not
|
|
|
|
# ideal because caches keep getting evicted, so for example if Win job
|
|
|
|
# fails multiple times while others don't, its cache will likely get evicted,
|
|
|
|
# making it even slower to test and fix (uffff).
|
|
|
|
# When they fix this, we should remove ${{ github.run_id }} from the end of the key
|
|
|
|
# and also remove restore-keys.
|
|
|
|
key: haskell-${{ runner.os }}-${{ hashFiles('waspc/stack.yaml') }}-${{ github.run_id }}
|
|
|
|
restore-keys: |
|
|
|
|
haskell-${{ runner.os }}-${{ hashFiles('waspc/stack.yaml') }}-
|
|
|
|
|
|
|
|
# TODO: Remove this step once https://github.com/actions/cache/issues/445 is resolved.
|
|
|
|
- name: Fix MacOS problem with corrupt cached executable
|
2020-11-14 14:49:01 +03:00
|
|
|
run: rm -rf ~/.stack/setup-exe-cache
|
2020-11-14 14:44:52 +03:00
|
|
|
if: runner.os == 'macOS'
|
2020-11-12 19:21:44 +03:00
|
|
|
|
|
|
|
- name: Set up environment
|
2020-11-14 12:39:26 +03:00
|
|
|
uses: actions/setup-haskell@v1
|
2020-11-12 19:21:44 +03:00
|
|
|
with:
|
|
|
|
ghc-version: latest
|
|
|
|
enable-stack: true
|
|
|
|
stack-version: latest
|
|
|
|
|
|
|
|
- name: Verify environment
|
|
|
|
run: |
|
|
|
|
stack --numeric-version
|
|
|
|
ghc --version
|
|
|
|
|
|
|
|
- name: Build dependencies
|
|
|
|
run: stack --install-ghc test --only-dependencies
|
|
|
|
|
|
|
|
- name: Build Wasp & Run tests
|
|
|
|
run: stack test
|
|
|
|
|
|
|
|
# TODO: Add deployment of binaries to Github release.
|