Skip to content

Commit 119e0b2

Browse files
Merge pull request #9 from DaredevilOSS/fix-release
[release] fix release
2 parents c5481cc + 7e03063 commit 119e0b2

File tree

7 files changed

+60
-80
lines changed

7 files changed

+60
-80
lines changed

.github/workflows/main.yml

+48-69
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
with:
6464
dotnet-version: '8.0.x'
6565

66-
- name: install Wasi workload
66+
- name: Install Wasi workload
6767
run: dotnet workload install wasi-experimental
6868

6969
- name: Download Wasi SDK on Ubuntu
@@ -85,51 +85,13 @@ jobs:
8585
name: wasm-file
8686
path: dist/plugin.wasm
8787

88-
# codegen-tests:
89-
# name: Codegen Test
90-
# runs-on: ubuntu-latest
91-
# needs: [build]
92-
# strategy:
93-
# matrix:
94-
# file-per-query: [ 'true', 'false' ]
95-
# generate-csproj: [ 'true', 'false' ]
96-
# target-framework: [ 'net8.0', 'netstandard2.0', 'netstandard2.1' ]
97-
#
98-
# steps:
99-
# - uses: actions/checkout@v4
100-
# - uses: actions/download-artifact@v4
101-
# with:
102-
# name: wasm-file
103-
# path: dist
104-
#
105-
# - name: Load .env file
106-
# uses: xom9ikk/[email protected]
107-
# with:
108-
# load-mode: strict
109-
#
110-
# - uses: sqlc-dev/setup-sqlc@v4
111-
# with:
112-
# sqlc-version: '1.25.0'
113-
#
114-
# - name: Updating plugin sha
115-
# run: ./scripts/wasm/update_sha.sh ${SQLC_CI_FILE}
116-
#
117-
# - name: Codegen Test
118-
# run: ./scripts/tests/run_codegen.sh ${SQLC_CI_FILE} \
119-
# ${{ matrix.file-per-query }} ${{ matrix.generate-csproj }} ${{ matrix.target-framework }}
120-
#
121-
# - uses: actions/setup-dotnet@v4
122-
# with:
123-
# dotnet-version: ${{ matrix.target-framework == 'net8.0' && '8.0.x' || '3.1.x' }}
124-
12588
end2end-tests:
12689
name: End-to-End Tests
12790
runs-on: ubuntu-latest
12891
needs: [build]
12992

13093
steps:
13194
- uses: actions/checkout@v4
132-
13395
- uses: actions/download-artifact@v4
13496
with:
13597
name: wasm-file
@@ -146,8 +108,8 @@ jobs:
146108

147109
- name: Verify pushed generated code is synced
148110
run: |
149-
./scripts/wasm/update_sha.sh $SQLC_CI_FILE
150-
sqlc -f $SQLC_CI_FILE diff
111+
./scripts/wasm/update_sha.sh ${SQLC_CI_FILE}
112+
sqlc -f ${SQLC_CI_FILE} diff
151113
152114
- name: Docker compose
153115
uses: hoverkraft-tech/[email protected]
@@ -159,7 +121,7 @@ jobs:
159121
160122
- name: End-to-End Tests
161123
run: ./scripts/tests/run_end2end.sh
162-
124+
163125
release:
164126
name: Release
165127
runs-on: ubuntu-latest
@@ -171,41 +133,52 @@ jobs:
171133
with:
172134
fetch-depth: 0
173135

174-
- uses: actions/download-artifact@v2
136+
- uses: actions/download-artifact@v4
175137
with:
176138
name: wasm-file
177139

