Add github actions #3
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 | |
# CI is run on pull requests and on push to the main branch | |
on: | |
pull_request: | |
push: | |
branches: [ main ] | |
jobs: | |
test: | |
# This job is to run the tests | |
name: Run tests | |
runs-on: ubuntu-latest | |
steps: | |
# Clone the repository | |
- uses: actions/checkout@v2 | |
# Setup Node JS | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
- name: Cache node modules | |
id: cache-npm | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-node-modules | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
# Install elm and cache ELM_HOME | |
- name: Install dependencies | |
run: npm install | |
- name: Check formatting | |
run: npm run test:format | |
- name: Run the tests | |
run: npm run test:elm |