Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
name: Checks

on:
pull_request_target:
pull_request:
branches:
- '**'
# Allow the Deploy workflow to run this exact same suite as a required gate
# before it builds and ships (see deploy.yml). Defining the checks once, here,
# keeps the pull-request run and the pre-deploy gate from drifting apart.
workflow_call:

jobs:
backend-checks:
Expand All @@ -14,9 +18,6 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
Expand All @@ -31,7 +32,11 @@ jobs:
black --check .
- name: Tests
env:
SECRET_KEY: ${{ secrets.CI_SECRET_KEY }}
# The CI settings only need *a* valid Django key to boot — it signs
# nothing that outlives the test run — so we use a throwaway value
# rather than the production SECRET_KEY. This keeps the real key out
# of CI and lets these checks run on pull requests from forks.
SECRET_KEY: django-insecure-ci-not-a-real-secret
DEBUG: 0
run: python manage.py test --settings=hackathon_site.settings.ci

Expand All @@ -43,15 +48,14 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Use Node.js 16.x
uses: actions/setup-node@v4
with:
node-version: '16.x'
- name: Install dependencies
run: yarn install
- name: Formatting check
run: yarn run prettier-check

dashboard-checks:
runs-on: ubuntu-latest
Expand All @@ -61,9 +65,6 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Use Node.js 16.x
uses: actions/setup-node@v4
with:
Expand All @@ -76,3 +77,5 @@ jobs:
run: yarn run tsc
- name: Tests
run: yarn test --watchAll=false
- name: Build frontend
run: yarn run build
9 changes: 9 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,17 @@ env:
STACK_NAME: makeuoft

jobs:
# Required gate: run the full suite (Black, Django tests, prettier, tsc, jest,
# frontend build) before anything is built or shipped. build/deploy depend on
# this job, so a red commit on develop never reaches production — even one
# pushed directly, bypassing PR review. The checks are defined in checks.yml so
# this gate and the pull-request run can never drift apart.
checks:
uses: ./.github/workflows/checks.yml

build:
runs-on: ubuntu-latest
needs: [ checks ]
outputs:
GITHUB_SHA_SHORT: ${{ steps.sha7.outputs.GITHUB_SHA_SHORT }}

Expand Down
82 changes: 0 additions & 82 deletions .github/workflows/main.yml

This file was deleted.

4 changes: 3 additions & 1 deletion hackathon_site/event/api_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,7 @@ class TeamFilter(filters.FilterSet):
)

team_code = filters.CharFilter(
field_name="team_code", label="Team code", help_text="Team code",
field_name="team_code",
label="Team code",
help_text="Team code",
)
14 changes: 11 additions & 3 deletions hackathon_site/event/api_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,10 @@ def post(self, request, *args, **kwargs):
# Construct response data
response_serializer = TeamSerializer(profile.team)
response_data = response_serializer.data
return Response(data=response_data, status=status.HTTP_201_CREATED,)
return Response(
data=response_data,
status=status.HTTP_201_CREATED,
)


class JoinTeamView(generics.GenericAPIView, mixins.RetrieveModelMixin):
Expand Down Expand Up @@ -200,7 +203,10 @@ def post(self, request, *args, **kwargs):
current_team.delete()
response_serializer = TeamSerializer(profile.team)
response_data = response_serializer.data
return Response(data=response_data, status=status.HTTP_200_OK,)
return Response(
data=response_data,
status=status.HTTP_200_OK,
)


class TeamIncidentListView(
Expand Down Expand Up @@ -295,7 +301,9 @@ def get(self, request, *args, **kwargs):
def delete(self, request, *args, **kwargs):
team = self.get_object()
active_orders = Order.objects.filter(
Q(team=team), ~Q(status="Cancelled"), ~Q(status="Returned"),
Q(team=team),
~Q(status="Cancelled"),
~Q(status="Returned"),
)
if active_orders.exists():
raise ValidationError(
Expand Down
4 changes: 1 addition & 3 deletions hackathon_site/event/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,7 @@ def __init__(self, *args, **kwargs):

def save(self, commit=True):
self.instance = super().save(commit=False)
self.instance.phone_number = re.sub(
"[^0-9]", "", self.instance.phone_number
)
self.instance.phone_number = re.sub("[^0-9]", "", self.instance.phone_number)
if commit:
self.instance.save()
return self.instance
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ class Migration(migrations.Migration):
]

operations = [
migrations.RemoveField(model_name="profile", name="status",),
migrations.RemoveField(
model_name="profile",
name="status",
),
]
5 changes: 4 additions & 1 deletion hackathon_site/event/migrations/0006_profile_phone_number.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name="profile",
name="phone_number",
field=models.CharField(default="8022818076", max_length=20,),
field=models.CharField(
default="8022818076",
max_length=20,
),
preserve_default=False,
),
]
4 changes: 3 additions & 1 deletion hackathon_site/event/migrations/0010_team_credits.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ class Migration(migrations.Migration):

operations = [
migrations.AddField(
model_name="team", name="credits", field=models.IntegerField(default=300),
model_name="team",
name="credits",
field=models.IntegerField(default=300),
),
]
Loading
Loading