Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
dlareau committed Apr 17, 2020
2 parents 6b67d9e + 852f159 commit d95e51a
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 2 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master, development ]
pull_request:
branches: [ master ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
env:
DB_NAME: puzzlehunt_db
DB_USER: hunt
DB_PASSWORD: test
DJANGO_SECRET_KEY: test_secret_key

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

# Runs a single command using the runners shell
- name: compose-build
run: docker-compose build

# Runs a single command using the runners shell
- name: compose-up
run: docker-compose up -d

# Runs a single command using the runners shell
- name: get-container-status
run: docker ps

# Runs a set of commands using the runners shell
- name: run-tests
run: docker-compose exec app coverage run

# Runs a set of commands using the runners shell
- name: get-results
run: docker-compose exec app coverage report
5 changes: 3 additions & 2 deletions huntserver/hunt_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from django.utils import timezone
from django.utils.encoding import smart_str
from django.db.models import F
from django.urls import reverse_lazy
import json
import os
import re
Expand Down Expand Up @@ -91,7 +92,7 @@ def hunt(request, hunt_num):
elif(hunt.is_open):
# see if the team does not belong to the hunt being accessed
if (not request.user.is_authenticated):
return redirect('%s?next=%s' % (settings.LOGIN_URL, request.path))
return redirect('%s?next=%s' % (reverse_lazy(settings.LOGIN_URL), request.path))

elif(team is None or (team.hunt != hunt)):
return render(request, 'access_error.html', {'reason': "team"})
Expand Down Expand Up @@ -263,7 +264,7 @@ def puzzle_view(request, puzzle_id):
# Only allowed access if the hunt is public or if unlocked by team
if(not puzzle.hunt.is_public):
if(not request.user.is_authenticated):
return redirect('%s?next=%s' % (settings.LOGIN_URL, request.path))
return redirect('%s?next=%s' % (reverse_lazy(settings.LOGIN_URL), request.path))

if (not request.user.is_staff):
if(team is None or puzzle not in team.unlocked.all()):
Expand Down

0 comments on commit d95e51a

Please sign in to comment.