Skip to content

dominikwilkowski/bronzies

Repository files navigation

bronzies.com CI testing

A web app that teaches you the SLSA signals required for the Bronze Medallion.

Contents


How to run

Command Description
yarn start Starts server and app concurrently
yarn build Create deploy files inside build/
yarn test Runs all tests
yarn deploy Builds app, deploys all files and restarts the server
yarn nuke Removes build, node_modules/ and yarn.lock file

Running the server manually

yarn start:server

Running the app

yarn start:app

⬆ back to top


Todos

Next:

  • add more unit tests
  • make gameToggler a11y
    • trap focus
    • support esc key close
    • aria roles
  • add more modes for types of beaches etc
  • rebuild server
    • postgres
    • move to graphql

⬆ back to top


The app

The app can be found in the root folder and is powered by CRA. Install the dependencies via yarn and run yarn start.

Command Description
yarn start:app Start CRA development server
yarn build Build for production
yarn deploy:app Upload the build app

⬆ back to top


The server

The server can be found in the ./server/ folder. Install dependencies, inside that folder, with preferably yarn and run one of the following commands:

Command Description
yarn start:server Start the server that serves the REST endpoint
yarn start:server:dev Start the server in staging mode to server staging data
yarn deploy:server Upload the server files (without node_modules)
yarn deploy:restart Restart the remote server app

RESTful API endpoints

Command Description
node server.js serve Run the server and take production data from assets/
node server.js serve debug Run the server but with staging data from assets/
node server.js test Don't run the server so we can test without starting a process

GET signals

https://bronzies.com/api/signals

GET signals SVG sprite

https://bronzies.com/api/assets/signals

GET highscore

https://bronzies.com/api/highscore

POST highscore

https://bronzies.com/api/highscore

GET version

https://bronzies.com/api/version

(use: curl -i -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{"name": "Superman", "nays": 55, "score": 5555555, "rounds": 777}' http://localhost:5555/api/highscore)

Install on server

The API runs behind an NGINX proxy.

CRON task

To make sure the API is started when the system has to reboot, make sure you add a cron task after reboot:

chmod 700 /www/bronzies/server/starter.sh # the starter.sh of this repo
crontab -e

and add:

@reboot /www/bronzies/server/starter.sh

FOREVER node deamon

Now we still have to make sure the node app is restarted if it crashes for some uncaught reason. Install forever and register the task:

npm i forever -g
forever start -l bronzies.log --append -o bronziesOut.log -e bronziesError.log /www/bronzies/server/server.js serve

⬆ back to top


Testing

Continues integration is setup with CircleCI and we're testing with Jest and Cypress.

Tests are organized inside the src/tests folder.

.
├── app
│   └── [test-name].spec.js
├── e2e
│   └── [test-name].cypress.js
├── server
│   └── [test-name].spec.js
└── utils
    ├── plugins
    └── support

Files that end with .spec.js are Jest tests and files that end with .cypress.js are Cypress tests.

Command Description
yarn test Run all tests
yarn test:unit Run all unit tests with Jest
yarn test:unit:watch Runs Jest test watch
yarn test:unit:cover Shows coverage of unit tests
yarn test:e2e Run all end-to-end tests with Cyrpess
yarn test:e2e:server Start server for e2e test
yarn test:e2e:run Run e2e test in ci
yarn test:e2e:open Open Cypress

⬆ back to top


Release History App

  • 1.1.1 - Updated dependencies
  • 1.1.0 - Updated dependencies and moved to emotion 11
  • 1.0.3 - Updated to React 17, updated dependencies
  • 1.0.2 - Fixed sound in CPR screen
  • 1.0.1 - Added versions to about screen
  • 1.0.0 - Complete rewrite in react
  • 0.1.5 - Removed cordova build, changed endpoints
  • 0.1.4 - Added cordova build
  • 0.1.3 - Fixed CSS and highscore issues
  • 0.1.2 - Added basic layout for first alpha tests
  • 0.1.1 - Changes to API endpoint, fixes
  • 0.1.0 - Completely refactored the code, No Design yet
  • 0.0.3 - Moved an old version into the repo and developed the RESTful API

Release History Server

  • 1.0.2 - Removed some flags for 35th edition of the PSAR manual
  • 1.0.1 - Added version route
  • 1.0.0 - Complete rewrite
  • 0.0.3 - fixed dependencies, changed endpoints
  • 0.0.2 - moved to MongoDB
  • 0.0.1 - Created server, routes and endpoints

⬆ back to top


License

Copyright (c) Dominik Wilkowski. Licensed under GNU-GPLv3.

⬆ back to top

};