Skip to content

Commit

Permalink
CI: Fix flaky no-code verifications, add native GitHub Actions succes…
Browse files Browse the repository at this point in the history
…s notification for `/test-pr` slash command (#283)
  • Loading branch information
aaronsteers authored Jun 29, 2024
1 parent 37b50db commit cc716f7
Show file tree
Hide file tree
Showing 7 changed files with 447 additions and 348 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/python_pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,17 @@ jobs:
run: >
poetry run coverage run -m pytest
--durations=5 --exitfirst
-m "not slow and not requires_creds and not linting"
-m "not slow and not requires_creds and not linting and not flaky"
- name: Run Pytest with Coverage (Flaky Tests Only)
timeout-minutes: 60
continue-on-error: true
env:
GCP_GSM_CREDENTIALS: ${{ secrets.GCP_GSM_CREDENTIALS }}
run: >
poetry run coverage run -m pytest
--durations=5 --exitfirst
-m "flaky and not slow and not requires_creds"
- name: Print Coverage Report
if: always()
Expand Down Expand Up @@ -93,7 +103,7 @@ jobs:
run: >
poetry run coverage run -m pytest
--durations=5 --exitfirst
-m "not requires_creds and not linting and not super_slow"
-m "not requires_creds and not linting and not super_slow and not flaky"
- name: Print Coverage Report
if: always()
Expand Down Expand Up @@ -156,7 +166,7 @@ jobs:
run: >
poetry run coverage run -m pytest
--verbose
-m "not linting and not super_slow"
-m "not linting and not super_slow and not flaky"
- name: Print Coverage Report
if: always()
Expand Down
68 changes: 61 additions & 7 deletions .github/workflows/test-pr-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,22 @@ env:
AIRBYTE_ANALYTICS_ID: ${{ vars.AIRBYTE_ANALYTICS_ID }}

jobs:
log-starting-comment:
start-workflow:
name: Append 'Starting' Comment
runs-on: ubuntu-latest
steps:
- name: Create URL to the run output
id: vars
run: echo "run-url=https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> $GITHUB_OUTPUT
- name: Get PR JSON
id: pr-info
run: |
PR_JSON=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.inputs.pr }})
echo "$PR_JSON" > pr-info.json
echo "sha=$(cat pr-info.json | jq -r .head.sha)" >> $GITHUB_OUTPUT
echo "run-url=https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> $GITHUB_OUTPUT
- name: Upload PR details as artifact
uses: actions/upload-artifact@v2
with:
name: pr-info
path: pr-info.json
- name: Append comment with job run link
id: first-comment-action
uses: peter-evans/create-or-update-comment@v4
Expand All @@ -33,7 +42,7 @@ jobs:
> PR test job started... [Check job output.][1]
[1]: ${{ steps.vars.outputs.run-url }}
[1]: ${{ steps.pr-info.outputs.run-url }}
# This is copied from the `python_pytest.yml` file.
# Only the first two steps of the job are different, and they check out the PR's branch.
Expand All @@ -58,6 +67,13 @@ jobs:

# Custom steps to fetch the PR and checkout the code:

- name: Download PR info
# This puts the `pr-info.json` file in the current directory.
# We need this to get the PR's SHA at the time of the workflow run.
uses: actions/download-artifact@v2
with:
name: pr-info

- name: Checkout PR
uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -88,7 +104,29 @@ jobs:
run: >
poetry run pytest
--verbose
-m "not super_slow"
-m "not super_slow and not flaky"
- name: Run Pytest (Flaky Only)
continue-on-error: true
timeout-minutes: 60
env:
GCP_GSM_CREDENTIALS: ${{ secrets.GCP_GSM_CREDENTIALS }}
run: >
poetry run pytest
--verbose
-m "flaky and not super_slow"
- name: Post CI Success to GitHub
run: |
curl --request POST \
--url https://api.github.com/repos/${{ github.repository }}/statuses/$(cat pr-info.json | jq -r .head.sha) \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'content-type: application/json' \
--data '{
"state": "success",
"context": "Pytest (All, Python ${{ matrix.python-version }}, ${{ matrix.os }})",
"target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}",
}' \
log-success-comment:
name: Append 'Success' Comment
Expand All @@ -104,10 +142,26 @@ jobs:
body: |
> ✅ Tests passed.
log-github-actions-success:
name: Log GitHub Actions Success
needs: [pytest-on-demand]
runs-on: ubuntu-latest
steps:
- name: Get PR info
id: pr-info
run: |
PR_JSON=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.inputs.pr }})
echo "::set-output name=repo::$(echo "$PR_JSON" | jq -r .head.repo.full_name)"
echo "::set-output name=branch::$(echo "$PR_JSON" | jq -r .head.ref)"
echo "::set-output name=sha::$(echo "$PR_JSON" | jq -r .head.sha)"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash

log-failure-comment:
name: Append 'Failure' Comment
# This job will only run if the workflow fails
needs: [pytest-on-demand, log-starting-comment]
needs: [pytest-on-demand, start-workflow]
if: always() && needs.pytest-on-demand.result == 'failure'
runs-on: ubuntu-latest
steps:
Expand Down
9 changes: 7 additions & 2 deletions airbyte/sources/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@

_LOWCODE_LABEL = "cdk:low-code"

_LOWCODE_CONNECTORS_NEEDING_PYTHON = [
_LOWCODE_CONNECTORS_NEEDING_PYTHON: list[str] = [
"source-adjust",
"source-alpha-vantage",
"source-asana",
"source-amplitude",
"source-apify-dataset",
"source-asana",
"source-avni",
"source-aws-cloudtrail",
"source-bamboo-hr",
"source-braintree",
"source-braze",
Expand All @@ -41,9 +43,11 @@
"source-gitlab",
"source-gnews",
"source-greenhouse",
"source-instagram",
"source-instatus",
"source-intercom",
"source-iterable",
"source-jina-ai-reader",
"source-jira",
"source-klaviyo",
"source-mailchimp",
Expand All @@ -52,6 +56,7 @@
"source-my-hours",
"source-notion",
"source-okta",
"source-orb",
"source-outreach",
"source-partnerstack",
"source-paypal-transaction",
Expand Down
Loading

0 comments on commit cc716f7

Please sign in to comment.