mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-23 00:08:14 +03:00
86 lines
3.2 KiB
YAML
86 lines
3.2 KiB
YAML
name: CI
|
|
|
|
# Build on every push and every pull request (which tests the merge commit).
|
|
on:
|
|
pull_request:
|
|
push:
|
|
|
|
jobs:
|
|
build:
|
|
name: ${{ matrix.os }}
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
# Run each build to completion, regardless of if any have failed
|
|
fail-fast: false
|
|
matrix:
|
|
os:
|
|
- ubuntu-20.04
|
|
- macOS-11.0
|
|
- macOS-10.15
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
# The random number towards the beginning of the cache keys below are meant to be bumped as a crude means to clear
|
|
# a cache. GitHub will automatically delete caches that haven't been accessed in 7 days, but there is no way to
|
|
# purge one manually.
|
|
|
|
# Cache ~/.stack, keyed by the contents of 'stack.yaml'.
|
|
- uses: actions/cache@v2
|
|
name: cache ~/.stack
|
|
with:
|
|
path: ~/.stack
|
|
key: stack-0_${{matrix.os}}-${{hashFiles('stack.yaml')}}
|
|
|
|
# Cache each local package's ~/.stack-work for fast incremental builds in CI.
|
|
- uses: actions/cache@v2
|
|
name: cache .stack-work
|
|
with:
|
|
path: |
|
|
.stack-work
|
|
parser-typechecker/.stack-work
|
|
unison-core/.stack-work
|
|
yaks/easytest/.stack-work
|
|
# Main cache key: commit hash. This should always result in a cache miss...
|
|
key: stack-work-0_${{matrix.os}}-${{github.sha}}
|
|
# ...but then fall back on the latest cache stored (on this branch)
|
|
restore-keys: stack-work-0_${{matrix.os}}-
|
|
|
|
# Install stack by downloading the binary from GitHub. The installation process is different for Linux and macOS,
|
|
# so this is split into two steps, only one of which will run on any particular build.
|
|
- name: install stack (Linux)
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
curl -L https://github.com/commercialhaskell/stack/releases/download/v2.5.1/stack-2.5.1-linux-x86_64.tar.gz | tar -xz
|
|
echo "$HOME/stack-2.5.1-linux-x86_64/" >> $GITHUB_PATH
|
|
- name: install stack (macOS)
|
|
if: runner.os == 'macOS'
|
|
run: |
|
|
curl -L https://github.com/commercialhaskell/stack/releases/download/v2.5.1/stack-2.5.1-osx-x86_64.tar.gz | tar -xz
|
|
echo "$HOME/stack-2.5.1-osx-x86_64/" >> $GITHUB_PATH
|
|
|
|
# One of the transcripts fails if the user's git name hasn't been set.
|
|
- name: set git user info
|
|
run: |
|
|
git config --global user.name "GitHub Actions"
|
|
git config --global user.email "actions@github.com"
|
|
|
|
- name: remove ~/.stack/setup-exe-cache on macOS
|
|
if: runner.os == 'macOS'
|
|
run: rm -rf ~/.stack/setup-exe-cache
|
|
|
|
# Build deps, then build local code. Splitting it into two steps just allows us to see how much time each step
|
|
# takes.
|
|
- name: build dependencies
|
|
run: stack --no-terminal build --fast --only-dependencies
|
|
- name: build
|
|
run: stack --no-terminal build --fast
|
|
|
|
# Run each test suite (tests and transcripts)
|
|
- name: tests
|
|
run: stack --no-terminal exec tests
|
|
- name: transcripts
|
|
run: |
|
|
stack --no-terminal exec transcripts
|
|
git diff
|
|
x=`git status --porcelain -uno` bash -c 'if [[ -n $x ]]; then echo "$x" && false; fi'
|