Skip to content

Commit e824ecb

Browse files
committed
chore: make CICD auto discover tests instead of using a tests/ folder
1 parent 6d79262 commit e824ecb

File tree

1 file changed

+50
-50
lines changed

1 file changed

+50
-50
lines changed

.github/workflows/main.yml

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -14,75 +14,75 @@ jobs:
1414
lint:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v4
18-
- uses: astral-sh/setup-uv@v3
19-
with:
20-
version: "0.4.24"
21-
enable-cache: true
17+
- uses: actions/checkout@v4
18+
- uses: astral-sh/setup-uv@v3
19+
with:
20+
version: "0.4.24"
21+
enable-cache: true
2222

23-
- name: pre-commit cache key
24-
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
23+
- name: pre-commit cache key
24+
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
2525

26-
- uses: actions/cache@v4
27-
with:
28-
path: ~/.cache/pre-commit
29-
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
26+
- uses: actions/cache@v4
27+
with:
28+
path: ~/.cache/pre-commit
29+
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
3030

31-
- name: Install Python
32-
run: uv python install
31+
- name: Install Python
32+
run: uv python install
3333

34-
- name: install dependencies
35-
run: uv sync
34+
- name: install dependencies
35+
run: uv sync
3636

3737
# https://github.com/typeddjango/django-stubs/issues/458
38-
- name: create .env file
39-
run: cp example.env .env
38+
- name: create .env file
39+
run: cp example.env .env
4040

4141
unit_test:
4242
needs: [ lint ]
4343
runs-on: ubuntu-latest
4444
steps:
45-
- uses: actions/checkout@v4
46-
- uses: astral-sh/setup-uv@v3
47-
with:
48-
version: "0.4.24"
49-
enable-cache: true
45+
- uses: actions/checkout@v4
46+
- uses: astral-sh/setup-uv@v3
47+
with:
48+
version: "0.4.24"
49+
enable-cache: true
5050

51-
- name: Set up Python
52-
run: uv python install
51+
- name: Set up Python
52+
run: uv python install
5353

54-
- name: install dependencies
55-
run: uv sync
54+
- name: install dependencies
55+
run: uv sync
5656

57-
- name: create .env file
58-
run: cp example.env .env
57+
- name: create .env file
58+
run: cp example.env .env
5959

60-
- name: Run tests
61-
env:
62-
SECRET_KEY: secret
63-
DB_ENGINE: django.db.backends.sqlite3
64-
run: |
65-
cd src
66-
uv run manage.py makemigrations --check
67-
uv run manage.py migrate
68-
uv run manage.py test tests/
60+
- name: Run tests
61+
env:
62+
SECRET_KEY: secret
63+
DB_ENGINE: django.db.backends.sqlite3
64+
run: |
65+
cd src
66+
uv run manage.py makemigrations --check
67+
uv run manage.py migrate
68+
uv run manage.py test
6969
7070
docker:
7171
needs: [ lint, unit_test ]
7272
runs-on: ubuntu-latest
7373
steps:
74-
- uses: actions/checkout@v4
75-
- name: Build docker image
76-
run: |
77-
docker pull $IMAGE_NAME
78-
docker build --pull --cache-from $IMAGE_NAME -t $IMAGE_NAME:latest .
74+
- uses: actions/checkout@v4
75+
- name: Build docker image
76+
run: |
77+
docker pull $IMAGE_NAME
78+
docker build --pull --cache-from $IMAGE_NAME -t $IMAGE_NAME:latest .
7979
80-
- name: Log in into Docker Hub
81-
if: ${{ github.event_name == 'push' }}
82-
run: |
83-
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
80+
- name: Log in into Docker Hub
81+
if: ${{ github.event_name == 'push' }}
82+
run: |
83+
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
8484
85-
- name: Push image to registry
86-
if: ${{ github.event_name == 'push' }}
87-
run: |
88-
docker push $IMAGE_NAME
85+
- name: Push image to registry
86+
if: ${{ github.event_name == 'push' }}
87+
run: |
88+
docker push $IMAGE_NAME

0 commit comments

Comments
 (0)