-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This reverts commit d3d1536.
- Loading branch information
Showing
291 changed files
with
17,113 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
REDIS_HOST=127.0.0.1 | ||
REDIS_PORT=6379 | ||
REDIS_CACHE_DB=1 | ||
SQL_HOST=127.0.0.1 | ||
SQL_PORT=5432 | ||
SQL_DATABASE=ractf | ||
SQL_USER=ractf | ||
SQL_PASSWORD=ractf | ||
CHALLENGE_SERVER_TYPE=POLARIS | ||
POLARIS_URL=http://127.0.0.1:8080 | ||
POLARIS_USERNAME=polaris | ||
POLARIS_PASSWORD=polaris |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: '' | ||
labels: '' | ||
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. | ||
|
||
**Environment (please complete the following information):** | ||
- OS: [e.g. Centos 8, Debian 10] | ||
- Are you using the docker image? | ||
- Database: [e.g. postgres, mysql] | ||
|
||
**Additional context** | ||
Add any other context about the problem here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
blank_issues_enabled: true | ||
contact_links: | ||
- name: RACTF Discord | ||
url: https://discord.gg/FfW2xXR | ||
about: Check out the RACTF Discord server for advice on using the platform. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: '' | ||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Build Docker Container | ||
|
||
on: push | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Get version name | ||
shell: bash | ||
run: echo "##[set-output name=name;]`echo ${GITHUB_REF#refs/tags/}`" | ||
id: branch | ||
if: startsWith(github.ref, 'refs/tags/') | ||
|
||
- name: Build untagged Docker container | ||
run: docker build . | ||
if: startsWith(github.ref, 'refs/tags/') != true | ||
|
||
- name: Build tagged Docker Container | ||
run: docker build -t ractf/core:${{ steps.branch.outputs.name }} -t ghcr.io/ractf/core:${{ steps.branch.outputs.name }} -t ractf/core:latest -t ghcr.io/ractf/core:latest . | ||
if: startsWith(github.ref, 'refs/tags/') | ||
|
||
- name: Create Sentry release | ||
uses: getsentry/action-release@v1 | ||
env: | ||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | ||
SENTRY_ORG: ${{ secrets.SENTRY_ORG }} | ||
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} | ||
if: startsWith(github.ref, 'refs/tags/') | ||
|
||
- name: Login to Docker Hub | ||
run: docker login --username ractf --password ${{ secrets.password }} | ||
if: startsWith(github.ref, 'refs/tags/') | ||
|
||
|
||
- name: Login to Github Container Registry | ||
run: echo ${{ secrets.ghtoken }} | docker login ghcr.io -u ${{ secrets.ghuser }} --password-stdin | ||
if: startsWith(github.ref, 'refs/tags/') | ||
|
||
|
||
- name: Push to Docker Hub | ||
run: | | ||
docker push ractf/core:${{ steps.branch.outputs.name }} | ||
docker push ractf/core:latest | ||
if: startsWith(github.ref, 'refs/tags/') | ||
|
||
|
||
- name: Push to Github Container Registry | ||
run: | | ||
docker push ghcr.io/ractf/core:${{ steps.branch.outputs.name }} | ||
docker push ghcr.io/ractf/core:latest | ||
if: startsWith(github.ref, 'refs/tags/') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
name: Publish Documentation | ||
|
||
on: push | ||
|
||
jobs: | ||
docs: | ||
runs-on: ubuntu-latest | ||
env: | ||
DJANGO_SETTINGS_MODULE: 'backend.settings.test' | ||
REDIS_PORT: 6379 | ||
REDIS_CONFIG_DB: 1 | ||
REDIS_CACHE_DB: 2 | ||
REDIS_HOST: localhost | ||
SQL_PORT: 5432 | ||
SQL_USER: ractf | ||
SQL_HOST: localhost | ||
SQL_DATABASE: ractf | ||
SQL_PASSWORD: postgres | ||
services: | ||
postgres: | ||
image: postgres:12-alpine | ||
env: | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_EXTENSIONS: citext | ||
POSTGRES_HOST_AUTH_METHOD: trust | ||
POSTGRES_DB: ractf | ||
POSTGRES_USER: ractf | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
ports: | ||
- 5432:5432 | ||
redis: | ||
image: redis:5 | ||
options: >- | ||
--health-cmd "redis-cli ping" | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
ports: | ||
- 6379:6379 | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.9' | ||
|
||
- uses: actions/setup-node@v2-beta | ||
with: | ||
node-version: '14' | ||
|
||
- name: Cache Python modules | ||
uses: actions/cache@v1 | ||
env: | ||
cache-name: cache-node-modules | ||
with: | ||
path: ~/.pip | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/poetry.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.cache-name }}- | ||
${{ runner.os }}-build- | ||
${{ runner.os }}- | ||
- name: Cache node modules | ||
uses: actions/cache@v2 | ||
env: | ||
cache-name: cache-node-modules | ||
with: | ||
path: ~/.npm | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}- | ||
restore-keys: | | ||
${{ runner.os }}-build- | ||
${{ runner.os }}- | ||
- name: Install Poetry | ||
run: curl -sSL https://install.python-poetry.org | python3 - | ||
|
||
- name: Disable Virtualenvs | ||
run: $HOME/.local/bin/poetry config virtualenvs.create false | ||
|
||
- name: Install Python Dependencies | ||
run: $HOME/.local/bin/poetry install --no-interaction --no-ansi | ||
env: | ||
PIP_CACHE_DIR: ~/.pip | ||
|
||
- name: Run Migrations | ||
run: ./manage.py migrate | ||
working-directory: ./src | ||
|
||
- name: Generate OpenAPI schema | ||
run: set -eo pipefail && ./src/manage.py getschema | tee openapi-schema.yml | ||
|
||
- name: Publish API documentation to GitHub | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: openapi-schema.yml | ||
path: openapi-schema.yml | ||
|
||
- name: Trigger docs-site build | ||
if: github.ref == 'refs/heads/master' | ||
run: | | ||
curl -X POST ${{ secrets.WEBHOOK_URL }} \ | ||
-H 'Authorization: token ${{ secrets.WEBHOOK_TOKEN }}' \ | ||
--data '{"event_type": "deploy_docs_site"}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Run Integration Tests | ||
|
||
on: push | ||
|
||
jobs: | ||
integrate: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Disable Container Mount | ||
run: "cat docker-compose.yml | tr '\\n' '\\r' | sed -e 's/ volumes:\\r - .:\\/app/ working_dir: \\/app\\/src\\//' | tr '\\r' '\\n' | tee docker-compose.yml.new && mv docker-compose.yml{.new,}" | ||
|
||
- name: Set Docker-Compose to Upstream | ||
run: "sed -i 's/build: \\./image: ghcr.io\\/ractf\\/core:latest/' docker-compose.yml" | ||
|
||
- name: Start Upstream Container | ||
run: make dev-server | ||
|
||
- name: Wait for Upstream to Boot | ||
run: sleep 10 | ||
|
||
- name: Generate Test Fixtures | ||
run: docker exec -w /app --tty $(docker-compose ps -q backend) make fake-data ARGS="--teams 10 --users 2 --categories 10 --challenges 100 --solves 1000 --zoom" | ||
|
||
- name: Confirm Upstream is Healthy | ||
run: curl -v --fail localhost:8000/api/v2/stats/stats/ | ||
|
||
- name: Shut Down Upstream | ||
run: docker-compose rm -sf | ||
|
||
- name: Swap to Current branch | ||
run: "sed -i 's/image: ghcr.io\\/ractf\\/core:latest/build: \\./' docker-compose.yml" | ||
|
||
- name: Confirm Current Docker Compose | ||
run: cat docker-compose.yml | ||
|
||
- name: Start Current Container | ||
run: make dev-server | ||
|
||
- name: Wait for Current to Boot | ||
run: sleep 10 | ||
|
||
- name: Confirm Current is Healthy | ||
run: curl -v --fail localhost:8000/api/v2/stats/stats/ | ||
|
||
- name: Get Core Logs | ||
run: docker-compose logs backend | ||
if: always() | ||
|
||
- name: Get Sockets Logs | ||
run: docker-compose logs sockets | ||
if: always() | ||
|
||
- name: Clean Up Docker Compose | ||
run: make clean-dev-server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Run Unit Tests | ||
|
||
on: push | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
env: | ||
DJANGO_SETTINGS_MODULE: 'backend.settings.lint' | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.9' | ||
|
||
- name: Cache Python modules | ||
uses: actions/cache@v1 | ||
env: | ||
cache-name: cache-node-modules | ||
with: | ||
path: ~/.pip | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/poetry.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.cache-name }}- | ||
${{ runner.os }}-build- | ||
${{ runner.os }}- | ||
- name: Install Poetry | ||
run: curl -sSL https://install.python-poetry.org | python3 - | ||
|
||
- name: Disable Virtualenvs | ||
run: $HOME/.local/bin/poetry config virtualenvs.create false | ||
|
||
- name: Install Python Dependencies | ||
run: $HOME/.local/bin/poetry install --no-interaction --no-ansi | ||
env: | ||
PIP_CACHE_DIR: ~/.pip | ||
|
||
- name: Run Tests | ||
run: make coverage | ||
|
||
- name: Publish Coverage XML | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: coverage.xml | ||
path: ./coverage.xml |
Oops, something went wrong.