* Dockerfile to 3.9 * Python version * More python updates * 3.9 on GitHub actions and lint updates * Test out 3.9.11 on GitHub actions * install python with an action * formatting: newline * Also has python code * only check first level for changed modules Previous example (source-google-search-console/credentials) * Test failure: there is no logger.trace
74 lines
2.5 KiB
YAML
74 lines
2.5 KiB
YAML
name: Sonar Scan
|
|
on:
|
|
pull_request:
|
|
types: [opened, synchronize, closed]
|
|
|
|
jobs:
|
|
detect-changes:
|
|
name: Detect Changed Modules
|
|
timeout-minutes: 5
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
changed-modules: ${{ steps.detect-changed-modules.outputs.changed-modules }}
|
|
steps:
|
|
- name: Cancel Previous Runs
|
|
uses: styfle/cancel-workflow-action@0.9.1
|
|
with:
|
|
workflow_id: ${{ github.event.workflow.id }}
|
|
- name: Checkout Airbyte
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 1000
|
|
- name: Setup Python
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: 3.9
|
|
- name: Install Requirements
|
|
run: |
|
|
pip install ./tools/ci_common_utils ./tools/ci_code_validator[tests]
|
|
pytest ./tools/ci_code_validator
|
|
- name: Detect Changed Modules
|
|
id: detect-changed-modules
|
|
run: |
|
|
git fetch
|
|
CHANGES=$(ci_changes_detection $(git diff --name-only $(git merge-base HEAD origin/master)) | jq -c .)
|
|
echo "::set-output name=changed-modules::{ \"include\": $CHANGES }"
|
|
|
|
run-ci-tests:
|
|
# Do only run if the PR is not a draft and the changed modules matrix contains at least one entry
|
|
if: github.event.pull_request.draft == false && fromJson(needs.detect-changes.outputs.changed-modules).include[0] != null
|
|
needs: detect-changes
|
|
name: Tests for ${{ matrix.module }}
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
matrix: ${{fromJson(needs.detect-changes.outputs.changed-modules)}}
|
|
env:
|
|
MODULE_NAME: ${{ matrix.module }}
|
|
MODULE_LANG: ${{ matrix.lang }}
|
|
MODULE_FOLDER: ${{ matrix.folder }}
|
|
ENV_NAME: "github"
|
|
|
|
steps:
|
|
- name: Print Settings
|
|
run: |
|
|
echo "Module: ${{ env.MODULE_NAME }}, Lang: ${{ env.MODULE_LANG }}, Folder: ${{ env.MODULE_FOLDER }}"
|
|
- name: Checkout Airbyte
|
|
if: ${{ env.ENV_NAME == 'github' }}
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Run Tests Runner
|
|
id: run-python-tests
|
|
uses: ./.github/actions/ci-tests-runner
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
module-name: ${{ env.MODULE_NAME }}
|
|
module-folder: ${{ env.MODULE_FOLDER }}
|
|
module-lang: ${{ env.MODULE_LANG }}
|
|
sonar-token: ${{ secrets.SONAR_TOKEN }}
|
|
sonar-gcp-access-key: ${{ secrets.GCP_SONAR_SA_KEY }}
|
|
pull-request-id: "${{ github.repository }}/${{ github.event.pull_request.number }}"
|
|
remove-sonar-project: true
|