From b01133b35e111bdda179a388c305826c9ca03bda Mon Sep 17 00:00:00 2001 From: Alex Ottr Date: Fri, 12 Apr 2024 22:57:24 +0200 Subject: [PATCH] combine actions --- .../{docker-image.yml => build-and-test.yml} | 34 ++++++++++++++++- .github/workflows/django-tests.yml | 38 ------------------- 2 files changed, 32 insertions(+), 40 deletions(-) rename .github/workflows/{docker-image.yml => build-and-test.yml} (84%) delete mode 100644 .github/workflows/django-tests.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/build-and-test.yml similarity index 84% rename from .github/workflows/docker-image.yml rename to .github/workflows/build-and-test.yml index 2c7ce8d..2b270cc 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/build-and-test.yml @@ -3,9 +3,10 @@ name: Docker Image CI on: push: branches: - - "main" + - '**' pull_request: - branches: ["main"] + branches: + - '**' env: REGISTRY: ghcr.io @@ -13,8 +14,37 @@ env: IMAGE_NAME: ${{ github.repository }} jobs: + + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python 3.12 + uses: actions/setup-python@v2 + with: + python-version: 3.12 + + - name: Install Poetry + run: | + curl -sSL https://install.python-poetry.org | python3 - + + - name: Install dependencies + run: | + poetry install + + - name: Run tests + env: + SECRET_KEY: 'asdf' + DEBUG: 'True' + ALLOWED_HOSTS: 'localhost' + run: | + poetry run python manage.py test + build: runs-on: ubuntu-latest + if: github.event_name == 'push' && github.ref == 'refs/heads/main' permissions: contents: read packages: write # might need to use PAT instead diff --git a/.github/workflows/django-tests.yml b/.github/workflows/django-tests.yml deleted file mode 100644 index 5295c49..0000000 --- a/.github/workflows/django-tests.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Python Tests - -on: - push: - branches: - - '**' - pull_request: - branches: - - '**' - -jobs: - test: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Set up Python 3.12 - uses: actions/setup-python@v2 - with: - python-version: 3.12 - - - name: Install Poetry - run: | - curl -sSL https://install.python-poetry.org | python3 - - - - name: Install dependencies - run: | - poetry install - - - name: Run tests - env: - SECRET_KEY: 'asdf' - DEBUG: 'True' - ALLOWED_HOSTS: 'localhost' - run: | - poetry run python manage.py test \ No newline at end of file