From 68f400d2cb86c2967bc4cb1bf85ff245d15c4c71 Mon Sep 17 00:00:00 2001 From: Jan Buchar Date: Fri, 31 May 2024 18:38:54 +0200 Subject: [PATCH 1/3] Run a local httpbin in CI --- .github/workflows/_unit_tests.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/_unit_tests.yaml b/.github/workflows/_unit_tests.yaml index 9e92d377b..aeb2d83bd 100644 --- a/.github/workflows/_unit_tests.yaml +++ b/.github/workflows/_unit_tests.yaml @@ -12,6 +12,13 @@ jobs: python-version: ["3.9", "3.10", "3.11", "3.12"] runs-on: ${{ matrix.os }} + services: + httpbin: + image: kennethreitz/httpbin + ports: 80:80 + env: + HTTPBIN_URL: http://httpbin/ + steps: # We need to check out the head commit in case of PRs, and the default ref otherwise (during release). - name: Checkout repository From e04ae65ff6d3b76f29c335ed21a05696cb8726fd Mon Sep 17 00:00:00 2001 From: Jan Buchar Date: Mon, 3 Jun 2024 10:11:17 +0200 Subject: [PATCH 2/3] Fix service definition (let's see what it does) --- .github/workflows/_unit_tests.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/_unit_tests.yaml b/.github/workflows/_unit_tests.yaml index aeb2d83bd..4b3f93446 100644 --- a/.github/workflows/_unit_tests.yaml +++ b/.github/workflows/_unit_tests.yaml @@ -15,7 +15,8 @@ jobs: services: httpbin: image: kennethreitz/httpbin - ports: 80:80 + ports: + - 80:80 env: HTTPBIN_URL: http://httpbin/ From 120e1c1cfc22549c6c315c29f5719a686fe36e3c Mon Sep 17 00:00:00 2001 From: Jan Buchar Date: Mon, 3 Jun 2024 10:34:41 +0200 Subject: [PATCH 3/3] Alternative approach --- .github/workflows/_unit_tests.yaml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/_unit_tests.yaml b/.github/workflows/_unit_tests.yaml index 4b3f93446..51f7c06ff 100644 --- a/.github/workflows/_unit_tests.yaml +++ b/.github/workflows/_unit_tests.yaml @@ -12,13 +12,8 @@ jobs: python-version: ["3.9", "3.10", "3.11", "3.12"] runs-on: ${{ matrix.os }} - services: - httpbin: - image: kennethreitz/httpbin - ports: - - 80:80 env: - HTTPBIN_URL: http://httpbin/ + HTTPBIN_URL: http://127.0.0.1:8080/ steps: # We need to check out the head commit in case of PRs, and the default ref otherwise (during release). @@ -27,6 +22,12 @@ jobs: with: ref: "${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || '' }}" + - name: Run a httpbin in the background + uses: addnab/docker-run-action@v3 + with: + image: kennethreitz/httpbin + options: -d -p 8080:80 + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: