use GH actions instead of Travis

This commit is contained in:
Brian Hicks 2021-08-25 14:06:28 -05:00
parent 72c552e765
commit 8d8774e085
2 changed files with 21 additions and 54 deletions

21
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,21 @@
name: CI
on:
pull_request:
push:
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v13
# - uses: cachix/cachix-action@v10
# with:
# name: noredink-ui
# authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
# extraPullNames: niv
- run: nix-shell --pure --run 'shake --verbose ci'

View File

@ -1,54 +0,0 @@
language: nix
env:
global:
- CACHIX_CACHE=noredink-ui
cache:
directories:
- node_modules
- ~/.elm
install:
# This setup script comes from the cachix docs[1], but we annotate it here so
# it's easier to maintain.
#
# [1]: https://docs.cachix.org/continuous-integration-setup/travis-ci.html
# First, we need to tell Nix that the current user is trusted to make changes to
# the system configuration, so that we can do exactly that in the next step.
- echo "trusted-users = $USER" | sudo tee -a /etc/nix/nix.conf
- sudo systemctl restart nix-daemon
# Next, we need to tell Nix to use our cache to avoid building fresh every time.
# Under the covers, this means trusting the signing key and adding the
# our-cache-name.cachix.org as a substituter. But we don't really need to worry
# a lot about the mechanism here, since the `cachix use` statement here will
# take care of everything for us if it has the right permissions.
- nix-env -iA nixpkgs.cachix
- cachix use $CACHIX_CACHE
# Next, we list all the paths that Nix currently knows about so that we don't
# waste time trying to push them later.
- nix path-info --all > /tmp/store-path-pre-build
# Finally, we run `nix-shell` with a no-op command to download our real
# dependencies. This step should now take advantage of the cachix cache and
# avoid rebuilding any upstream software we depend on! (At the time of this
# writing, that measn we avoid compiling `niv` and `elm-forbid-import` on every
# run.)
#
# Note that this step is technically not necessary--running our build command in
# `nix-shell` below would also take care of this--but getting dependencies here
# lets us collapse the (huge) download list in the Travis UI.
- nix-shell --run 'true'
script:
- nix-shell --pure --run 'shake --verbose ci'
after_success:
# After we successfully build, we want to cache whatever we can. That means that
# when dependencies change, we should only build them once. The invocation below
# just gets the difference between the derivations we had before the build and
# the derivations we have now, and pushes the new ones.
- comm -13 <(sort /tmp/store-path-pre-build | grep -v '\.drv$') <(nix path-info --all | grep -v '\.drv$' | sort) | cachix push $CACHIX_CACHE