From be7a1d080a59aae4ccb170e36c01594b62ebebf8 Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Wed, 14 Aug 2024 22:49:36 +0100 Subject: [PATCH] Combine the two workflows so publish can depend on test --- .../{publish.yml => test-and-publish.yml} | 26 +++++++++++++++++-- .github/workflows/test.yml | 23 ---------------- 2 files changed, 24 insertions(+), 25 deletions(-) rename .github/workflows/{publish.yml => test-and-publish.yml} (88%) delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/test-and-publish.yml similarity index 88% rename from .github/workflows/publish.yml rename to .github/workflows/test-and-publish.yml index d785224..e89df20 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/test-and-publish.yml @@ -1,4 +1,4 @@ -name: Build and Push Docker +name: Run Tests on: push: @@ -14,10 +14,32 @@ env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} -# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu. jobs: + + # Core test runner + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.11 + cache: pip + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install -r requirements.txt + - name: Run tests + run: | + python tests/test.py + + build-and-push-images: runs-on: ubuntu-latest + needs: test # Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job. permissions: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 20a9d56..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Run Tests - -on: [push] - -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: 3.11 - cache: pip - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install -r requirements.txt - - name: Run tests - run: | - python tests/test.py \ No newline at end of file