Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,43 @@ updates:
labels:
- "dependencies"
- "automated"

# Enable version updates for Docker
- package-ecosystem: "docker"
directory: "/.github/workflows"
schedule:
interval: "weekly"
day: "monday"
time: "09:00"
timezone: "Australia/Sydney"
open-pull-requests-limit: 10
reviewers:
- "stevenworley"
assignees:
- "stevenworley"
commit-message:
prefix: "chore"
prefix-development: "chore"
include: "scope"
labels:
- "dependencies"
- "automated"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
time: "09:00"
timezone: "Australia/Sydney"
open-pull-requests-limit: 10
reviewers:
- "stevenworley"
assignees:
- "stevenworley"
commit-message:
prefix: "chore"
include: "scope"
labels:
- "dependencies"
- "automated"
91 changes: 63 additions & 28 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ name: Test Quant Cloud Init Action

on:
workflow_dispatch:
pull_request:
branches:
- main
push:
branches:
- main
Expand All @@ -21,6 +24,16 @@ on:
jobs:
test:
runs-on: ubuntu-latest
services:
quant-mock-api:
image: ghcr.io/quantcdn/quant-mock-api:4.4.0
ports:
- 4010:4010
options: >-
--health-cmd "nc -z 127.0.0.1 4010"
--health-interval 10s
--health-timeout 5s
--health-retries 5
strategy:
matrix:
test-scenario: [
Expand Down Expand Up @@ -55,9 +68,10 @@ jobs:
uses: ./
id: init-valid
with:
quant_api_key: ${{ secrets.QUANT_API_KEY }}
quant_organization: 'quant'
base_url: 'https://portal.stage.quantcdn.io/api/v3'
quant_api_key: 'test-api-key'
quant_organization: 'test-org'
base_url: 'http://localhost:4010'
skip_docker_login: true
continue-on-error: false

- name: Test Invalid API Key (Expected Failure)
Expand All @@ -66,55 +80,59 @@ jobs:
id: init-invalid-key
with:
quant_api_key: 'invalid-key-12345'
quant_organization: 'quant'
base_url: 'https://portal.stage.quantcdn.io/api/v3'
quant_organization: 'test-org'
base_url: 'http://localhost:4010'
continue-on-error: true

- name: Test Invalid Organization (Expected Failure)
if: matrix.test-scenario == 'invalid-organization'
uses: ./
id: init-invalid-org
with:
quant_api_key: ${{ secrets.QUANT_API_KEY }}
quant_api_key: 'test-api-key'
quant_organization: 'non-existent-org-12345'
base_url: 'https://portal.stage.quantcdn.io/api/v3'
base_url: 'http://localhost:4010'
skip_docker_login: true
continue-on-error: true

- name: Test Non-Existent Application (Expected Warning)
if: matrix.test-scenario == 'non-existent-application'
uses: ./
id: init-no-app
with:
quant_api_key: ${{ secrets.QUANT_API_KEY }}
quant_organization: 'quant'
quant_api_key: 'test-api-key'
quant_organization: 'test-org'
quant_application: 'non-existent-app-12345'
base_url: 'https://portal.stage.quantcdn.io/api/v3'
base_url: 'http://localhost:4010'
skip_docker_login: true
continue-on-error: false

- name: Test Overrides
if: matrix.test-scenario == 'test-overrides'
uses: ./
id: init-overrides
with:
quant_api_key: ${{ secrets.QUANT_API_KEY }}
quant_organization: 'quant'
quant_api_key: 'test-api-key'
quant_organization: 'test-org'
quant_application: 'test-override-app'
environment_name_override: 'staging'
master_branch_override: 'develop'
base_url: 'https://portal.stage.quantcdn.io/api/v3'
base_url: 'http://localhost:4010'
skip_docker_login: true
continue-on-error: false

- name: Test Feature Branch Logic (with overrides)
if: matrix.test-scenario == 'test-overrides'
uses: ./
id: init-feature-branch
with:
quant_api_key: ${{ secrets.QUANT_API_KEY }}
quant_organization: 'quant'
quant_api_key: 'test-api-key'
quant_organization: 'test-org'
quant_application: 'feature-test-app'
# Simulate feature branch by overriding environment name
environment_name_override: 'feature-my-big-feature'
base_url: 'https://portal.stage.quantcdn.io/api/v3'
base_url: 'http://localhost:4010'
skip_docker_login: true
continue-on-error: false

- name: Validate Valid Credentials Outputs
Expand All @@ -129,18 +147,35 @@ jobs:
echo "Stripped endpoint: ${{ steps.init-valid.outputs.stripped_endpoint }}"
echo "Image suffix: ${{ steps.init-valid.outputs.image_suffix }}"

# Validate expected values for main branch
if [[ "${{ steps.init-valid.outputs.environment_name }}" != "production" ]]; then
echo "❌ Expected environment 'production', got '${{ steps.init-valid.outputs.environment_name }}'"
exit 1
fi
if [[ "${{ steps.init-valid.outputs.is_production }}" != "true" ]]; then
echo "❌ Expected is_production 'true', got '${{ steps.init-valid.outputs.is_production }}'"
exit 1
fi
if [[ "${{ steps.init-valid.outputs.image_suffix }}" != "-latest" ]]; then
echo "❌ Expected image_suffix '-latest', got '${{ steps.init-valid.outputs.image_suffix }}'"
exit 1
# Validate expected values based on event type
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "ℹ️ Running in PR context"
if [[ "${{ steps.init-valid.outputs.environment_name }}" != pr-* ]]; then
echo "❌ Expected environment starting with 'pr-', got '${{ steps.init-valid.outputs.environment_name }}'"
exit 1
fi
if [[ "${{ steps.init-valid.outputs.is_production }}" != "false" ]]; then
echo "❌ Expected is_production 'false', got '${{ steps.init-valid.outputs.is_production }}'"
exit 1
fi
if [[ "${{ steps.init-valid.outputs.image_suffix }}" != -pr-* ]]; then
echo "❌ Expected image_suffix starting with '-pr-', got '${{ steps.init-valid.outputs.image_suffix }}'"
exit 1
fi
else
echo "ℹ️ Running in Push context (assuming main branch)"
if [[ "${{ steps.init-valid.outputs.environment_name }}" != "production" ]]; then
echo "❌ Expected environment 'production', got '${{ steps.init-valid.outputs.environment_name }}'"
exit 1
fi
if [[ "${{ steps.init-valid.outputs.is_production }}" != "true" ]]; then
echo "❌ Expected is_production 'true', got '${{ steps.init-valid.outputs.is_production }}'"
exit 1
fi
if [[ "${{ steps.init-valid.outputs.image_suffix }}" != "-latest" ]]; then
echo "❌ Expected image_suffix '-latest', got '${{ steps.init-valid.outputs.image_suffix }}'"
exit 1
fi
fi
echo "✅ Valid credentials test passed"

Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ inputs:
base_url:
description: 'Quant Cloud API base URL'
required: false
skip_docker_login:
description: 'Skip Docker login step (useful for testing against mock APIs)'
required: false
default: 'false'
outputs:
project_exists:
description: 'Whether the project exists in Quant Cloud'
Expand Down
Loading
Loading