From 338b2d10e353126f1012999c71e945816d4ff2bd Mon Sep 17 00:00:00 2001 From: spwoodcock Date: Mon, 4 Sep 2023 17:34:22 +0100 Subject: [PATCH 1/7] ci: use head_ref if PR, else ref_name --- .github/workflows/pytest.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 96a06e7099..b7120d5d26 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -21,10 +21,10 @@ jobs: test: runs-on: ubuntu-latest environment: - name: ${{ github.ref_name }} + name: ${{ github.head_ref || github.ref_name }} container: - image: ghcr.io/hotosm/fmtm/backend:ci-${{ github.ref_name }} + image: ghcr.io/hotosm/fmtm/backend:ci-${{ github.head_ref || github.ref_name }} env: ODK_CENTRAL_URL: https://central-proxy ODK_CENTRAL_USER: test@hotosm.org From 6d5630fb77cfebdf38f34fcee3b9a95c122c6937 Mon Sep 17 00:00:00 2001 From: spwoodcock Date: Mon, 4 Sep 2023 17:39:52 +0100 Subject: [PATCH 2/7] ci: use base_ref over head_ref for PRs --- .github/workflows/pytest.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index b7120d5d26..deacc52e0a 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -21,10 +21,10 @@ jobs: test: runs-on: ubuntu-latest environment: - name: ${{ github.head_ref || github.ref_name }} + name: ${{ github.base_ref || github.ref_name }} container: - image: ghcr.io/hotosm/fmtm/backend:ci-${{ github.head_ref || github.ref_name }} + image: ghcr.io/hotosm/fmtm/backend:ci-${{ github.base_ref || github.ref_name }} env: ODK_CENTRAL_URL: https://central-proxy ODK_CENTRAL_USER: test@hotosm.org From bd63436f8dc4419aa41e02211912219960c280e4 Mon Sep 17 00:00:00 2001 From: spwoodcock Date: Mon, 4 Sep 2023 17:51:37 +0100 Subject: [PATCH 3/7] ci: pull/pr refs try with gitlab conditionals --- .github/workflows/pytest.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index deacc52e0a..0ff7686dbe 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -21,10 +21,10 @@ jobs: test: runs-on: ubuntu-latest environment: - name: ${{ github.base_ref || github.ref_name }} + name: ${{ github.event_name == 'push' && github.ref_name || github.base_ref }} container: - image: ghcr.io/hotosm/fmtm/backend:ci-${{ github.base_ref || github.ref_name }} + image: ghcr.io/hotosm/fmtm/backend:ci-${{ github.event_name == 'push' && github.ref_name || github.base_ref }} env: ODK_CENTRAL_URL: https://central-proxy ODK_CENTRAL_USER: test@hotosm.org From decad84ce596360774250735cfff11e8b9fabe48 Mon Sep 17 00:00:00 2001 From: spwoodcock Date: Mon, 4 Sep 2023 17:53:17 +0100 Subject: [PATCH 4/7] ci: test hardcoding environment --- .github/workflows/pytest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 0ff7686dbe..d247b89e0e 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -21,7 +21,7 @@ jobs: test: runs-on: ubuntu-latest environment: - name: ${{ github.event_name == 'push' && github.ref_name || github.base_ref }} + name: development container: image: ghcr.io/hotosm/fmtm/backend:ci-${{ github.event_name == 'push' && github.ref_name || github.base_ref }} From 14cf41f61725ac357dfccde50b1e00ed334efe1f Mon Sep 17 00:00:00 2001 From: spwoodcock Date: Mon, 4 Sep 2023 18:04:05 +0100 Subject: [PATCH 5/7] ci: set pytest environment to 'test' --- .github/workflows/pytest.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index d247b89e0e..b8af7cf9de 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -21,10 +21,10 @@ jobs: test: runs-on: ubuntu-latest environment: - name: development + name: test container: - image: ghcr.io/hotosm/fmtm/backend:ci-${{ github.event_name == 'push' && github.ref_name || github.base_ref }} + image: ghcr.io/hotosm/fmtm/backend:ci-${{ github.base_ref || github.ref_name }} env: ODK_CENTRAL_URL: https://central-proxy ODK_CENTRAL_USER: test@hotosm.org From 4d705decc535f7f9f239e50c73cc8c83e2643b5b Mon Sep 17 00:00:00 2001 From: spwoodcock Date: Mon, 4 Sep 2023 18:09:12 +0100 Subject: [PATCH 6/7] ci: fix pytest workflow, use env vars --- .github/workflows/pytest.yml | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index b8af7cf9de..d5d33fe383 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -26,18 +26,12 @@ jobs: container: image: ghcr.io/hotosm/fmtm/backend:ci-${{ github.base_ref || github.ref_name }} env: - ODK_CENTRAL_URL: https://central-proxy - ODK_CENTRAL_USER: test@hotosm.org - ODK_CENTRAL_PASSWD: odk - OSM_CLIENT_ID: test - OSM_CLIENT_SECRET: test - OSM_SECRET_KEY: test - # Fix why env. vars not working below - # OSM_CLIENT_ID: ${{ env.OSM_TEST_CLIENT_ID }} - # OSM_CLIENT_SECRET: ${{ env.OSM_TEST_CLIENT_SECRET }} - # OSM_SECRET_KEY: ${{ env.OSM_TEST_SECRET_KEY }} - # FRONTEND_MAIN_URL: "ui-main:8080" - # FRONTEND_MAP_URL: "ui-map:8081" + ODK_CENTRAL_URL: ${{ env.ODK_CENTRAL_URL }} + ODK_CENTRAL_USER: ${{ env.ODK_CENTRAL_USER }} + ODK_CENTRAL_PASSWD: ${{ env.ODK_CENTRAL_PASSWD }} + OSM_CLIENT_ID: ${{ env.OSM_CLIENT_ID }} + OSM_CLIENT_SECRET: ${{ env.OSM_CLIENT_SECRET }} + OSM_SECRET_KEY: ${{ env.OSM_SECRET_KEY }} options: --user root services: From 0d02670aa9916e80148f8ea4f54c27b03d9b761d Mon Sep 17 00:00:00 2001 From: spwoodcock Date: Mon, 4 Sep 2023 18:14:10 +0100 Subject: [PATCH 7/7] ci: use vars instead of env for environment --- .github/workflows/pytest.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index d5d33fe383..41f1d289b6 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -26,12 +26,12 @@ jobs: container: image: ghcr.io/hotosm/fmtm/backend:ci-${{ github.base_ref || github.ref_name }} env: - ODK_CENTRAL_URL: ${{ env.ODK_CENTRAL_URL }} - ODK_CENTRAL_USER: ${{ env.ODK_CENTRAL_USER }} - ODK_CENTRAL_PASSWD: ${{ env.ODK_CENTRAL_PASSWD }} - OSM_CLIENT_ID: ${{ env.OSM_CLIENT_ID }} - OSM_CLIENT_SECRET: ${{ env.OSM_CLIENT_SECRET }} - OSM_SECRET_KEY: ${{ env.OSM_SECRET_KEY }} + ODK_CENTRAL_URL: ${{ vars.ODK_CENTRAL_URL }} + ODK_CENTRAL_USER: ${{ vars.ODK_CENTRAL_USER }} + ODK_CENTRAL_PASSWD: ${{ vars.ODK_CENTRAL_PASSWD }} + OSM_CLIENT_ID: ${{ vars.OSM_CLIENT_ID }} + OSM_CLIENT_SECRET: ${{ vars.OSM_CLIENT_SECRET }} + OSM_SECRET_KEY: ${{ vars.OSM_SECRET_KEY }} options: --user root services: