Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jashlu authored Apr 8, 2024
0 parents commit 60e0cfa
Show file tree
Hide file tree
Showing 91 changed files with 36,156 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Dependencies
/node_modules

# Testing
/coverage

# Production
/build
/dist
/out

# Autogenerated files
/public/lib/*
**/participant_responses
psiturkit/*_turk
*.log
*.log*

# Misc
/.husky
/.vscode
/.env
.env
.DS_Store
.gitignore
**/firebase-service-account.json
36 changes: 36 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
module.exports = {
root: true,
env: {
browser: true,
es6: true,
jest: true,
node: true,
},
extends: [
"eslint:recommended",
"plugin:react/recommended",
"plugin:import/recommended",
"prettier",
],
parserOptions: {
sourceType: "module",
ecmaVersion: 2023,
},
plugins: ["react"],
rules: {
"no-unused-vars": "warn",
"react/prop-types": "off", // TODO @brown-ccv #223: App prop validation, remove this rule
"import/order": "warn",
},
settings: {
react: {
version: "detect",
},
"import/resolver": {
node: {
extensions: [".js", ".jsx"],
},
},
},
overrides: [{ files: ["*.jsx", "*.js"] }],
};
5 changes: 5 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"projects": {
"default": "ccv-honeycomb"
}
}
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Bug report
about: Create a report to help us improve
title: "[BUG]"
labels: bug
assignees: ""
---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**

- OS: [e.g. iOS]
- Browser [e.g. chrome, safari, electron]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/workflows/firebase-hosting-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools

name: Deploy to Firebase Hosting on merge
"on":
push:
branches:
- main
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npm install && npm run build:firebase
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_CCV_HONEYCOMB }}"
channelId: live
projectId: ccv-honeycomb
17 changes: 17 additions & 0 deletions .github/workflows/firebase-hosting-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools

name: Deploy to Firebase Hosting on PR
"on": pull_request
jobs:
build_and_preview:
if: "${{ github.event.pull_request.head.repo.full_name == github.repository }}"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npm install && npm run build:firebase
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_CCV_HONEYCOMB }}"
projectId: ccv-honeycomb
53 changes: 53 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: 🏗️ Pull Request
on: pull_request

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
name: 🧪 Build
runs-on: ${{ matrix.os }}

# Run action for [home/clinic] with in [windows/macOS/ubuntu]
strategy:
matrix:
setting: [home, clinic]
os: [windows-latest, macOS-latest, ubuntu-latest]
fail-fast: false # A failed build will not end the other matrix jobs

steps:
# Set up runner
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
- name: ⎔ Setup node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: npm
- name: 🐍 Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.12

# Install dependencies
- name: 🅿️ Install Python tools
run: pip install setuptools
- name: 📥 Install Dependencies
run: npm ci

# Set up the environment
- name: 🔃 Load .env file (.env.${{matrix.setting}})
uses: xom9ikk/dotenv@v2
with:
path: ./env
mode: ${{matrix.setting}}

# Lint the code
- name: 🔬 Lint
run: npm run lint -- --max-warnings=0

# Build the app
- name: ⚒ Build
run: npm run build
184 changes: 184 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
name: 🚀 Release

# Runs the build and package scripts when a new tagged release is created
# Note that this runs for both releases and pre-releases: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release
on:
release:
types: created

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: write

jobs:
package-and-upload:
name: Package and Upload
runs-on: ${{ matrix.os }}

# Run build script for [home/clinic] in [windows/macOS/ubuntu]
strategy:
matrix:
os: [windows-latest, macOS-latest, ubuntu-latest]
setting: [home, clinic]
fail-fast: true

steps:
# Set up runner
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
- name: ⎔ Setup node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: npm
- name: 🐍 Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.10"

# Install dependencies and set up environment
- name: 📥 Install Dependencies
run: npm ci
- name: 🔃 Load .env file (.env.${{matrix.setting}})
uses: xom9ikk/dotenv@v2
with:
path: ./env
mode: ${{matrix.setting}}

# Build the app
- name: ⚒ Build
run: npm run build

