init CTFd source
This commit is contained in:
3
.github/FUNDING.yml
vendored
Normal file
3
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: CTFd
|
||||
19
.github/ISSUE_TEMPLATE.md
vendored
Normal file
19
.github/ISSUE_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
<!--
|
||||
If this is a bug report please fill out the template below.
|
||||
|
||||
If this is a feature request please describe the behavior that you'd like to see.
|
||||
-->
|
||||
|
||||
**Environment**:
|
||||
|
||||
- CTFd Version/Commit:
|
||||
- Operating System:
|
||||
- Web Browser and Version:
|
||||
|
||||
**What happened?**
|
||||
|
||||
**What did you expect to happen?**
|
||||
|
||||
**How to reproduce your issue**
|
||||
|
||||
**Any associated stack traces or error logs**
|
||||
46
.github/workflows/docker-build.yml
vendored
Normal file
46
.github/workflows/docker-build.yml
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
name: Docker build image on release
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- name: Set repo name lowercase
|
||||
id: repo
|
||||
uses: ASzc/change-string-case-action@v2
|
||||
with:
|
||||
string: ${{ github.repository }}
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: |
|
||||
${{ steps.repo.outputs.lowercase }}:latest
|
||||
ghcr.io/${{ steps.repo.outputs.lowercase }}:latest
|
||||
${{ steps.repo.outputs.lowercase }}:${{ github.event.release.tag_name }}
|
||||
ghcr.io/${{ steps.repo.outputs.lowercase }}:${{ github.event.release.tag_name }}
|
||||
47
.github/workflows/lint.yml
vendored
Normal file
47
.github/workflows/lint.yml
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
---
|
||||
name: Linting
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ['3.11']
|
||||
|
||||
name: Linting
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
architecture: x64
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install -r linting.txt
|
||||
sudo yarn --cwd CTFd/themes/admin install --non-interactive
|
||||
sudo yarn global add prettier@3.2.5
|
||||
|
||||
- name: Lint
|
||||
run: make lint
|
||||
env:
|
||||
TESTING_DATABASE_URL: 'sqlite://'
|
||||
|
||||
- name: Lint Dockerfile
|
||||
uses: brpaz/hadolint-action@master
|
||||
with:
|
||||
dockerfile: "Dockerfile"
|
||||
|
||||
- name: Lint docker-compose
|
||||
run: |
|
||||
docker compose -f docker-compose.yml config
|
||||
|
||||
- name: Lint translations
|
||||
run: |
|
||||
make translations-lint
|
||||
|
||||
59
.github/workflows/mariadb.yml
vendored
Normal file
59
.github/workflows/mariadb.yml
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
---
|
||||
name: CTFd MariaDB CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
mariadb:
|
||||
image: mariadb:10.11
|
||||
env:
|
||||
MYSQL_ROOT_PASSWORD: password
|
||||
MYSQL_DATABASE: ctfd
|
||||
ports:
|
||||
- 3306
|
||||
redis:
|
||||
image: redis
|
||||
ports:
|
||||
- 6379:6379
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ['3.11']
|
||||
|
||||
name: Python ${{ matrix.python-version }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
architecture: x64
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install -r development.txt
|
||||
sudo yarn install --non-interactive
|
||||
|
||||
- name: Test
|
||||
run: |
|
||||
sudo rm -f /etc/boto.cfg
|
||||
make test
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: AKIAIOSFODNN7EXAMPLE
|
||||
AWS_SECRET_ACCESS_KEY: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
|
||||
TESTING_DATABASE_URL: mysql+pymysql://root:password@localhost:${{ job.services.mariadb.ports[3306] }}/ctfd
|
||||
|
||||
- name: Codecov
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
file: ./coverage.xml
|
||||
30
.github/workflows/mirror-core-theme.yml
vendored
Normal file
30
.github/workflows/mirror-core-theme.yml
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
name: Mirror core-theme
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
mirror:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # need full history for subtree
|
||||
|
||||
- name: Setup SSH for deploy key
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
echo "${{ secrets.CORE_THEME_DEPLOY_KEY }}" > ~/.ssh/id_ed25519
|
||||
chmod 600 ~/.ssh/id_ed25519
|
||||
ssh-keyscan github.com >> ~/.ssh/known_hosts
|
||||
|
||||
- name: Setup git identity
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "username@users.noreply.github.com"
|
||||
|
||||
- name: Push subtree
|
||||
run: |
|
||||
git subtree push --prefix="CTFd/themes/core" "git@github.com:CTFd/core-theme.git" main
|
||||
59
.github/workflows/mysql.yml
vendored
Normal file
59
.github/workflows/mysql.yml
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
---
|
||||
name: CTFd MySQL CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:5.7
|
||||
env:
|
||||
MYSQL_ROOT_PASSWORD: password
|
||||
ports:
|
||||
- 3306
|
||||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||
redis:
|
||||
image: redis
|
||||
ports:
|
||||
- 6379:6379
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ['3.11']
|
||||
|
||||
name: Python ${{ matrix.python-version }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
architecture: x64
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install -r development.txt
|
||||
sudo yarn install --non-interactive
|
||||
|
||||
- name: Test
|
||||
run: |
|
||||
sudo rm -f /etc/boto.cfg
|
||||
make test
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: AKIAIOSFODNN7EXAMPLE
|
||||
AWS_SECRET_ACCESS_KEY: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
|
||||
TESTING_DATABASE_URL: mysql+pymysql://root:password@localhost:${{ job.services.mysql.ports[3306] }}/ctfd
|
||||
|
||||
- name: Codecov
|
||||
uses: codecov/codecov-action@v5
|
||||
with:
|
||||
file: ./coverage.xml
|
||||
59
.github/workflows/mysql8.yml
vendored
Normal file
59
.github/workflows/mysql8.yml
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
---
|
||||
name: CTFd MySQL 8.0 CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:8.0
|
||||
env:
|
||||
MYSQL_ROOT_PASSWORD: password
|
||||
ports:
|
||||
- 3306
|
||||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||
redis:
|
||||
image: redis
|
||||
ports:
|
||||
- 6379:6379
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ['3.11']
|
||||
|
||||
name: Python ${{ matrix.python-version }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
architecture: x64
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install -r development.txt
|
||||
sudo yarn install --non-interactive
|
||||
|
||||
- name: Test
|
||||
run: |
|
||||
sudo rm -f /etc/boto.cfg
|
||||
make test
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: AKIAIOSFODNN7EXAMPLE
|
||||
AWS_SECRET_ACCESS_KEY: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
|
||||
TESTING_DATABASE_URL: mysql+pymysql://root:password@localhost:${{ job.services.mysql.ports[3306] }}/ctfd
|
||||
|
||||
- name: Codecov
|
||||
uses: codecov/codecov-action@v5
|
||||
with:
|
||||
file: ./coverage.xml
|
||||
67
.github/workflows/postgres.yml
vendored
Normal file
67
.github/workflows/postgres.yml
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
---
|
||||
name: CTFd Postgres CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
postgres:
|
||||
image: postgres
|
||||
ports:
|
||||
- 5432:5432
|
||||
env:
|
||||
POSTGRES_HOST_AUTH_METHOD: trust
|
||||
POSTGRES_DB: ctfd
|
||||
POSTGRES_PASSWORD: password
|
||||
# Set health checks to wait until postgres has started
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
redis:
|
||||
image: redis
|
||||
ports:
|
||||
- 6379:6379
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ['3.11']
|
||||
|
||||
name: Python ${{ matrix.python-version }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
architecture: x64
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install -r development.txt
|
||||
sudo yarn install --non-interactive
|
||||
|
||||
- name: Test
|
||||
run: |
|
||||
sudo rm -f /etc/boto.cfg
|
||||
make test
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: AKIAIOSFODNN7EXAMPLE
|
||||
AWS_SECRET_ACCESS_KEY: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
|
||||
TESTING_DATABASE_URL: postgres://postgres:password@localhost:${{ job.services.postgres.ports[5432] }}/ctfd
|
||||
|
||||
- name: Codecov
|
||||
uses: codecov/codecov-action@v5
|
||||
with:
|
||||
file: ./coverage.xml
|
||||
|
||||
49
.github/workflows/sqlite.yml
vendored
Normal file
49
.github/workflows/sqlite.yml
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
---
|
||||
name: CTFd SQLite CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ['3.11']
|
||||
|
||||
name: Python ${{ matrix.python-version }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
architecture: x64
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install -r development.txt
|
||||
sudo yarn install --non-interactive
|
||||
sudo yarn global add prettier@1.17.0
|
||||
|
||||
- name: Test
|
||||
run: |
|
||||
sudo rm -f /etc/boto.cfg
|
||||
make test
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: AKIAIOSFODNN7EXAMPLE
|
||||
AWS_SECRET_ACCESS_KEY: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
|
||||
TESTING_DATABASE_URL: 'sqlite://'
|
||||
|
||||
- name: Codecov
|
||||
uses: codecov/codecov-action@v5
|
||||
with:
|
||||
file: ./coverage.xml
|
||||
|
||||
38
.github/workflows/verify-themes.yml
vendored
Normal file
38
.github/workflows/verify-themes.yml
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
---
|
||||
name: Theme Verification
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
name: Theme Verification
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20.19
|
||||
|
||||
- name: Verify admin theme
|
||||
run: |
|
||||
pwd
|
||||
yarn install --non-interactive
|
||||
yarn verify
|
||||
working-directory: ./CTFd/themes/admin
|
||||
|
||||
# TODO: Replace in 4.0 with deprecation of previous core theme
|
||||
- name: Verify core theme
|
||||
run: |
|
||||
pwd
|
||||
yarn install --non-interactive
|
||||
yarn verify
|
||||
working-directory: ./CTFd/themes/core
|
||||
Reference in New Issue
Block a user