diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 646c410..2c5ebeb 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,21 +1,35 @@ name: Build and test project -on: [ push ] +on: + workflow_call: + inputs: + slow-tests: + type: boolean + default: false + python-version: + type: string + required: true jobs: build: strategy: fail-fast: false - matrix: - python-version: ["3.10"] runs-on: ubuntu-20.04 environment: aws steps: - - uses: actions/checkout@v3 + - name: Set pytest markers + id: pytest-markers + if: ${{ ! inputs.slow-tests }} + run: echo slow-tests='-m "not slow"' >> "$GITHUB_OUTPUT" + + - name: SCM Checkout + uses: actions/checkout@v4 - name: Setup Python & Poetry Environment uses: ./.github/actions/prepare_poetry_env + with: + python-version: ${{ inputs.python-version }} - name: Build Poetry run: poetry build @@ -43,4 +57,7 @@ jobs: SAAS_HOST: ${{ secrets.INTEGRATION_TEAM_SAAS_STAGING_HOST }} SAAS_ACCOUNT_ID: ${{ secrets.INTEGRATION_TEAM_SAAS_STAGING_ACCOUNT_ID }} SAAS_PAT: ${{ secrets.INTEGRATION_TEAM_SAAS_STAGING_PAT }} - run: poetry run pytest tests + PYTEST_ADDOPTS: '${{ steps.pytest-markers.outputs.slow-tests }}' + run: | + echo "PYTEST_ADDOPTS = $PYTEST_ADDOPTS" + poetry run pytest tests diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..5f04dbd --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,52 @@ +name: CI + +on: + pull_request: + +jobs: + + ci-job: + name: Fast Tests + strategy: + fail-fast: false + matrix: + python-version: [ "3.10" ] + uses: ./.github/workflows/build.yaml + secrets: inherit + with: + python-version: ${{ matrix.python-version }} + slow-tests: false + + gate-1: + name: Gate 1 - Regular CI + needs: [ ci-job ] + runs-on: ubuntu-latest + steps: + - name: Branch Protection + run: true + + slow-test-detection: + name: Run Slow or Expensive Tests? + runs-on: ubuntu-latest + steps: + - name: Detect Slow Tests + run: true + environment: + slow-tests + + run-slow-tests: + name: Run Slow or Expensive Tests if Requested + uses: ./.github/workflows/build.yaml + needs: [ slow-test-detection ] + secrets: inherit + with: + slow-tests: true + python-version: "3.10" + + gate-2: + name: Gate 2 - Allow Merge + runs-on: ubuntu-latest + needs: [ run-slow-tests ] + steps: + - name: Branch Protection + run: true diff --git a/doc/changes/changes_0.10.0.md b/doc/changes/changes_0.10.0.md index ee2fc7a..6730f66 100644 --- a/doc/changes/changes_0.10.0.md +++ b/doc/changes/changes_0.10.0.md @@ -8,18 +8,14 @@ Improving documentation, refactoring and moving to Python 3.10 ### Features -- #120: Running CI tests in the SaaS as well as the Docker DB. - -### Bug Fixes - -n/a +* #120: Running CI tests in the SaaS as well as the Docker DB. ### Documentation -- #116: Explanation of how to from the S3 bucket URI - +* #116: Explanation of how to from the S3 bucket URI ### Refactoring -- #118: Refactor to use python-extension-common package -- #124: Moved to Python 3.10 +* #118: Refactor to use python-extension-common package +* #124: Moved to Python 3.10 +* #132: Updated GitHub workflows to request manual confirmation for running slow tests