feat(tests): add badges for integration testing versions #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | ||
|
Check failure on line 1 in .github/workflows/python-integration.yaml
|
||
| name: 'Integration Test' | ||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| POSTGRES_VERSIONS: | ||
| default: '[ "13", "14", "15", "16", "17" ]' | ||
| description: PostgreSQL Versions to test | ||
| required: false | ||
| type: string | ||
| PYTHON_VERSION: | ||
| default: '3.11' | ||
| description: Python Version to use | ||
| required: false | ||
| type: string | ||
| RABBITMQ_VERSIONS: | ||
| default: '[ "3.12", "3.13", "4.0", "4.1" ]' | ||
| description: PostgreSQL Versions to test | ||
| required: false | ||
| type: string | ||
| secrets: | ||
| WORKFLOW_TOKEN: | ||
| description: "token to clone with" | ||
| required: true | ||
| jobs: | ||
| integration-test: | ||
| name: Integration Test | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| max-parallel: 8 | ||
| matrix: | ||
| postgres-version: ${{ fromJSON(inputs.POSTGRES_VERSIONS) }} | ||
| rabbitmq-version: ${{ fromJSON(inputs.RABBITMQ_VERSIONS) }} | ||
| continue-on-error: true | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Set up Docker Compose | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y docker-compose | ||
| - name: Set up Python ${{ inputs.PYTHON_VERSION }} | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: ${{ inputs.PYTHON_VERSION }} | ||
| - name: Install Python Dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -r requirements.txt | ||
| pip install -r requirements_test.txt | ||
| - run: | | ||
| echo "::remove-matcher owner=python::" | ||
| - name: Run Tests | ||
| id: run-integration-test | ||
| continue-on-error: true | ||
| shell: bash | ||
| env: | ||
| CENTURION_RABBITMQ_IMAGE_TAG: ${{ matrix.rabbitmq-version }} | ||
| CENTURION_POSTGRES_IMAGE_TAG: ${{ matrix.postgres-version }} | ||
| run: | | ||
| export CENTURION_IMAGE_TAG=${GITHUB_SHA}; | ||
| make test-integration | ||
| - name: Test Report | ||
| if: success() || failure() | ||
| uses: dorny/test-reporter@v1 | ||
| id: test-report | ||
| with: | ||
| name: Integration Test Report [python_${{ inputs.PYTHON_VERSION }}-postgres_${{ matrix.postgres-version }}-rabbitmq_${{ matrix.rabbitmq-version }}] | ||
| path: 'integration.JUnit.xml' | ||
| reporter: java-junit | ||
| - name: Upload Junit Test Report | ||
| uses: actions/upload-artifact@v4 | ||
| if: success() || failure() | ||
| with: | ||
| name: integration-test-report-junit-python_${{ inputs.PYTHON_VERSION }}-postgres_${{ matrix.postgres-version }}-rabbitmq_${{ matrix.rabbitmq-version }} | ||
| path: integration.JUnit.xml | ||
| - name: Upload Artifacts - Logs | ||
| uses: actions/upload-artifact@v4 | ||
| if: success() || failure() | ||
| with: | ||
| name: integration-logs-python_${{ inputs.PYTHON_VERSION }}-postgres_${{ matrix.postgres-version }}-rabbitmq_${{ matrix.rabbitmq-version }} | ||
| path: test/volumes/log/* | ||
| - name: Upload Artifacts - Tests | ||
| uses: actions/upload-artifact@v4 | ||
| if: success() || failure() | ||
| with: | ||
| name: integration-tests-python_${{ inputs.PYTHON_VERSION }}-postgres_${{ matrix.postgres-version }}-rabbitmq_${{ matrix.rabbitmq-version }} | ||
| path: test/volumes/artifacts/* | ||
| badge-endpoint-versions: | ||
| name: Publish Version Badge endpoint files | ||
| if: ${{ github.ref_name == 'master' || github.ref_name == 'development' }} | ||
| needs: | ||
| - unit-test | ||
| - report | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Create PostgreSQL Shields.io Endpoint.json | ||
| shell: bash | ||
| run: | | ||
| versions=$(echo '${{ inputs.POSTGRES_VERSIONS }}' | tr -d "[]\"" | tr ',' '|' | xargs) | ||
| cat <<EOF > badge_endpoint_integration_postgres_versions.json | ||
| { | ||
| "schemaVersion": 1, | ||
| "label": "PostgreSQL", | ||
| "message": "$versions", | ||
| "color": "#336791", | ||
| "style": "plastic" | ||
| } | ||
| EOF | ||
| - name: Upload Badge Endpoint json | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: badge_endpoint_integration_postgres_versions | ||
| path: badge_endpoint_integration_postgres_versions.json | ||
| - name: Create RabbitMQ Shields.io Endpoint.json | ||
| shell: bash | ||
| run: | | ||
| versions=$(echo '${{ inputs.RABBITMQ_VERSIONS }}' | tr -d "[]\"" | tr ',' '|' | xargs) | ||
| cat <<EOF > badge_endpoint_integration_rabbitmq_versions.json | ||
| { | ||
| "schemaVersion": 1, | ||
| "label": "RabbitMQ", | ||
| "message": "$versions", | ||
| "logoSvg": "<svg width=\"800px\" height=\"800px\" viewBox=\"-7.5 0 271 271\" xmlns=\"http://www.w3.org/2000/svg\" preserveAspectRatio=\"xMidYMid\"><path d=\"M245.44 108.308h-85.09a7.738 7.738 0 0 1-7.735-7.734v-88.68C152.615 5.327 147.29 0 140.726 0h-30.375c-6.568 0-11.89 5.327-11.89 11.894v88.143c0 4.573-3.697 8.29-8.27 8.31l-27.885.133c-4.612.025-8.359-3.717-8.35-8.325l.173-88.241C54.144 5.337 48.817 0 42.24 0H11.89C5.321 0 0 5.327 0 11.894V260.21c0 5.834 4.726 10.56 10.555 10.56H245.44c5.834 0 10.56-4.726 10.56-10.56V118.868c0-5.834-4.726-10.56-10.56-10.56zm-39.902 93.233c0 7.645-6.198 13.844-13.843 13.844H167.69c-7.646 0-13.844-6.199-13.844-13.844v-24.005c0-7.646 6.198-13.844 13.844-13.844h24.005c7.645 0 13.843 6.198 13.843 13.844v24.005z\" fill=\"#F60\"/></svg>", | ||
| "color": "#F60", | ||
| "style": "plastic" | ||
| } | ||
| EOF | ||
| - name: Upload Badge Endpoint json | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: badge_endpoint_integration_rabbitmq_versions | ||
| path: badge_endpoint_integration_rabbitmq_versions.json | ||