-
-
Notifications
You must be signed in to change notification settings - Fork 212
130 lines (115 loc) · 5.56 KB
/
dependency-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
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