Skip to content

fix multi-layers

fix multi-layers #214

Workflow file for this run

name: CI
on:
push:
branches:
- "**"
pull_request:
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 20
env:
MONGODB_TEST: 127.0.0.1:27017/circleci_test
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
- uses: supercharge/[email protected]
with:
mongodb-version: 4.2
- run: npm install
- run: npm run build-pages
- name: Instantiate github-keys.json
run: |
echo "{ \"clientID\": \"clientID\", \"clientSecret\": \"clientSecret\", \"callbackURL\": \"http://localhost:3000/auth/github/callback\"}" > app/auth/github-keys.json
mkdir test/e2e/auth
cp app/auth/github-keys.json $_
- name: Instantiate configuration file
run: cp cfg.json.example cfg.json
- name: Instantiate blacklist
run: echo {} > app/controller/microdrawWebsocketServer/blacklist.json
- name: Instantiate whitelist
run: echo "{}" > app/controller/microdrawWebsocketServer/whitelist.json
- name: Run the server during 5 seconds
run: timeout 5 npm start && exit 10 || [[ $? -eq 124 ]]
- name: Run api tests
run: npm run mocha
- name: Run e2e tests
run: npm run test-e2e
- name: Archive screenshots
if: always()
uses: actions/upload-artifact@v2
with:
name: screenshots
path: test/e2e/screenshots/
test-docker-build:
runs-on: ubuntu-latest
timeout-minutes: 20
env:
NETWORK_NAME: microdraw-docker-test
MICRODRAW_IMAGE_NAME: "microdraw:test-label"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
- name: Build docker image
run: docker build -t ${{ env.MICRODRAW_IMAGE_NAME }} .
- name: Run docker image
run: |
docker network create ${{ env.NETWORK_NAME }}
docker run \
--rm \
--name mongo \
--network ${{ env.NETWORK_NAME }} \
-dit \
mongo
docker run \
--rm \
--name microdraw \
--network ${{ env.NETWORK_NAME }} \
--env MONGODB=mongo:27017 \
-dit \
--env MONGODB=mongo:27017 \
-v ${PWD}/app/auth/github-keys.json.example:/microdraw/app/auth/github-keys.json \
-v ${PWD}/app/controller/microdrawWebsocketServer/blacklist.json.example:/microdraw/app/controller/microdrawWebsocketServer/blacklist.json \
-v ${PWD}/app/controller/microdrawWebsocketServer/whitelist.json.example:/microdraw/app/controller/microdrawWebsocketServer/whitelist.json \
-v ${PWD}/cfg.json.example:/microdraw/cfg.json \
-p 3000:3000 \
${{ env.MICRODRAW_IMAGE_NAME }}
- name: Ping server
run: |
sleep 5
curl -vf http://localhost:3000
- name: Clean up
run: |
docker stop microdraw
docker stop mongo
docker network rm ${{ env.NETWORK_NAME }}
deploy:
needs: test
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- name: Invoke deployment hook
uses: distributhor/workflow-webhook@v1
env:
webhook_url: ${{ secrets.WEBHOOK_URL }}
webhook_secret: ${{ secrets.WEBHOOK_SECRET }}