From 93d414673c890279f3429af0fb59963b63d61286 Mon Sep 17 00:00:00 2001 From: phil Date: Sun, 3 Nov 2024 19:26:43 +0100 Subject: [PATCH] CI: build only if the test pass --- .forgejo/workflows/test.yaml | 34 ------------------- .../{build.yaml => test_and_build.yalm} | 30 ++++++++++++++++ 2 files changed, 30 insertions(+), 34 deletions(-) delete mode 100644 .forgejo/workflows/test.yaml rename .forgejo/workflows/{build.yaml => test_and_build.yalm} (74%) diff --git a/.forgejo/workflows/test.yaml b/.forgejo/workflows/test.yaml deleted file mode 100644 index a3831c1..0000000 --- a/.forgejo/workflows/test.yaml +++ /dev/null @@ -1,34 +0,0 @@ -on: - push: - workflow_dispatch: - inputs: - verbose: - description: "Verbose" - required: false - default: false - type: boolean - -jobs: - test: - runs-on: container - container: - image: tiptop:5000/treetrail-backend-ci - volumes: - - "uv_cache:/root/.cache/uv" - - "ca-cert:/etc/containers/certs.d" - services: - treetrail-database: - image: treetrail-database - steps: - - name: Echo env - if: ${{ inputs.verbose }} - run: | - echo '${{ toJSON(env) }}' - - - uses: actions/checkout@v4 - - - name: Install app with 'uv pip install' - run: uv pip install --python=$UV_PROJECT_ENVIRONMENT --no-deps . - - - name: Run tests (API call) - run: pytest -s tests/basic.py diff --git a/.forgejo/workflows/build.yaml b/.forgejo/workflows/test_and_build.yalm similarity index 74% rename from .forgejo/workflows/build.yaml rename to .forgejo/workflows/test_and_build.yalm index 6605e1a..0c72721 100644 --- a/.forgejo/workflows/build.yaml +++ b/.forgejo/workflows/test_and_build.yalm @@ -2,6 +2,11 @@ on: push: workflow_dispatch: inputs: + verbose: + description: "Verbose" + required: false + default: false + type: boolean build: description: "Build container" required: true @@ -9,8 +14,33 @@ on: type: boolean jobs: + test: + runs-on: container + container: + image: tiptop:5000/treetrail-backend-ci + volumes: + - "uv_cache:/root/.cache/uv" + - "ca-cert:/etc/containers/certs.d" + services: + treetrail-database: + image: treetrail-database + steps: + - name: Echo env + if: ${{ inputs.verbose }} + run: | + echo '${{ toJSON(env) }}' + + - uses: actions/checkout@v4 + + - name: Install app with 'uv pip install' + run: uv pip install --python=$UV_PROJECT_ENVIRONMENT --no-deps . + + - name: Run tests (API call) + run: pytest -s tests/basic.py + build: runs-on: container + needs: test steps: - uses: actions/checkout@v4 with: