From 9939b97b5ae8286f4901523581ace3d93f77a0d8 Mon Sep 17 00:00:00 2001 From: Scott Hiett Date: Fri, 4 Aug 2023 00:12:20 +0100 Subject: [PATCH 1/9] Testing now builds --- .github/workflows/test.yml | 45 +++++++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b19d8af..4181027 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,8 +2,8 @@ name: Test @upstash/redis compatability on: workflow_dispatch: push: - paths: - - 'lib/**' +# paths: +# - 'lib/**' schedule: - cron: '0 12 * * *' @@ -11,18 +11,30 @@ env: SRH_TOKEN: example_token jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout SRH code + uses: actions/checkout@v3 + + - name: Build Dockerfile + run: docker build -t hiett/serverless-redis-http:latest . + + - name: Export to TAR + run: docker save hiett/serverless-redis-http:latest -o /tmp/serverless-redis-http.tar + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: serverless-redis-http + path: /tmp/serverless-redis-http.tar + container-job: runs-on: ubuntu-latest container: denoland/deno services: redis: image: redis/redis-stack-server:6.2.6-v6 # 6.2 is the Upstash compatible Redis version - srh: - image: hiett/serverless-redis-http:latest - env: - SRH_MODE: env - SRH_TOKEN: ${{ env.SRH_TOKEN }} - SRH_CONNECTION_STRING: redis://redis:6379 steps: - name: Checkout code @@ -30,6 +42,23 @@ jobs: with: repository: upstash/upstash-redis + - name: Download SRH artifact + uses: actions/download-artifact@v3 + with: + name: serverless-redis-http + path: /tmp + + - name: Load SRH image + run: | + docker load --input /tmp/serverless-redis-http.tar + docker image ls -a + + - name: Run SRH container + uses: addnab/docker-run-action@v3 + with: + image: hiett/serverless-redis-http:latest + options: -it -d -e SRH_MODE=env -e SRH_TOKEN=${{ env.SRH_TOKEN }} -e SRH_CONNECTION_STRING="redis://redis:6379" + # The following tests fail because of bugs with Upstash's implementation of Redis, NOT because of our library # So we remove them from the test suite - name: Remove JSON tests From 6cb95a7bc6789190958bd7809c1feff6ec2e0010 Mon Sep 17 00:00:00 2001 From: Scott Hiett Date: Fri, 4 Aug 2023 00:13:25 +0100 Subject: [PATCH 2/9] Add needs build requirement --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4181027..20b586c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,6 +32,7 @@ jobs: container-job: runs-on: ubuntu-latest container: denoland/deno + needs: build services: redis: image: redis/redis-stack-server:6.2.6-v6 # 6.2 is the Upstash compatible Redis version From c952ee70905bf27fb468fc81e4e4880504f764d5 Mon Sep 17 00:00:00 2001 From: Scott Hiett Date: Fri, 4 Aug 2023 00:17:08 +0100 Subject: [PATCH 3/9] Point to docker path directly --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 20b586c..02b757a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -51,8 +51,8 @@ jobs: - name: Load SRH image run: | - docker load --input /tmp/serverless-redis-http.tar - docker image ls -a + /usr/bin/docker load --input /tmp/serverless-redis-http.tar + /usr/bin/docker image ls -a - name: Run SRH container uses: addnab/docker-run-action@v3 From 278252224b95e16c122c14a37ebf673b03b71971 Mon Sep 17 00:00:00 2001 From: Scott Hiett Date: Fri, 4 Aug 2023 00:25:57 +0100 Subject: [PATCH 4/9] Move to a non-container ran job --- .github/workflows/test.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 02b757a..b2bc4ff 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,11 +31,12 @@ jobs: container-job: runs-on: ubuntu-latest - container: denoland/deno needs: build services: redis: image: redis/redis-stack-server:6.2.6-v6 # 6.2 is the Upstash compatible Redis version + ports: + - 6379:6379 steps: - name: Checkout code @@ -43,6 +44,10 @@ jobs: with: repository: upstash/upstash-redis + - uses: denoland/setup-deno@v1 + with: + deno-version: v1.x + - name: Download SRH artifact uses: actions/download-artifact@v3 with: @@ -51,14 +56,14 @@ jobs: - name: Load SRH image run: | - /usr/bin/docker load --input /tmp/serverless-redis-http.tar - /usr/bin/docker image ls -a + docker load --input /tmp/serverless-redis-http.tar + docker image ls -a - name: Run SRH container uses: addnab/docker-run-action@v3 with: image: hiett/serverless-redis-http:latest - options: -it -d -e SRH_MODE=env -e SRH_TOKEN=${{ env.SRH_TOKEN }} -e SRH_CONNECTION_STRING="redis://redis:6379" + options: -it -d -p 8080:80 -e SRH_MODE=env -e SRH_TOKEN=${{ env.SRH_TOKEN }} -e SRH_CONNECTION_STRING="redis://redis:6379" # The following tests fail because of bugs with Upstash's implementation of Redis, NOT because of our library # So we remove them from the test suite @@ -71,5 +76,5 @@ jobs: - name: Run @upstash/redis Test Suite run: deno test -A ./pkg env: - UPSTASH_REDIS_REST_URL: http://srh:80 + UPSTASH_REDIS_REST_URL: http://localhost:8080 UPSTASH_REDIS_REST_TOKEN: ${{ env.SRH_TOKEN }} \ No newline at end of file From db3de591ac4649a5aa3db1fd44310036b0e9c08d Mon Sep 17 00:00:00 2001 From: Scott Hiett Date: Fri, 4 Aug 2023 00:46:40 +0100 Subject: [PATCH 5/9] Docker run networking improvements --- .github/workflows/test.yml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b2bc4ff..3ee8da9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -35,8 +35,6 @@ jobs: services: redis: image: redis/redis-stack-server:6.2.6-v6 # 6.2 is the Upstash compatible Redis version - ports: - - 6379:6379 steps: - name: Checkout code @@ -57,13 +55,19 @@ jobs: - name: Load SRH image run: | docker load --input /tmp/serverless-redis-http.tar - docker image ls -a + docker image ls -a | grep serverless-redis-http + # Placed inside the same docker network as the service container with job.container.network, at which point + # it can directly address Redis. We still need to expose SRH's port to the host machine, however, so that + # we can run tests against it. - name: Run SRH container - uses: addnab/docker-run-action@v3 - with: - image: hiett/serverless-redis-http:latest - options: -it -d -p 8080:80 -e SRH_MODE=env -e SRH_TOKEN=${{ env.SRH_TOKEN }} -e SRH_CONNECTION_STRING="redis://redis:6379" + run: > + docker run -it -d -p 8080:80 + --network ${{ job.container.network }} + -e SRH_MODE=env + -e SRH_TOKEN=${{ env.SRH_TOKEN }} + -e SRH_CONNECTION_STRING="redis://redis:6379" + hiett/serverless-redis-http:latest # The following tests fail because of bugs with Upstash's implementation of Redis, NOT because of our library # So we remove them from the test suite From 050069e71e4e3c940878f22708ae5324ecda122d Mon Sep 17 00:00:00 2001 From: Scott Hiett Date: Fri, 4 Aug 2023 00:58:38 +0100 Subject: [PATCH 6/9] syntax mistake in action fixed --- .github/workflows/test.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3ee8da9..452bfa3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -61,12 +61,12 @@ jobs: # it can directly address Redis. We still need to expose SRH's port to the host machine, however, so that # we can run tests against it. - name: Run SRH container - run: > - docker run -it -d -p 8080:80 - --network ${{ job.container.network }} - -e SRH_MODE=env - -e SRH_TOKEN=${{ env.SRH_TOKEN }} - -e SRH_CONNECTION_STRING="redis://redis:6379" + run: \ + docker run -it -d -p 8080:80 \ + --network ${{ job.container.network }} \ + -e SRH_MODE=env \ + -e SRH_TOKEN=${{ env.SRH_TOKEN }} \ + -e SRH_CONNECTION_STRING="redis://redis:6379" \ hiett/serverless-redis-http:latest # The following tests fail because of bugs with Upstash's implementation of Redis, NOT because of our library From 009dba07658d293a6af73f97d63a8c88b4c9257d Mon Sep 17 00:00:00 2001 From: Scott Hiett Date: Fri, 4 Aug 2023 01:02:15 +0100 Subject: [PATCH 7/9] Minor fix --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 452bfa3..66a079c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -61,7 +61,7 @@ jobs: # it can directly address Redis. We still need to expose SRH's port to the host machine, however, so that # we can run tests against it. - name: Run SRH container - run: \ + run: | docker run -it -d -p 8080:80 \ --network ${{ job.container.network }} \ -e SRH_MODE=env \ From 917a91925f26099a6fb6aa3eac9a1faf90267624 Mon Sep 17 00:00:00 2001 From: Scott Hiett Date: Fri, 4 Aug 2023 01:07:11 +0100 Subject: [PATCH 8/9] Move to one line --- .github/workflows/test.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 66a079c..b120dec 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -62,12 +62,7 @@ jobs: # we can run tests against it. - name: Run SRH container run: | - docker run -it -d -p 8080:80 \ - --network ${{ job.container.network }} \ - -e SRH_MODE=env \ - -e SRH_TOKEN=${{ env.SRH_TOKEN }} \ - -e SRH_CONNECTION_STRING="redis://redis:6379" \ - hiett/serverless-redis-http:latest + docker run -it -d -p 8080:80 --network ${{ job.container.network }} -e SRH_MODE=env -e SRH_TOKEN=${{ env.SRH_TOKEN }} -e SRH_CONNECTION_STRING="redis://redis:6379" hiett/serverless-redis-http:latest # The following tests fail because of bugs with Upstash's implementation of Redis, NOT because of our library # So we remove them from the test suite From a77abdf71d4566e6c95e9f55e4ad37d57525443c Mon Sep 17 00:00:00 2001 From: Scott Hiett Date: Fri, 4 Aug 2023 01:18:19 +0100 Subject: [PATCH 9/9] Re-enable filter --- .github/workflows/test.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b120dec..db0e5ee 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,8 +2,11 @@ name: Test @upstash/redis compatability on: workflow_dispatch: push: -# paths: -# - 'lib/**' + paths: + - 'lib/**' + - 'Dockerfile' + - 'mix.exs' + - 'mix.lock' schedule: - cron: '0 12 * * *'