Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
lakedude authored Dec 2, 2023
0 parents commit 45f77e0
Show file tree
Hide file tree
Showing 78 changed files with 40,883 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Dependencies
/node_modules
/.pnp
.pnp.js

# Testing
/coverage

# Production
/build
/dist
/out

# Min Files
/public/lib

# No linting needed
**/__tests__/
**/participant_responses
**/firebase-service-account.json
psiturkit/*_turk


# Misc
/.husky
/.vscode
/.env
.env
.DS_Store
.gitignore

# File types
# TODO: Only running on js and jsx anyways?
# *.md
# *.json
# *.loga
# *.log
# *.log*
31 changes: 31 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module.exports = {
root: true,
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2018,
sourceType: "module",
},
settings: {
react: {
version: "detect",
},
},
env: {
browser: true,
node: true,
es6: true,
},
globals: {
Atomics: "readonly",
SharedArrayBuffer: "readonly",
},
plugins: ["react", "prettier"],
extends: ["eslint:recommended", "plugin:react/recommended", "prettier"],
rules: {
"react/prop-types": "off",
"prettier/prettier": "warn",
},
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"
}
}
32 changes: 32 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
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

# Runs the build and test scripts on PR
on: pull_request

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

jobs:
build-and-test:
name: πŸ§ͺ Build and Test
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.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}}

# Test and build the app
- name: πŸ§ͺ Run Test
run: npm test
env:
CI: true
- name: πŸ”¬ Lint
run: npm run lint
- name: βš’ Run Build
run: npm run build
166 changes: 166 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
name: Release

# Runs the build and package scripts when a new tagged release is publishe, created or edited
# 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, edited, published]

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:
setting: [home, clinic]
os: [windows-latest, macOS-latest, ubuntu-latest]
fail-fast: true # 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.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: βš’ Run 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

# Upload installers to github release
# TODO: Can these be combined based on matrix.os???
- name: Set package version and name
uses: brown-ccv/gh-actions/get-package-info@main
id: package_info
- 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.package_name }}-${{ steps.package_info.outputs.package_version }} Setup.exe
asset_name: ${{ steps.package_info.outputs.package_name }}-${{ steps.package_info.outputs.package_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.package_name }}-${{ steps.package_info.outputs.package_version }}-x64.dmg
asset_name: ${{ steps.package_info.outputs.package_name }}-${{ steps.package_info.outputs.package_version }}-${{ matrix.setting }}.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.package_name }}_${{ steps.package_info.outputs.package_version }}_amd64.deb
asset_name: ${{ steps.package_info.outputs.package_name }}_${{ steps.package_info.outputs.package_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: βš’ Run 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 Node
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
- name: βŽ” Setup node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: npm

# Install dependencies
- name: πŸ“₯ Install Dependencies
run: npm ci

# Build the app
- name: βš’ Run Build
run: npm run build

# Package on PsiTurk
- name: Set package version and name
uses: brown-ccv/gh-actions/get-package-info@main
id: package_info
- name: 🐍 Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.7
- name: πŸ“₯ Install PsiTurk
run: pip install psiturk
- name: πŸ“¦ Create Psiturk Build
run: |
cd psiturkit
./psiturk-it -p ${{ steps.package_info.outputs.package_name }}-psiturk
- name: ⬆ Upload PsiTurk Build
uses: actions/upload-artifact@v2
with:
name: psiturk-build
path: psiturkit/${{ steps.package_info.outputs.package_name }}-psiturk
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 45f77e0

Please sign in to comment.