Skip to content

Commit 2cc1014

Browse files
committed
feat: update to latest gateway
1 parent fc1705e commit 2cc1014

16 files changed

+390
-445
lines changed
Lines changed: 43 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
name: API Gateway integration tests with Pytest
1+
---
2+
name: API Gateway integration tests
23

34
on:
45
push:
@@ -10,91 +11,62 @@ on:
1011
permissions:
1112
contents: read
1213

13-
env:
14-
GATEWAY_CHECKOUT_DIR: "gateway"
15-
S3_ENDPOINT: "https://s3.fr-par.scw.cloud"
16-
S3_REGION: "fr-par"
17-
18-
defaults:
19-
run:
20-
shell: bash
21-
2214
jobs:
23-
test-deployed-gateway:
15+
setup-gateway:
2416
runs-on: self-hosted
25-
container: python:3.11-bullseye
17+
container: python:3.11-bookworm
2618
steps:
2719
- uses: actions/checkout@v3
2820

2921
- uses: ./.github/actions/setup-poetry
3022

31-
- uses: actions/checkout@v3
32-
with:
33-
repository: scaleway/serverless-gateway
34-
path: ${{ env.GATEWAY_CHECKOUT_DIR }}
35-
36-
- name: Install CLI and create config file
37-
uses: scaleway/action-scw@v0.0.1
38-
with:
39-
version: v2.14.0
40-
access-key: ${{ secrets.SCW_ACCESS_KEY }}
41-
secret-key: ${{ secrets.SCW_SECRET_KEY }}
42-
default-project-id: ${{ secrets.SCW_DEFAULT_PROJECT_ID }}
43-
default-organization-id: ${{ secrets.SCW_DEFAULT_ORGANIZATION_ID }}
44-
save-config: true
45-
46-
- name: Install jq
47-
run: apt-get update && apt-get install -y jq
48-
49-
- name: Create Gateway namespace
50-
working-directory: ${{ env.GATEWAY_CHECKOUT_DIR }}
51-
run: |
52-
make create-namespace
53-
until [ $(make check-namespace -s) == ready ]; do sleep 10; done
54-
55-
- name: Create Gateway container
56-
working-directory: ${{ env.GATEWAY_CHECKOUT_DIR }}
57-
# We need to truncate gateway.env as it will override our env vars
58-
run: |
59-
truncate -s 0 gateway.env
60-
make create-container
61-
make deploy-container
62-
until [ $(make check-container -s) == ready ]; do sleep 10; done
23+
- name: Deploy Serverless Gateway
24+
run: poetry run scwgw deploy
6325
env:
64-
SCW_ACCESS_KEY: ${{ secrets.SCW_ACCESS_KEY }}
26+
SCW_DEFAULT_ORGANIZATION_ID: ${{ secrets.SCW_DEFAULT_ORGANIZATION_ID }}
27+
SCW_DEFAULT_PROJECT_ID: ${{ secrets.SCW_DEFAULT_PROJECT_ID }}
6528
SCW_SECRET_KEY: ${{ secrets.SCW_SECRET_KEY }}
66-
S3_BUCKET_NAME: ${{ secrets.GATEWAY_S3_BUCKET_NAME }}
29+
SCW_ACCESS_KEY: ${{ secrets.SCW_ACCESS_KEY }}
6730

68-
- name: Install s3cmd
69-
run: pip install s3cmd
31+
run-tests:
32+
needs:
33+
- setup-gateway
34+
runs-on: self-hosted
35+
container: python:3.11-bookworm
36+
steps:
37+
- uses: actions/checkout@v3
7038

71-
- name: Create S3 bucket
72-
working-directory: ${{ env.GATEWAY_CHECKOUT_DIR }}
73-
run: |
74-
make set-up-s3-cli
75-
make create-s3-bucket
76-
env:
77-
S3_BUCKET_NAME: ${{ secrets.GATEWAY_S3_BUCKET_NAME }}
39+
- uses: ./.github/actions/setup-poetry
7840

7941
- name: Run integration tests
42+
working-directory: tests
8043
run: |
81-
pushd $GATEWAY_CHECKOUT_DIR
82-
export GATEWAY_HOST=$(make gateway-host -s)
83-
popd
84-
poetry run pytest tests/integrations/gateway -n $(nproc --all)
44+
poetry run scwgw remote-config
45+
poetry run pytest integrations/gateway -n $(nproc --all)
8546
env:
86-
SCW_ACCESS_KEY: ${{ secrets.SCW_ACCESS_KEY }}
47+
SCW_DEFAULT_ORGANIZATION_ID: ${{ secrets.SCW_DEFAULT_ORGANIZATION_ID }}
48+
SCW_DEFAULT_PROJECT_ID: ${{ secrets.SCW_DEFAULT_PROJECT_ID }}
8749
SCW_SECRET_KEY: ${{ secrets.SCW_SECRET_KEY }}
88-
GATEWAY_S3_BUCKET_NAME: ${{ secrets.GATEWAY_S3_BUCKET_NAME }}
50+
SCW_ACCESS_KEY: ${{ secrets.SCW_ACCESS_KEY }}
8951

90-
- name: Delete S3 bucket
91-
working-directory: ${{ env.GATEWAY_CHECKOUT_DIR }}
92-
run: make delete-bucket
93-
env:
94-
S3_BUCKET_NAME: ${{ secrets.GATEWAY_S3_BUCKET_NAME }}
95-
if: always()
52+
teardown-gateway:
53+
runs-on: self-hosted
54+
container: python:3.11-bookworm
55+
needs:
56+
- run-tests
9657

97-
- name: Delete Gateway namespace and container
98-
working-directory: ${{ env.GATEWAY_CHECKOUT_DIR }}
99-
run: make delete-namespace
100-
if: always()
58+
# Tolerate errors if no resources found to clean up
59+
continue-on-error: true
60+
61+
steps:
62+
- uses: actions/checkout@v3
63+
64+
- uses: ./.github/actions/setup-poetry
65+
66+
- name: Delete Serverless Gateway
67+
run: poetry run scwgw delete
68+
env:
69+
SCW_DEFAULT_ORGANIZATION_ID: ${{ secrets.SCW_DEFAULT_ORGANIZATION_ID }}
70+
SCW_DEFAULT_PROJECT_ID: ${{ secrets.SCW_DEFAULT_PROJECT_ID }}
71+
SCW_SECRET_KEY: ${{ secrets.SCW_SECRET_KEY }}
72+
SCW_ACCESS_KEY: ${{ secrets.SCW_ACCESS_KEY }}

.github/workflows/pytest-integration.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ permissions:
1313
jobs:
1414
test:
1515
runs-on: self-hosted
16-
container: python:3.11-bullseye
16+
container: python:3.11-bookworm
1717
steps:
1818
- uses: actions/checkout@v3
1919

.github/workflows/pytest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ permissions:
1414
jobs:
1515
test:
1616
runs-on: self-hosted
17-
container: python:3.11-bullseye
17+
container: python:3.11-bookworm
1818
steps:
1919
- uses: actions/checkout@v3
2020

.github/workflows/python-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ permissions:
1111
jobs:
1212
deploy:
1313
runs-on: self-hosted
14-
container: python:3.11-bullseye
14+
container: python:3.11-bookworm
1515
steps:
1616
- uses: actions/checkout@v3
1717

0 commit comments

Comments
 (0)