dedup yaml

This commit is contained in:
2025-07-29 17:01:32 -05:00
parent 6e8e67f560
commit 3ce7ccc6be
2 changed files with 23 additions and 42 deletions
+14 -41
View File
@@ -4,7 +4,7 @@ on:
workflow_dispatch:
inputs:
environment:
description: "Environment to deploy to"
description: "Target environment"
required: true
default: "testing"
type: choice
@@ -14,13 +14,13 @@ on:
- production
jobs:
testing:
if: github.event.inputs.environment == 'testing'
# YAML anchor for common job configuration
.integration-test: &integration-test
runs-on: general
container:
image: "ghcr.io/catthehacker/ubuntu:js-24.04"
environment: testing
env:
TARGET_ENVIRONMENT: ${{ github.event.inputs.environment }}
steps:
- name: Checkout code
uses: actions/checkout@v3
@@ -30,49 +30,22 @@ jobs:
apt-get update
apt-get install -y python3-pytest python3-requests
- name: Run test (Testing)
- name: Run integration tests
run: |
echo "Running integration tests for TESTING environment"
echo "Running integration tests for ${TARGET_ENVIRONMENT^^} environment"
pytest run_test.py
testing:
if: github.event.inputs.environment == 'testing'
environment: testing
<<: *integration-test
staging:
if: github.event.inputs.environment == 'staging'
runs-on: general
container:
image: "ghcr.io/catthehacker/ubuntu:js-24.04"
environment: staging
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install dependencies
run: |
apt-get update
apt-get install -y python3-pytest python3-requests
- name: Run test (Staging)
run: |
echo "Running integration tests for STAGING environment"
pytest run_test.py
<<: *integration-test
production:
if: github.event.inputs.environment == 'production'
runs-on: general
container:
image: "ghcr.io/catthehacker/ubuntu:js-24.04"
environment: production
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install dependencies
run: |
apt-get update
apt-get install -y python3-pytest python3-requests
- name: Run test (Production)
run: |
echo "Running integration tests for PRODUCTION environment"
pytest run_test.py
<<: *integration-test