diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 26086d2..6adfdb3 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -1,46 +1,46 @@ name: Create and publish a Docker image on: - push: - branches: ['main'] + push: + branches: ["main"] env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} jobs: - build-and-push-image: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write - steps: - - name: Checkout repository - uses: actions/checkout@v2 + steps: + - name: Checkout repository + uses: actions/checkout@v2 - - name: Log in to the Container registry - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + - name: Log in to the Container registry + uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - flavor: | - latest=true - tags: | - type=ref,event=branch - type=sha + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + flavor: | + latest=true + tags: | + type=ref,event=branch + type=sha - - name: Build and push Docker image - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + - name: Build and push Docker image + uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/docker-test-build.yml b/.github/workflows/docker-test-build.yml index 19b9d52..0027d29 100644 --- a/.github/workflows/docker-test-build.yml +++ b/.github/workflows/docker-test-build.yml @@ -1,29 +1,29 @@ name: Docker test build on: - pull_request: - push: - branches: - - main + pull_request: + push: + branches: + - main concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true permissions: - contents: read + contents: read jobs: - build-image: - runs-on: ubuntu-latest + build-image: + runs-on: ubuntu-latest - # steps taken (and trimmed) from docker-publish.yml - steps: - - name: Checkout repository - uses: actions/checkout@v2 + # steps taken (and trimmed) from docker-publish.yml + steps: + - name: Checkout repository + uses: actions/checkout@v2 - - name: Build and push Docker image - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc - with: - context: . - push: false + - name: Build and push Docker image + uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + with: + context: . + push: false diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 42a0113..ebc087a 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -1,23 +1,23 @@ name: Linters on: - pull_request: - push: - branches: - - main + pull_request: + push: + branches: + - main concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true permissions: - contents: read + contents: read jobs: - black: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: black - uses: psf/black@stable + black: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: black + uses: psf/black@stable diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9ed0b00..4bdcd98 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,70 +1,70 @@ name: Tests on: - pull_request: - push: - branches: - - main + pull_request: + push: + branches: + - main concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true permissions: - contents: read + contents: read env: - DJANGO_SETTINGS_MODULE: tracdjangoplugin.settings_tests - # passlib has a conditional import for `crypt` which is going away in python 3.13 - # and therefore throwing warnings - PYTHONWARNINGS: > - error, - default:::passlib.utils, + DJANGO_SETTINGS_MODULE: tracdjangoplugin.settings_tests + # passlib has a conditional import for `crypt` which is going away in python 3.13 + # and therefore throwing warnings + PYTHONWARNINGS: > + error, + default:::passlib.utils, jobs: - noshadows: - runs-on: ubuntu-24.04 - steps: - - name: Checkout - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - run: pip install "tinycss2>=1.2.0" - - run: python noshadows.py --tests + noshadows: + runs-on: ubuntu-24.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + - run: pip install "tinycss2>=1.2.0" + - run: python noshadows.py --tests - tracdjangoplugin: - runs-on: ubuntu-24.04 - steps: - - name: Checkout - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - name: Install system package dependencies - run: | - sudo apt-get update - sudo apt-get -y install subversion - - name: Install requirements - run: python -m pip install -r requirements.txt - - name: Run tests - run: python -m django test tracdjangoplugin.tests + tracdjangoplugin: + runs-on: ubuntu-24.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Install system package dependencies + run: | + sudo apt-get update + sudo apt-get -y install subversion + - name: Install requirements + run: python -m pip install -r requirements.txt + - name: Run tests + run: python -m django test tracdjangoplugin.tests - traccheck: - runs-on: ubuntu-24.04 - steps: - - name: Checkout - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - name: Install system package dependencies - run: | - sudo apt-get update - sudo apt-get -y install subversion - - name: Install requirements - run: python -m pip install -r requirements.txt - - name: Lint Trac configuration - run: python traccheck.py lint trac-env/ - - name: Check frozen Trac components - run: python traccheck.py components --check .TRACFREEZE.txt trac-env/ + traccheck: + runs-on: ubuntu-24.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Install system package dependencies + run: | + sudo apt-get update + sudo apt-get -y install subversion + - name: Install requirements + run: python -m pip install -r requirements.txt + - name: Lint Trac configuration + run: python traccheck.py lint trac-env/ + - name: Check frozen Trac components + run: python traccheck.py components --check .TRACFREEZE.txt trac-env/ diff --git a/docker-compose.yml b/docker-compose.yml index 7c5bbc9..c2578b7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,26 +1,33 @@ services: - trac: - image: ghcr.io/django/code.djangoproject.com:latest - # Comment out to use the ghcr.io image: - build: - context: ./ - dockerfile: Dockerfile - command: ["gunicorn", "--bind", "0:9000", "--reload", "tracdjangoplugin.wsgi"] - environment: - - TRAC_INI_database=postgres://code.djangoproject:secret@db/code.djangoproject - - SECRETS_FILE=/code/secrets.json - volumes: - - ./:/code/ - ports: - - 9000:9000 - depends_on: - - db - db: - image: postgres:14-alpine - ports: - # Port 5435 might be handy for loading trac.sql from the djangoproject.com repo - - 5435:5432 - environment: - - POSTGRES_USER=code.djangoproject - - POSTGRES_PASSWORD=secret - - POSTGRES_DB=code.djangoproject + trac: + image: ghcr.io/django/code.djangoproject.com:latest + # Comment out to use the ghcr.io image: + build: + context: ./ + dockerfile: Dockerfile + command: + [ + "gunicorn", + "--bind", + "0:9000", + "--reload", + "tracdjangoplugin.wsgi", + ] + environment: + - TRAC_INI_database=postgres://code.djangoproject:secret@db/code.djangoproject + - SECRETS_FILE=/code/secrets.json + volumes: + - ./:/code/ + ports: + - 9000:9000 + depends_on: + - db + db: + image: postgres:14-alpine + ports: + # Port 5435 might be handy for loading trac.sql from the djangoproject.com repo + - 5435:5432 + environment: + - POSTGRES_USER=code.djangoproject + - POSTGRES_PASSWORD=secret + - POSTGRES_DB=code.djangoproject