Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup actions #1

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
7 changes: 7 additions & 0 deletions .github/actions/backstop/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM node:10.14.1-alpine

LABEL "com.github.actions.name"="Run Backstop"
LABEL "com.github.actions.description"="Runs Backstop tests in a Docker container"

COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
21 changes: 21 additions & 0 deletions .github/actions/backstop/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh

# Exit if any subcommand fails
set -e

# Setup node modules if needed
if [ -e node_modules/.bin/jest ]; then
setup=""
else
echo "## Your environment is not ready yet. Installing modules..."
if [ -f yarn.lock ]; then
setup="yarn --non-interactive --silent --ignore-scripts --production=false &&"
else
setup="NODE_ENV=development npm install &&"
fi
fi


echo "## Running Action"
args=$@
sh -c "$setup ((npm run start) & npm run lint)"
7 changes: 3 additions & 4 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Node Test
name: PR

on: [push]
on: pull_request

jobs:
test:
Expand All @@ -10,8 +10,7 @@ jobs:
node-version: [12.x]
steps:
- uses: actions/checkout@v1
- name: Install dependencies
run: npm install
- uses: ./.github/actions/backstop
- name: Run Eslint
run: npm run lint
- name: Run Jest
Expand Down
1 change: 0 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ nunjucks.configure([
watch: true,
});

console.log('http://localhost:3000');
app.listen(3000);