PCSM-211: Readme update #104
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
| name: CI | |
| permissions: | |
| contents: read | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| pcsm_branch: | |
| description: "PCSM branch" | |
| required: false | |
| tests_ver: | |
| description: "QA tests version" | |
| required: false | |
| pull_request: | |
| types: [opened, reopened, synchronize, ready_for_review] | |
| branches: | |
| - main | |
| paths-ignore: | |
| - "tests/**" | |
| - "packaging/**" | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| test: | |
| if: github.event.pull_request.draft == false | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 180 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| psmdb: ["6.0", "7.0", "8.0"] | |
| shard: [0, 1, 2, 3, 4] | |
| env: | |
| PCSM_BRANCH: ${{ github.event_name == 'pull_request' && github.head_ref || github.event.inputs.pcsm_branch || 'main' }} | |
| steps: | |
| - name: Determine test branch | |
| id: test_branch | |
| run: | | |
| if [ -n "${{ github.event.inputs.tests_ver }}" ]; then | |
| echo "branch=${{ github.event.inputs.tests_ver }}" >> $GITHUB_OUTPUT | |
| elif [ -n "${{ github.event.pull_request.title }}" ]; then | |
| PR_TITLE="${{ github.event.pull_request.title }}" | |
| echo "PR title: $PR_TITLE" | |
| BRANCH_TO_CHECK=$(echo "$PR_TITLE" | grep -oE 'PCSM-[0-9]+' | head -1) | |
| if [ -n "$BRANCH_TO_CHECK" ]; then | |
| echo "Extracted branch pattern: $BRANCH_TO_CHECK" | |
| if curl -sf "https://api.github.com/repos/Percona-QA/psmdb-testing/branches/$BRANCH_TO_CHECK" > /dev/null; then | |
| echo "Branch $BRANCH_TO_CHECK found, using it" | |
| echo "branch=$BRANCH_TO_CHECK" >> $GITHUB_OUTPUT | |
| else | |
| echo "Branch $BRANCH_TO_CHECK not found, falling back to main" | |
| echo "branch=main" >> $GITHUB_OUTPUT | |
| fi | |
| else | |
| echo "No PCSM-XXXXX pattern found in PR title, using main" | |
| echo "branch=main" >> $GITHUB_OUTPUT | |
| fi | |
| else | |
| echo "branch=main" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Checkout testing repo | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: Percona-QA/psmdb-testing | |
| ref: ${{ steps.test_branch.outputs.branch }} | |
| path: psmdb-testing | |
| - name: Setup environment with PSMDB ${{ matrix.psmdb }} and PCSM PR/branch ${{ github.head_ref || github.event.inputs.pcsm_branch || env.PCSM_BRANCH }} | |
| run: | | |
| MONGODB_IMAGE=perconalab/percona-server-mongodb:${{ matrix.psmdb }} docker compose build easyrsa | |
| MONGODB_IMAGE=perconalab/percona-server-mongodb:${{ matrix.psmdb }} docker compose build | |
| docker compose up -d | |
| working-directory: psmdb-testing/pcsm-pytest | |
| - name: Run pytest shard ${{ matrix.shard }} on PSMDB ${{ matrix.psmdb }} and PCSM PR/branch ${{ github.head_ref || github.event.inputs.pcsm_branch || env.PCSM_BRANCH }} | |
| run: | | |
| docker compose run --rm test pytest -s -v --junitxml=junit.xml --shard-id=${{ matrix.shard }} --num-shards=5 -m 'not jenkins' | |
| working-directory: psmdb-testing/pcsm-pytest | |
| - name: Publish Test Report | |
| uses: mikepenz/action-junit-report@v5 | |
| if: success() || failure() | |
| with: | |
| report_paths: '**/junit.xml' | |
| include_passed: True | |
| detailed_summary: True | |
| include_time_in_summary: True |