HackSC / odyssey

A hackathon management platform, built by HackSC
https://dashboard.hacksc.com
MIT License
9 stars 2 forks source link
hackathon hacksc odyssey

HackSC Odyssey

CircleCI Better Uptime Badge codecov

Odyssey is a hackathon management platform that handles hacker applications, admin functionalities, and more. Built by the HackSC team.

Main

Main Build Status

Staging

Staging Build Status

Odyssey Setup

Project Structure

Odyssey Tech Stack

Odyssey is built using Next.js and Node.js/Express. Odyssey is served by a Node.js server that uses Next.js to render React apps on the server. On the back-end, Odyssey uses Sequelize as an ORM for a MySQL database. Currently, the entire app is hosted on Heroku.

How To: Add/update database model

Adding a new model or updating a current one requires a migration file.

To create one, run npx sequelize-cli migration:generate --name <MIGRATION_NAME>. This will autogenerate a file that will let you define what is being changed. See https://sequelize.org/master/manual/migrations.html for more information.

After setting up your migration, make sure you update the following files:

Once this is done, run npx sequelize-cli db:migrate to get your changes reflected in the database

Additionally, create a sample data generator in /tests/factories

How To: Deploy application to production or staging

To deploy the application to production or staging, make sure you are logged in to the right Heroku account. Make sure you have installed the Heroku CLI.

Once you're logged into the right account, add the production and staging app to your remote. I have run the following:

Before you deploy, make sure you have ran migrations on the right database.

Then to deploy to either production or staging, run:

How To: Task Running

For business / engineering tasks that are infrequent we have Tasks. These are contained in the tasks folder. When adding a task make sure to add it to CLI.js.

Invoke this command to see available tasks

How To: Test Github Actions locally

Must define environment variables used in github actions in the .github/workflows/ directory.

Install Act, a library to run github actions locally by running brew install act on mac or https://github.com/nektos/act/releases/latest for windows.

Alternatively, it can be installed by running curl https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash

To mock a pull request, run act pull_request --secret-file .env where your environment variables are defined in .env

How To: Create an End To End (E2E) Test with Cypress

Cypress is an automated e2e framework. For Odyssey, its implementation exists in the ./cypress/ directory.

In package.json, we define script commands to run cypress. It can be run locally with yarn cypress:open

This will open the cypress interactive editor, which may need to be installed on your computer.

From there, we can run all the tests defined in cypress/integration/odysseyTests/*

Implemented E2E tests:

Need to implement:

How To: Create Unit Tests with Jest

Jest tests are located in the tests/ directory - split up into tests/api/ where the js tests are written and the tests/factories/ directory to build the mock database.

Jest tests should be extensive coverage of the database.

Implemented

TODO The rest of the database and api/ directory

Retired Hackathon Constants

showLive: false // False until event or soon before showDash: false showApp: true // True until Dec. 14ish showMaps: false // False because HackSC 2021 is virtual :( big sad showAPI: false // False until event showResults: true needsBus: false // False because HackSC 2021 is virtual :( big sad showTeam: false // False until closer to event showProjectTeam: false // * False until closer to event appsCloseDate: new Date("12/21/20")