Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
voxxal committed Jan 16, 2024
0 parents commit ae527b2
Show file tree
Hide file tree
Showing 259 changed files with 26,259 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .dependabot/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 1
update_configs:
- package_manager: javascript
directory: /
update_schedule: weekly
version_requirement_updates: increase_versions
- package_manager: python
directory: /docs
update_schedule: weekly
commit_message:
prefix: build(deps-doc)
include_scope: false
30 changes: 30 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*

/node_modules

/dist
/.env
/data
/conf.d/*
!/conf.d/.keep

# Upload provider dir
/uploads

.DS_Store
Thumbs.db
ehthumbs.db
Desktop.ini
$RECYCLE.BIN
/package-lock.json

*.swp

# nyc test runner
/.nyc_output
/coverage

# preact-cli build size plugin
size-plugin.json
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Ignore build folders
/dist

# Ignore bundled analytics
/client/src/static/analytics/*
29 changes: 29 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module.exports = {
env: {
es6: true
},
extends: [
'standard'
],
parserOptions: {
ecmaFeatures: {
},
ecmaVersion: 2018,
sourceType: 'module'
},
plugins: [
],
rules: {
'no-multiple-empty-lines': ['error', {
max: 1,
maxEOF: 0,
maxBOF: 0
}],
'padding-line-between-statements': ['error',
{ blankLine: 'always', prev: 'block-like', next: 'export' }
],
'no-void': ['error', {
allowAsStatement: true
}]
}
}
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
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):**
- Distribution: [e.g. Debian]
- Version Information:

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
132 changes: 132 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
name: CI
on:
push:
branches: [master]
pull_request:

jobs:
check-commits:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v2
with:
# Fetch all history
fetch-depth: 0

- name: Check commit messages
run: |
scripts/check-commits.sh ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }}
shellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Shellcheck
run: |
shellcheck install/*.sh scripts/*.sh
lint:
runs-on: ubuntu-latest
strategy:
matrix:
node: [12]
steps:
- uses: actions/checkout@v2

- name: Set up Node ${{ matrix.node }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}

- name: Install dependencies
run: |
yarn install --frozen-lockfile
- name: Lint
run: |
yarn lint
test:
runs-on: ubuntu-latest
strategy:
matrix:
node: [12]
postgres: [12]
redis: [6]
services:
postgres:
image: postgres:${{ matrix.postgres }}
env:
POSTGRES_PASSWORD: password
ports:
- 5432:5432
redis:
image: redis:${{ matrix.redis }}
ports:
- 6379:6379
env:
RCTF_DATABASE_URL: postgres://postgres:password@localhost/rctf
RCTF_REDIS_URL: redis://@localhost:6379/0
RCTF_TOKEN_KEY: 32_byte_long_base64_encoded_value_for_token
steps:
- uses: actions/checkout@v2

- name: Set up Node ${{ matrix.node }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}

- name: Install dependencies
run: |
yarn install --frozen-lockfile
- name: Create DB
run: |
psql postgres://postgres:password@localhost -c 'CREATE DATABASE rctf;'
- name: Load configuration
run: |
cp test/conf-test.yaml conf.d
- name: Run migrations
run: |
yarn migrate
- name: Add data to DB
run: |
psql "$RCTF_DATABASE_URL" -c $'INSERT INTO challenges (id, data) VALUES (\'id\', \'{"flag": "flag{good_flag}", "name": "name", "files": [], "author": "author", "points": {"max": 500, "min": 100}, "category": "category", "description": "description", "tiebreakEligible": true}\')'
- name: Build
run: |
yarn build
- name: Run tests
run: |
yarn test:report
- name: Upload coverage reports
uses: codecov/codecov-action@v1

docker-build:
runs-on: ubuntu-latest
# TODO: handle tagging releases correctly
if: github.ref == 'refs/heads/master'
needs:
- shellcheck
- lint
- test

steps:
- uses: actions/checkout@v2

- name: Build & push
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASS }}
repository: redpwn/rctf
# TODO: handle tagging releases correctly
tags: master,${{ github.sha }}
# TODO: add cache_froms once we have full releases
31 changes: 31 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*

/node_modules

/dist
/.env
/data
/conf.d/*
!/conf.d/.keep
/docs/site

# Upload provider dir
/uploads

.DS_Store
Thumbs.db
ehthumbs.db
Desktop.ini
$RECYCLE.BIN
/package-lock.json

*.swp

# nyc test runner
/.nyc_output
/coverage

# preact-cli build size plugin
size-plugin.json
9 changes: 9 additions & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const { CLIEngine } = require('eslint')

const cli = new CLIEngine({})

module.exports = {
'*.{j,t}s?(x)': files =>
'eslint --max-warnings=0 --fix ' +files.filter(file => !cli.isPathIgnored(file)).join(' '),
'*.ts?(x)': () => 'tsc --noEmit'
}
5 changes: 5 additions & 0 deletions .nycrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"all": true,
"include": ["dist/server/**/*.js"],
"excludeAfterRemap": false
}
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"singleQuote": true,
"trailingComma": "none",
"semi": false
}
1 change: 1 addition & 0 deletions .yarnrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
save-prefix ""
Loading

0 comments on commit ae527b2

Please sign in to comment.