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 it’s # 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. # That’s 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. We’ll 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 won’t. 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 there’s nothing new to download so # skipping the step doesn’t 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