build(deps): bump express from 4.17.1 to 4.21.0 #20
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
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 |