Skip to content

Fix drop view if exists for doltgres #779

Fix drop view if exists for doltgres

Fix drop view if exists for doltgres #779

Workflow file for this run

name: Test Integration with Dolt and DoltgreSQL
on:
pull_request:
types: [opened, synchronize, reopened]
issue_comment:
types: [created, edited, deleted]
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
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup Git User
uses: fregante/setup-git-user@v2
- name: Merge main into PR
id: merge_main
run: |
git fetch --all --unshallow
git merge origin/main --no-commit --no-ff
if [ $? -ne 0 ]; then
echo "Skipping the remainder of the workflow due to a merge conflict."
echo "skip=true" >> $GITHUB_OUTPUT
else
echo "Merge performed successfully, continuing workflow."
echo "skip=false" >> $GITHUB_OUTPUT
fi
- name: Check for a Dolt PR link
id: check_dolt_pr
if: steps.merge_main.outputs.skip == 'false'
run: |
PR_DESCRIPTION=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number != '' && github.event.pull_request.number || github.event.issue.number }})
COMMENTS=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number != '' && github.event.pull_request.number || github.event.issue.number }}/comments)
echo "$PR_DESCRIPTION$COMMENTS"
if echo "$PR_DESCRIPTION$COMMENTS" | grep -q "github.com/dolthub/dolt/pull/"; then
echo "comment_exists=true" >> $GITHUB_OUTPUT
echo "Dolt PR link exists"
else
echo "comment_exists=false" >> $GITHUB_OUTPUT
echo "Dolt PR link does not exist"
fi
- name: Check for a DoltgreSQL PR link
id: check_doltgresql_pr
if: steps.merge_main.outputs.skip == 'false'
run: |
PR_DESCRIPTION=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number != '' && github.event.pull_request.number || github.event.issue.number }})
COMMENTS=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments)
echo "$PR_DESCRIPTION$COMMENTS"
if echo "$PR_DESCRIPTION$COMMENTS" | grep -q "github.com/dolthub/doltgresql/pull/"; then
echo "comment_exists=true" >> $GITHUB_OUTPUT
echo "DoltgreSQL PR link exists"
else
echo "comment_exists=false" >> $GITHUB_OUTPUT
echo "DoltgreSQL PR link does not exist"
fi
- name: Install Go
uses: actions/setup-go@v5
if: steps.merge_main.outputs.skip == 'false'
with:
go-version-file: go.mod
- name: Clone Dolt
if: steps.merge_main.outputs.skip == 'false' && steps.check_dolt_pr.outputs.comment_exists == 'false'
run: git clone https://github.com/dolthub/dolt.git
- name: Clone DoltgreSQL repository
if: steps.merge_main.outputs.skip == 'false' && steps.check_doltgresql_pr.outputs.comment_exists == 'false'
run: git clone https://github.com/dolthub/doltgresql.git
- name: Build DoltgreSQL's parser
if: steps.merge_main.outputs.skip == 'false' && steps.check_doltgresql_pr.outputs.comment_exists == 'false'
run: |
cd doltgresql
./postgres/parser/build.sh
- name: Test Dolt against main
id: test_dolt_main
if: steps.merge_main.outputs.skip == 'false' && steps.check_dolt_pr.outputs.comment_exists == 'false'
continue-on-error: true
run: |
cd dolt/go
go get github.com/dolthub/go-mysql-server@main
go mod tidy
cd libraries/doltcore/sqle/enginetest
go test ./... --count=1 -skip TestDoltServerRunningUnixSocket
- name: Test DoltgreSQL against main
id: test_doltgresql_main
if: steps.merge_main.outputs.skip == 'false' && steps.check_doltgresql_pr.outputs.comment_exists == 'false'
continue-on-error: true
run: |
cd doltgresql
go get github.com/dolthub/go-mysql-server@main
go mod tidy
cd testing/go
go test ./... --count=1 -skip Replication
- name: Test Dolt against PR
if: steps.merge_main.outputs.skip == 'false' && steps.check_dolt_pr.outputs.comment_exists == 'false' && steps.test_dolt_main.outcome == 'success'
run: |
cd dolt/go
git reset --hard
go mod edit -replace github.com/dolthub/go-mysql-server=../..
go mod tidy
cd libraries/doltcore/sqle/enginetest
go test ./... --count=1 -skip TestDoltServerRunningUnixSocket
- name: Test DoltgreSQL against PR
if: steps.merge_main.outputs.skip == 'false' && steps.check_doltgresql_pr.outputs.comment_exists == 'false' && steps.test_doltgresql_main.outcome == 'success'
run: |
cd doltgresql
git reset --hard
go mod edit -replace github.com/dolthub/go-mysql-server=..
go mod tidy
cd testing/go
go test ./... --count=1 -skip Replication