Skip to content

[WIP] Add project page components from nwl-components #225

[WIP] Add project page components from nwl-components

[WIP] Add project page components from nwl-components #225

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@v4
- uses: actions/setup-node@v4
with:
node-version: 16
- uses: supercharge/mongodb-github-action@1.3.0
with:
mongodb-version: 4.2
- run: npm install
- 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
- run: npm run build-pages
- 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@v4
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@v4
- uses: actions/setup-node@v4
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@v3
env:
webhook_url: ${{ secrets.WEBHOOK_URL }}
webhook_secret: ${{ secrets.WEBHOOK_SECRET }}