Merge pull request #306 from carlsonp/dependabot/github_actions/docke… #160
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
# validate YAML | |
# https://codebeautify.org/yaml-validator | |
name: Build and Test | |
on: [push, pull_request] | |
jobs: | |
build-test: | |
name: build-test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
# https://docs.github.com/en/free-pro-team@latest/actions/guides/building-and-testing-nodejs | |
# https://github.com/actions/setup-node/ | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '14' | |
# https://github.com/marketplace/actions/mongodb-in-github-actions | |
- name: Start MongoDB | |
uses: supercharge/[email protected] | |
with: | |
mongodb-version: 4.4 | |
- run: npm install | |
# ampersand means run in the background | |
# sleep and wait for the app to load | |
# start running casperjs tests | |
- run: node app.js & | |
- run: sleep 6 | |
- run: npm test | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
with: | |
platforms: all | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Test Building Docker Image | |
id: docker_build | |
# https://github.com/docker/build-push-action | |
uses: docker/build-push-action@v3 | |
with: | |
push: false | |
tags: ghcr.io/carlsonp/kort:latest | |
platforms: linux/amd64,linux/arm64 | |
# https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md | |
cache-from: type=registry,ref=ghcr.io/carlsonp/kort:latest | |
cache-to: type=inline | |
# https://github.com/snyk/actions/tree/master/node | |
- name: Run Snyk to check for vulnerabilities | |
uses: snyk/actions/node@master | |
env: | |
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} |