Skip to content

Commit f2a0832

Browse files
authored
ci(NoTicket): use core setup action in tests (#449)
1 parent 56b1137 commit f2a0832

File tree

5 files changed

+10
-165
lines changed

5 files changed

+10
-165
lines changed

.github/resources/core/README.md

Lines changed: 0 additions & 26 deletions
This file was deleted.

.github/resources/core/config.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

.github/resources/core/default.conf

Lines changed: 0 additions & 17 deletions
This file was deleted.

.github/resources/core/docker-compose.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

.github/workflows/integration-tests-core.yml

Lines changed: 10 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,21 @@ on:
4141
secrets:
4242
SLACK_BOT_TOKEN:
4343
required: false
44-
env:
45-
DEFAULT_IMAGE_TAG: ${{ vars.DEFAULT_CORE_IMAGE_TAG }}
4644
jobs:
4745
run-core-integration-tests:
4846
runs-on: ${{ inputs.os_name }}
49-
env:
50-
DOCKER_COMPOSE_FILE: ${{ github.workspace }}/.github/resources/core/docker-compose.yml
51-
SERVICE_PORT: 3473
52-
SERVICE_URL: http://localhost:3473
53-
MAX_RETRIES: 30
54-
RETRY_INTERVAL: 2
5547
steps:
5648
- name: Check out code
5749
uses: actions/checkout@v4
5850
with:
5951
repository: 'firebolt-db/firebolt-python-sdk'
6052

53+
- name: Setup Firebolt Core
54+
id: setup-core
55+
uses: firebolt-db/action-setup-core@main
56+
with:
57+
tag_version: ${{ inputs.tag_version || vars.DEFAULT_CORE_IMAGE_TAG }}
58+
6159
- name: Set up Python
6260
uses: actions/setup-python@v5
6361
with:
@@ -68,76 +66,6 @@ jobs:
6866
python -m pip install --upgrade pip
6967
pip install ".[dev]"
7068
71-
- name: Log in to GitHub Container Registry
72-
uses: docker/login-action@v3
73-
with:
74-
registry: ghcr.io
75-
username: ${{ github.actor }}
76-
password: ${{ secrets.GITHUB_TOKEN }}
77-
78-
- name: Set up Docker Buildx
79-
uses: docker/setup-buildx-action@v3
80-
81-
- name: Cache Docker layers
82-
uses: actions/cache@v3
83-
with:
84-
path: /tmp/.buildx-cache
85-
key: ${{ runner.os }}-buildx-${{ github.sha }}
86-
restore-keys: |
87-
${{ runner.os }}-buildx-
88-
89-
- name: Write certificate and certificate key to file
90-
run: |
91-
mkdir "${{ github.workspace }}/.github/resources/core/certs"
92-
pip install trustme
93-
# Generate a self-signed certificate for localhost
94-
python3 -m trustme -d "${{ github.workspace }}/.github/resources/core/certs/"
95-
96-
- name: Install certs to keystore
97-
run: |
98-
sudo cp ${GITHUB_WORKSPACE}/.github/resources/core/certs/client.pem /usr/local/share/ca-certificates/client.crt
99-
sudo update-ca-certificates
100-
101-
# if no image tag was passed in, then use the image tag from the defaults
102-
- name: Set image tag
103-
id: set-tag
104-
run: |
105-
IMAGE_TAG="${{ inputs.tag_version }}"
106-
if [ -z "$IMAGE_TAG" ]; then
107-
IMAGE_TAG="$DEFAULT_IMAGE_TAG"
108-
fi
109-
echo "tag=$IMAGE_TAG" >> $GITHUB_OUTPUT
110-
111-
- name: Prepare docker-compose.yml
112-
run: |
113-
if [ ! -f "$DOCKER_COMPOSE_FILE" ]; then
114-
echo "Error: Docker compose file not found at $DOCKER_COMPOSE_FILE"
115-
exit 1
116-
fi
117-
sed -i "s|\${IMAGE_TAG}|${{ steps.set-tag.outputs.tag }}|g" "$DOCKER_COMPOSE_FILE"
118-
sed -i "s|\${BASE_DIR}|${{ github.workspace }}|g" "$DOCKER_COMPOSE_FILE"
119-
echo "Docker compose file prepared:"
120-
cat "$DOCKER_COMPOSE_FILE"
121-
122-
- name: Start service container
123-
run: |
124-
docker compose -f "$DOCKER_COMPOSE_FILE" up -d
125-
docker compose -f "$DOCKER_COMPOSE_FILE" ps
126-
127-
- name: Wait for service to be ready
128-
run: |
129-
for i in $(seq 1 $MAX_RETRIES); do
130-
if curl --silent --fail "$SERVICE_URL" --data-binary "SELECT 1" | grep -q "1"; then
131-
echo "Service is up and responding!"
132-
exit 0
133-
fi
134-
echo "Waiting for service... ($i/$MAX_RETRIES)"
135-
sleep $RETRY_INTERVAL
136-
done
137-
echo "Error: Service failed to start within timeout"
138-
docker compose -f "$DOCKER_COMPOSE_FILE" logs
139-
exit 1
140-
14169
- name: Run integration tests HTTP
14270
env:
14371
SERVICE_ID: ${{ secrets.FIREBOLT_CLIENT_ID_STG_NEW_IDN }}
@@ -147,7 +75,7 @@ jobs:
14775
STOPPED_ENGINE_NAME: ""
14876
API_ENDPOINT: ""
14977
ACCOUNT_NAME: ""
150-
CORE_URL: "http://localhost:3473"
78+
CORE_URL: ${{ steps.setup-core.outputs.service_url }}
15179
run: |
15280
pytest -o log_cli=true -o log_cli_level=WARNING tests/integration -k "core" --alluredir=allure-results/
15381
@@ -160,15 +88,10 @@ jobs:
16088
STOPPED_ENGINE_NAME: ""
16189
API_ENDPOINT: ""
16290
ACCOUNT_NAME: ""
163-
CORE_URL: "https://localhost:443"
91+
CORE_URL: ${{ steps.setup-core.outputs.service_https_url }}
16492
run: |
16593
pytest -o log_cli=true -o log_cli_level=WARNING tests/integration -k "core" --alluredir=allure-results-https/
16694
167-
- name: Stop container
168-
if: always()
169-
run: |
170-
docker compose -f "$DOCKER_COMPOSE_FILE" down
171-
17295
# Need to pull the pages branch in order to fetch the previous runs
17396
- name: Get Allure history
17497
uses: actions/checkout@v4
@@ -184,7 +107,7 @@ jobs:
184107
continue-on-error: true
185108
with:
186109
github-key: ${{ secrets.GITHUB_TOKEN }}
187-
test-type: integration
110+
test-type: core
188111
allure-dir: allure-results
189112
pages-branch: gh-pages
190113
repository-name: python-sdk
@@ -195,7 +118,7 @@ jobs:
195118
continue-on-error: true
196119
with:
197120
github-key: ${{ secrets.GITHUB_TOKEN }}
198-
test-type: integration_https
121+
test-type: core_https
199122
allure-dir: allure-results-https
200123
pages-branch: gh-pages
201124
repository-name: python-sdk

0 commit comments

Comments
 (0)