# Package the app installers
- name: 📦 Package app installer - Windows
if: startsWith(matrix.os, 'windows')
run: npm run package:windows
- name: 📦 Package app installer - Mac
if: startsWith(matrix.os, 'mac')
run: npm run package:mac
- name: 📦 Package app installer - Linux
if: startsWith(matrix.os, 'ubuntu')
run: npm run package:linux

# Get package info
- name: Get package name and version
id: package_info
run: |
echo "name=$(cat package.json | jq -r '.name')" >> $GITHUB_OUTPUT
echo "version=$(cat package.json | jq -r '.version')" >> $GITHUB_OUTPUT
shell: bash

# Upload installers to GitHub release
- name: ⬆ Upload installer to release - Windows
if: startsWith(matrix.os, 'windows')
uses: svenstaro/upload-release-action@v2
with:
file: out/make/squirrel.windows/x64/${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }} Setup.exe
asset_name: ${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }}-${{ matrix.setting }}-setup.exe
tag: ${{ github.ref }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
- name: ⬆ Upload installer to release - macOS
if: startsWith(matrix.os, 'mac')
uses: svenstaro/upload-release-action@v2
with:
file: out/make/${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }}-universal.dmg
asset_name: ${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }}-${{ matrix.setting }}-universal.dmg
tag: ${{ github.ref }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
- name: ⬆ Upload installer to release - Linux
if: startsWith(matrix.os, 'ubuntu')
uses: svenstaro/upload-release-action@v2
with:
file: out/make/deb/x64/${{ steps.package_info.outputs.name }}_${{ steps.package_info.outputs.version }}_amd64.deb
asset_name: ${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }}-${{ matrix.setting }}-amd64.deb
tag: ${{ github.ref }}
repo_token: ${{ secrets.GITHUB_TOKEN }}

deploy-gh-pages:
name: Deploy to GH Pages
runs-on: ubuntu-latest
steps:
# Set up runner
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
- name: ⎔ Setup node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: npm
- name: 🐍 Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.10"

# Install dependencies
- name: 📥 Install Dependencies
run: npm ci

# Build the app
- name: ⚒ Build
run: npm run build

# Deploy the app to GitHub Pages
- name: 🚀 Deploy to GH Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build

package-psiturk:
name: Package for PsiTurk
runs-on: ubuntu-latest
steps:
# Set up runner
- name: ⬇️ Checkout repo
uses: actions/checkout@v4

- name: ⎔ Setup node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: npm
- name: 🐍 Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.10"

# Install dependencies
- name: 📥 Install Dependencies
run: npm ci
- name: 📥 Install PsiTurk
run: pip install psiturk

# Build the app
- name: ⚒ Build
run: npm run build

# Get package info
- name: Get package name and version
id: package_info
run: |
echo "name=$(cat package.json | jq -r '.name')" >> $GITHUB_OUTPUT
echo "version=$(cat package.json | jq -r '.version')" >> $GITHUB_OUTPUT
shell: bash

# Package with PsiTurk
- name: 📦 Create Psiturk Build
run: |
cd psiturkit
./psiturk-it -p ${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }}-psiturk
# Zip and upload the package
- name: Zip psiturk folder
run: |
cd psiturkit
zip -r ${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }}-psiturk.zip ${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }}-psiturk
- name: ⬆ Upload PsiTurk Build
uses: svenstaro/upload-release-action@v2
with:
file: psiturkit/${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }}-psiturk.zip
tag: ${{ github.ref }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
17 changes: 17 additions & 0 deletions .github/workflows/workflow-delete-artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Workflow dispatch for deleting unneeded artifacts.
# Used to clear storage budget when testing release/package creation
name: Delete Artifacts Workflow
on:
workflow_dispatch:
inputs:
days:
description: Delete artifacts older than n days
default: "5"

jobs:
delete-artifacts:
runs-on: ubuntu-latest
steps:
- uses: c-hive/gha-remove-artifacts@v1
with:
age: ${{ format('{0} days', github.event.inputs.days) }}
Loading

0 comments on commit 60e0cfa

Please sign in to comment.