Skip to content

Merge pull request #301 from carlsonp/dependabot/github_actions/actio… #151

Merge pull request #301 from carlsonp/dependabot/github_actions/actio…

Merge pull request #301 from carlsonp/dependabot/github_actions/actio… #151

Workflow file for this run

# 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@v1
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@v1
- name: Test Building Docker Image
id: docker_build
# https://github.com/docker/build-push-action
uses: docker/build-push-action@v2
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 }}