Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: release version autoincrement #983

Merged
merged 26 commits into from
Oct 13, 2022
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 31 additions & 9 deletions .github/workflows/sql-release.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: Release SQL shared library
on:
push:
branches: ["main"]
branches: ["main", "sql-release-autoincrement"]
paths:
- ".github/workflows/sql-release.yml"
- "sql/**"
- ".github/workflows/sql-test.yml"

jobs:
librillsql:
Expand All @@ -17,21 +18,26 @@ jobs:
- os: linux
arch: amd64
runner: ubuntu-latest
- os: windows
arch: amd64
runner: windows-latest
# - os: windows
# arch: amd64
# runner: windows-latest
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v3
- name: Increment patch version
run: |
cd sql
mvn --batch-mode -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn validate -Pbump-patch
- uses: graalvm/setup-graalvm@v1
with:
version: "22.1.0"
java-version: "17"
components: "native-image"
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
# - name: Install Protoc
# uses: arduino/setup-protoc@v1
# with:
# repo-token: ${{ secrets.GITHUB_TOKEN }}
# version: '21.5'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know why this installation option doesn't work? It seems to be widely used. We may also need protoc on the golang side soon, so would be nice to understand

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we using any cutting-edge features or could we just downgrade to the highest version it supports until this issue is resolved?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pjain1 , I wonder if need that specific version?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just started with the latest stable and it was supported on Java side. For the test I installed protoc manually using the installation instructions given here.

- name: Authenticate GCS
uses: google-github-actions/auth@v0
with:
Expand All @@ -46,7 +52,17 @@ jobs:
shell: bash
run: |
cd sql
mvn package -Pnative-lib
case "$OSTYPE" in
darwin*) PROTOC_ZIP=protoc-21.5-osx-x86_64.zip ;;
linux*) PROTOC_ZIP=protoc-21.5-linux-x86_64.zip ;;
msys*) PROTOC_ZIP=protoc-21.5-win64.zip ;;
esac
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v21.5/$PROTOC_ZIP
sudo unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
sudo unzip -o $PROTOC_ZIP -d /usr/local 'include/*'
rm -f $PROTOC_ZIP
mvn --batch-mode -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn test
mvn --batch-mode -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn package -Pnative-lib
- name: Install zip on Windows
if: matrix.os == 'windows'
shell: bash
Expand All @@ -56,6 +72,12 @@ jobs:
run: |
rm sql/target/*.txt
zip -j librillsql-${{ matrix.os }}-${{ matrix.arch }}.zip sql/target/librillsql.* sql/target/graal_isolate.*
- name: Push version changes
uses: EndBug/add-and-commit@v7
with:
default_author: github_actions
add: sql/pom.xml
message: librillsql release v${{ steps.maven-version.outputs.version }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going to cause a push directly to main, which feels a little dangerous – we would prefer always to have manual merges to main. I can see a few options:

  • Either run this once per PR and commit the version update to the PR. This has the risk that two simultaneous PRs will update to the same version, which requires manual intervention.
  • Or, have the developer manually bump the version (put the command in sql/README.md for convenience) and then have CI check that a pull request does not have the same version number as the one on main (so we don't forget)
  • Or, don't automatically release on merges to main – come up with another release approach (like a manually triggered workflow that checks that the version number has been updated)
  • Or, just use SHAs as version numbers

Any other ideas?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's more dangerous than committing manually. But as a second option I can propose manual version change by PR committer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've changed it to autoincrement in a PR branch.
It checks version on 'push' and PR approval.

- name: Upload archive
uses: google-github-actions/upload-cloud-storage@v0
with:
Expand Down
27 changes: 19 additions & 8 deletions .github/workflows/sql-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
- os: linux
arch: amd64
runner: ubuntu-latest
- os: windows
arch: amd64
runner: windows-latest
# - os: windows
# arch: amd64
# runner: windows-latest
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v3
Expand All @@ -28,13 +28,24 @@ jobs:
java-version: "17"
components: "native-image"

- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
# - name: Install Protoc
# uses: arduino/setup-protoc@v1
# with:
# repo-token: ${{ secrets.GITHUB_TOKEN }}
# version: '21.5'

- name: Build native library
shell: bash
run: |
cd sql
mvn package -Pnative-lib
case "$OSTYPE" in
darwin*) PROTOC_ZIP=protoc-21.5-osx-x86_64.zip ;;
linux*) PROTOC_ZIP=protoc-21.5-linux-x86_64.zip ;;
msys*) PROTOC_ZIP=protoc-21.5-win64.zip ;;
esac
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v21.5/$PROTOC_ZIP
sudo unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
sudo unzip -o $PROTOC_ZIP -d /usr/local 'include/*'
rm -f $PROTOC_ZIP
mvn --batch-mode -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn test
mvn --batch-mode -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn package -Pnative-lib
40 changes: 38 additions & 2 deletions sql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.rilldata</groupId>
<artifactId>sql</artifactId>
<version>0.1.0-SNAPSHOT</version>
<version>0.1.1</version>
<properties>
<compiler-plugin.version>3.8.1</compiler-plugin.version>
<failsafe.useModulePath>false</failsafe.useModulePath>
Expand Down Expand Up @@ -119,8 +119,10 @@
<version>${compiler-plugin.version}</version>
<configuration>
<compilerArgs>
<arg>-parameters</arg>
<arg>-parameters --enable-preview</arg>
</compilerArgs>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -286,6 +288,12 @@
</sources>
</configuration>
</execution>
<execution>
<id>parse-version</id>
<goals>
<goal>parse-version</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Custom parser generation done -->
Expand Down Expand Up @@ -333,6 +341,34 @@
</plugins>
</build>
<profiles>
<profile>
<id>bump-patch</id>
<activation>
<property>
<name>bumpPatch</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: empty newline

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

<executions>
<execution>
<goals>
<goal>set</goal>
</goals>
<phase>validate</phase>
<configuration>
<newVersion>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.nextIncrementalVersion}</newVersion>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>native-lib</id>
<build>
Expand Down