elm-ui-widgets/.github/workflows/main.yml
2021-12-21 18:09:30 +01:00

73 lines
2.7 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

name: CI
on:
push:
branches:
- "master"
pull_request:
jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
# Choose your Node.js version here:
node-version: 15.x
# Re-use node_modules between runs until package.json or package-lock.json changes.
- name: Cache node_modules
id: cache-node_modules
uses: actions/cache@v2
with:
path: node_modules
key: node_modules-${{ hashFiles('package.json', 'package-lock.json') }}
# Re-use ~/.elm between runs until elm.json, elm-tooling.json or
# review/elm.json changes. The Elm compiler saves downloaded Elm packages
# to ~/.elm, and elm-tooling saves downloaded tool executables there.
- name: Cache ~/.elm
uses: actions/cache@v2
with:
path: ~/.elm
key: elm-${{ hashFiles('example/elm.json', 'example/elm-tooling.json', 'example/review/elm.json') }}
# Install npm packages, unless we restored them from cache.
# Since `npm ci` removes the node_modules folder before running its
# important to skip this step if cache was restored.
# `npm ci` does two things:
# 1. Installs everything in package-lock.json.
# 2. Checks that package.json and package-lock.json are in sync.
# Thats why the cache depends on both package-lock.json and package.json.
- name: npm ci
if: steps.cache-node_modules.outputs.cache-hit != 'true'
env:
# If you have a `"postinstall": "elm-tooling install"` script in your
# package.json, this turns it into a no-op. Well run it in the next
# step because of the caching. If elm-tooling.json changes but
# package-lock.json does not, the postinstall script needs running
# but this step wont.
NO_ELM_TOOLING_INSTALL: 1
run: npm ci
# Install tools from elm-tooling.json, unless we restored them from
# cache. package-lock.json and elm-tooling.json can change independently,
# so we need to install separately based on what was restored from cache.
# This is run even if we restored ~/.elm from cache to be 100% sure
# node_modules/.bin/ contains links to all your tools. `elm-tooling
# install` runs very fast when theres nothing new to download so
# skipping the step doesnt save much time.
- name: elm-tooling install
run: npx --no-install elm-tooling install
# Finally, run whatever you want.
- name: elm-verify-examples
run: npx elm-verify-examples
- name: elm-test
run: npx --no-install elm-test-rs