178140
- name: Bump version and create new tag
179141
id: bump_version
180142
run: |
143+
bump_version() {
144+
latest_tag=$1
145+
latest_commit_msg=$2
146+
147+
BUMP_TYPE="patch" # Initialize the default version bump type to patch
148+
if [[ $latest_commit_msg == *"[major]"* ]]; then
149+
BUMP_TYPE="major"
150+
elif [[ $latest_commit_msg == *"[minor]"* ]]; then
151+
BUMP_TYPE="minor"
152+
fi
153+
154+
case $BUMP_TYPE in
155+
"major")
156+
NEW_TAG=$(echo $latest_tag | awk -F. '{OFS="."; $1="v" substr($1,2)+1; $2="0"; $3="0"; print}')
157+
;;
158+
"minor")
159+
NEW_TAG=$(echo $latest_tag | awk -F. '{OFS="."; $2=$2+1; $3="0"; print}')
160+
;;
161+
"patch")
162+
NEW_TAG=$(echo $latest_tag | awk -F. '{OFS="."; $3=$3+1; print}')
163+
;;
164+
esac
165+
return NEW_TAG
166+
}
167+
181168
set -e
169+
182170
echo "Extract the latest tag version"
183-
LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
184-
echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV
185-
186-
echo "latest tag version: $LATEST_TAG"
171+
LATEST_TAG_COMMIT=$(git rev-list --tags --max-count=1)
187172
LATEST_COMMIT_MSG=$(git log -1 --pretty=%B)
188-
189-
BUMP_TYPE="patch" # Initialize the default version bump type to patch
190-
if [[ $LATEST_COMMIT_MSG == *"[major]"* ]]; then
191-
BUMP_TYPE="major"
192-
elif [[ $LATEST_COMMIT_MSG == *"[minor]"* ]]; then
193-
BUMP_TYPE="minor"
173+
174+
if [ -z $LATEST_TAG_COMMIT ]; then
175+
NEW_TAG="0.10.0" # default 1st release version
176+
else
177+
LATEST_TAG=$(git describe --tags $LATEST_TAG_COMMIT)
178+
echo "latest tag version: $LATEST_TAG"
179+
NEW_TAG=$(bump_version $LATEST_TAG $LATEST_COMMIT_MSG)
194180
fi
195181
196-
# Bump the version based on the type
197-
case $BUMP_TYPE in
198-
"major")
199-
NEW_TAG=$(echo $LATEST_TAG | awk -F. '{OFS="."; $1="v" substr($1,2)+1; $2="0"; $3="0"; print}')
200-
;;
201-
"minor")
202-
NEW_TAG=$(echo $LATEST_TAG | awk -F. '{OFS="."; $2=$2+1; $3="0"; print}')
203-
;;
204-
"patch")
205-
NEW_TAG=$(echo $LATEST_TAG | awk -F. '{OFS="."; $3=$3+1; print}')
206-
;;
207-
esac
208-
209182
echo "New tag version: $NEW_TAG"
210183
echo "NEW_TAG=$NEW_TAG" >> $GITHUB_ENV
211184
@@ -223,12 +196,18 @@ jobs:
223196
env:
224197
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
225198
run: |
199+
set -e
200+
226201
LATEST_TAG=${{ env.LATEST_TAG }}
227202
NEW_TAG=${{ env.NEW_TAG }}
228203
SHA256_HASH=${{ env.SHA256_HASH }}
229204
230-
PREVIOUS_TAG=$(git rev-list -n 1 $LATEST_TAG)
231-
CHANGE_LOG=$(git --no-pager log $PREVIOUS_TAG..HEAD --pretty=format:'%h - %an, %ar : %s')
205+
if [ -z $LATEST_TAG ]; then
206+
CHANGE_LOG="TBD: Manually fill the 1st release features in here"
207+
else
208+
PREVIOUS_TAG=$(git rev-list -n 1 $LATEST_TAG)
209+
CHANGE_LOG=$(git --no-pager log $PREVIOUS_TAG..HEAD --pretty=format:'%h - %an, %ar : %s')
210+
fi
232211
233212
# Define the release notes template
234213
RELEASE_NOTES=$(cat <<EOF
@@ -248,7 +227,7 @@ jobs:
248227
$CHANGE_LOG
249228
250229
## Contributors
251-
* @doron050 @SockworkOrange
230+
* @SockworkOrange
252231
EOF
253232
)
254233

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ sql:
3030
options:
3131
driver: mysql2
3232
```
33+
3334
### Options Documentation
3435
| Option | Possible values | Optional | Info |
3536
|-----------------|------------------------------------------------|----------|-------------------------------------------------------------------------------------------------------------|
36-
| driver | <br/>values: `MySqlConnector`,`Npgsql` | No | Choosing the driver to use - refer to the [above](#supported-sql-engines) section on supported SQL engines. |
37+
| driver | <br/>values: `mysql2`,`pg` | No | Choosing the driver to use - refer to the [above](#supported-sql-engines) section on supported SQL engines. |
3738
| rubyVersion | default: `3.3`<br/>values: `3.1`, `3.2`, `3.3` | Yes | Determines the Ruby version the generated code should support.. |
3839
| generateGemfile | default: `false`<br/>values: `false`,`true` | Yes | Assists you with the integration of SQLC and Ruby by generating a `Gemfile` with the needed dependencies. |
3940

examples/mysql2/Gemfile

-4
This file was deleted.

examples/pg/Gemfile

-5
This file was deleted.

sqlc.ci.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ sql:
1313
out: examples/pg
1414
options:
1515
driver: pg
16+
rubyVersion: "3.3"
17+
generateGemfile: false
1618
- schema: "examples/authors/mysql/schema.sql"
1719
queries: "examples/authors/mysql/query.sql"
1820
engine: "mysql"
@@ -21,3 +23,5 @@ sql:
2123
out: examples/mysql2
2224
options:
2325
driver: mysql2
26+
rubyVersion: "3.3"
27+
generateGemfile: false

sqlc.local.yaml

+5-1
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,15 @@ sql:
1212
out: examples/pg
1313
options:
1414
driver: pg
15+
rubyVersion: "3.3"
16+
generateGemfile: false
1517
- schema: "examples/authors/mysql/schema.sql"
1618
queries: "examples/authors/mysql/query.sql"
1719
engine: "mysql"
1820
codegen:
1921
- plugin: ruby
2022
out: examples/mysql2
2123
options:
22-
driver: mysql2
24+
driver: mysql2
25+
rubyVersion: "3.3"
26+
generateGemfile: false

tests/consts.rb

+1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ module Consts
44

55
DR_SEUSS_AUTHOR = "Dr. Seuss"
66
DR_SEUSS_QUOTE = "You'll miss the best things if you keep your eyes shut"
7+
DR_SEUSS_NEW_QUOTE = "Today you are You, that is truer than true. There is no one alive who is Youer than You"
78
end

0 commit comments

Comments
 (0)