diff --git a/.github/workflows/doltgres-dependency.yml b/.github/workflows/doltgres-dependency.yml index b2bb57bb2f..eede16718d 100644 --- a/.github/workflows/doltgres-dependency.yml +++ b/.github/workflows/doltgres-dependency.yml @@ -1,12 +1,27 @@ name: Test Integration with DoltgreSQL -on: [pull_request] + +on: + pull_request: + types: [opened, synchronize, reopened] + issue_comment: + types: [created, edited] jobs: test-integration: + if: github.event_name == 'issue_comment' && github.event.issue.pull_request != '' || github.event_name == 'pull_request' runs-on: ubuntu-latest steps: - - name: Checkout go-mysql-server + - name: Check for a DoltgreSQL PR link + run: | + COMMENTS=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments) + COMMENT_EXISTS=$(echo "$COMMENTS" | jq -r '.[] | select(.body | contains("github.com/dolthub/doltgresql/pull/"))') + if [ -n "$COMMENT_EXISTS" ]; then + exit 0 + fi + + - name: Checkout Dolt uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha }} @@ -19,29 +34,27 @@ jobs: - name: Clone DoltgreSQL repository run: git clone https://github.com/dolthub/doltgresql.git - - name: Update DoltgreSQL's dependency + - name: Build DoltgreSQL's parser run: | cd doltgresql ./postgres/parser/build.sh - go get github.com/dolthub/dolt/go@${{ github.event.pull_request.head.sha }} - go get github.com/dolthub/dolt/go/gen/proto/dolt/services/eventsapi@${{ github.event.pull_request.head.sha }} - go mod tidy - - name: Test DoltgreSQL + - name: Test DoltgreSQL against main + id: test_doltgresql_main + continue-on-error: true run: | - cd doltgresql/testing/go - go test ./... --count=1 -skip Replication || echo "doltgresql-tests-failed" > $GITHUB_WORKSPACE/doltgresql-test-result.txt + cd doltgresql + go get github.com/dolthub/dolt/go@main + go mod tidy + cd testing/go + go test ./... --count=1 -skip Replication - - name: Comment on failures - if: always() + - name: Test DoltgreSQL against PR + if: steps.test_doltgresql_main.outcome == 'success' run: | - TEST_COMMENT="" - if [ -f $GITHUB_WORKSPACE/doltgresql-test-result.txt ]; then - TEST_COMMENT="Additional work is required for integration with [DoltgreSQL](https://github.com/dolthub/doltgresql)." - fi - if [ -n "$TEST_COMMENT" ]; then - curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - -X POST \ - -d "{\"body\": \"$TEST_COMMENT\"}" \ - "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments" - fi + cd doltgresql + git reset --hard + go get github.com/${{ github.event.pull_request.head.repo.full_name }}/go@${{ github.event.pull_request.head.sha }} + go mod tidy + cd testing/go + go test ./... --count=1 -skip Replication