From 3ee1d8560a6fe60306f70635e9e747de0b8c26e6 Mon Sep 17 00:00:00 2001 From: Anne Haley Date: Thu, 17 Oct 2024 15:07:55 +0000 Subject: [PATCH 1/5] ci: update github actions to use services --- .github/workflows/ci.yml | 72 +++++++++++++++++++++++----------------- 1 file changed, 41 insertions(+), 31 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c29ed4ce..71f69f34 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,17 +6,6 @@ on: - master jobs: - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Install Tox - uses: threeal/pipx-install-action@v1.0.0 - with: - packages: tox - - name: Lint - run: tox -e lint - lint-client: runs-on: ubuntu-latest steps: @@ -24,26 +13,47 @@ jobs: - uses: actions/setup-node@v3 - run: cd web && npm i && npm run lint - pytest: + tox: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + tox-env: [lint, test, check-migrations] + services: + postgres: + image: postgres:latest + env: + POSTGRES_DB: django + POSTGRES_PASSWORD: postgres + ports: + - 5432:5432 + rabbitmq: + image: rabbitmq:management + ports: + - 5672:5672 + minio: + image: bitnami/minio:latest + env: + MINIO_ROOT_USER: minioAccessKey + MINIO_ROOT_PASSWORD: minioSecretKey + ports: + - 9000:9000 steps: - - uses: actions/checkout@v3 - - uses: hoverkraft-tech/compose-action@v2.0.1 - with: - compose-file: | - docker-compose.yml - docker-compose.override.yml - - run: | - docker compose exec django tox -e test - - check-migrations: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: hoverkraft-tech/compose-action@v2.0.1 + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 with: - compose-file: | - docker-compose.yml - docker-compose.override.yml - - run: | - docker compose exec django tox -e check-migrations + python-version: "3.11" + - name: Install tox + run: | + pip install --upgrade pip + pip install tox + - name: Run tests + run: | + tox -e ${{ matrix.tox-env }} + env: + DJANGO_DATABASE_URL: postgres://postgres:postgres@localhost:5432/django + DJANGO_MINIO_STORAGE_ENDPOINT: localhost:9000 + DJANGO_HOMEPAGE_REDIRECT_URL: localhost:8080 + DJANGO_MINIO_STORAGE_ACCESS_KEY: minioAccessKey + DJANGO_MINIO_STORAGE_SECRET_KEY: minioSecretKey From 8c90c8f7bd398b48a66a1e10121ec621ac2c21ab Mon Sep 17 00:00:00 2001 From: Anne Haley Date: Thu, 17 Oct 2024 15:15:32 +0000 Subject: [PATCH 2/5] ci: fix environment vars --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 71f69f34..4a6a220d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,6 +54,6 @@ jobs: env: DJANGO_DATABASE_URL: postgres://postgres:postgres@localhost:5432/django DJANGO_MINIO_STORAGE_ENDPOINT: localhost:9000 - DJANGO_HOMEPAGE_REDIRECT_URL: localhost:8080 DJANGO_MINIO_STORAGE_ACCESS_KEY: minioAccessKey DJANGO_MINIO_STORAGE_SECRET_KEY: minioSecretKey + DJANGO_HOMEPAGE_REDIRECT_URL: http://localhost:8080/ From 820cd861115a82d4d8a20cdc1971f8bbeb198a38 Mon Sep 17 00:00:00 2001 From: Anne Haley Date: Thu, 17 Oct 2024 15:30:00 +0000 Subject: [PATCH 3/5] ci: add step to install GDAL --- .github/workflows/ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4a6a220d..bde0a5b8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,6 +48,12 @@ jobs: run: | pip install --upgrade pip pip install tox + - name: Install GDAL + run: | + sudo apt-add-repository ppa:ubuntugis/ubuntugis-unstable + sudo apt-get update + sudo apt-get install gdal-bin libgdal-dev + pip install GDAL==`gdal-config --version` - name: Run tests run: | tox -e ${{ matrix.tox-env }} From 673df3a39d6d985f5aa36939a6348128d82a5636 Mon Sep 17 00:00:00 2001 From: Anne Haley Date: Thu, 17 Oct 2024 15:38:31 +0000 Subject: [PATCH 4/5] ci: switch postgres image to postgis --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bde0a5b8..967525f0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: tox-env: [lint, test, check-migrations] services: postgres: - image: postgres:latest + image: postgis/postgis:14-3.3 env: POSTGRES_DB: django POSTGRES_PASSWORD: postgres From 08271ba9d3e1471cdeafbf8b4888ccebde774df4 Mon Sep 17 00:00:00 2001 From: Anne Haley Date: Thu, 17 Oct 2024 17:54:44 +0000 Subject: [PATCH 5/5] ci: pin versions of ubuntu, python, and ubuntugis --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 967525f0..213977bc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,14 +7,14 @@ on: jobs: lint-client: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 - run: cd web && npm i && npm run lint tox: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 strategy: fail-fast: false matrix: @@ -43,14 +43,14 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: "3.11" + python-version: "3.10" - name: Install tox run: | pip install --upgrade pip pip install tox - name: Install GDAL run: | - sudo apt-add-repository ppa:ubuntugis/ubuntugis-unstable + sudo apt-add-repository ppa:ubuntugis/ppa sudo apt-get update sudo apt-get install gdal-bin libgdal-dev pip install GDAL==`gdal-config --version`