Skip to content

Commit ce93a11

Browse files
authored
Increment version in gradle.properties automatically (#3082)
* Update relase workflow to accept artifact version This updates the release workflow so that it runs when someone manually triggers it rather than on every commit. It also takes an argument for the version, which hopefully will fix some tests that are failing during the current build. It still doesn't update the build to do any of the other things we associate with releases (e.g., updating any of the values storing the current version), but it may give us insight into the release build itself. * Add script to increment version automatically and hook it into the release * increment version during release * update patch release build to merge into main at the end * remove artifact version task * update workflows based on testing * Add configuration to publish to GitHub packages and to Maven Central This adds the gradle configuration necessary to publish to maven central and GitHub packages if requested. It also then calls those methods during the release step of our GitHub actions. * separate out FDB and env setup to avoid running setup twice * verison bump * some cleanup * update to 4.1 ; add documentation about maven central * update release notes for #3111 * remove compiler.xml which is no longer necessary (as stated by the .gitignore) but will now update with every release * update versionutils.py to make more internally consistent
1 parent c48b652 commit ce93a11

File tree

16 files changed

+388
-160
lines changed

16 files changed

+388
-160
lines changed

.github/workflows/nightly.yml

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ jobs:
1010
steps:
1111
- name: Checkout sources
1212
uses: actions/[email protected]
13+
- name: Setup Base Environment
14+
uses: ./actions/setup-base-env
15+
- name: Setup FDB
16+
uses: ./actions/setup-fdb
1317
- name: Run Gradle Test
1418
uses: ./actions/gradle-test
1519
with:

.github/workflows/patch_release.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Patch Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
branch:
7+
description: 'Branch to build off of'
8+
required: true
9+
10+
11+
jobs:
12+
gradle:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
checks: write
16+
contents: write
17+
packages: write
18+
pages: read
19+
pull-requests: write
20+
steps:
21+
- name: Checkout sources
22+
uses: actions/[email protected]
23+
with:
24+
ref: ${{ inputs.branch }}
25+
- name: Setup Base Environment
26+
uses: ./actions/setup-base-env
27+
- name: Setup FDB
28+
uses: ./actions/setup-fdb
29+
30+
# Push a version bump back to main. There are failure scenarios that can result
31+
# in published artifacts but an erroneous build, so it's safer to bump the version
32+
# at the beginning
33+
- name: Configure Git
34+
run: |
35+
git config --global user.name 'FoundationDB CI'
36+
git config --global user.email '[email protected]'
37+
- name: Increment Version
38+
run: python build/versionutils.py gradle.properties -u PATCH --increment --commit
39+
- name: Push Version Update
40+
run: git push
41+
42+
- name: Build and publish release
43+
uses: ./actions/release-build-publish
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
MAVEN_USER: ${{ secrets.MAVEN_USER }}
47+
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}

.github/workflows/pull_request.yml

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ jobs:
1414
steps:
1515
- name: Checkout sources
1616
uses: actions/[email protected]
17+
- name: Setup Base Environment
18+
uses: ./actions/setup-base-env
19+
- name: Setup FDB
20+
uses: ./actions/setup-fdb
1721
- name: Run Gradle Test
1822
uses: ./actions/gradle-test
1923
with:

.github/workflows/release.yml

+30-10
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,42 @@
11
name: Release
22

33
on:
4-
push:
5-
branches:
6-
- 'main'
4+
workflow_dispatch:
75

86
jobs:
97
gradle:
108
runs-on: ubuntu-latest
119
permissions:
1210
checks: write
13-
contents: read
11+
contents: write
1412
packages: write
1513
pages: write
14+
pull-requests: write
1615
steps:
17-
- name: Checkout sources
18-
uses: actions/[email protected]
19-
- name: Run Gradle Test
20-
uses: ./actions/gradle-test
21-
with:
22-
gradle_args: "-PreleaseBuild=true"
16+
- name: Checkout sources
17+
uses: actions/[email protected]
18+
- name: Setup Base Environment
19+
uses: ./actions/setup-base-env
20+
- name: Setup FDB
21+
uses: ./actions/setup-fdb
22+
23+
# Push a version bump back to main. There are failure scenarios that can result
24+
# in published artifacts but an erroneous build, so it's safer to bump the version
25+
# at the beginning
26+
- name: Configure git
27+
run: |
28+
git config --global user.name 'FoundationDB CI'
29+
git config --global user.email '[email protected]'
30+
- name: Increment version
31+
run: python build/versionutils.py gradle.properties --increment --commit
32+
- name: Push version increment
33+
run: git push
34+
35+
- name: Build and publish
36+
uses: ./actions/release-build-publish
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
MAVEN_USER: ${{ secrets.MAVEN_USER }}
40+
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
41+
42+
# TODO: Publish documentation updates

.idea/compiler.xml

-92
This file was deleted.

actions/gradle-test/action.yml

+3-30
Original file line numberDiff line numberDiff line change
@@ -12,37 +12,10 @@ inputs:
1212
runs:
1313
using: "composite"
1414
steps:
15-
- name: Download FDB Client
16-
shell: bash
17-
run: wget -nv https://github.com/apple/foundationdb/releases/download/${{ inputs.fdb_version }}/foundationdb-clients_${{ inputs.fdb_version }}-1_amd64.deb
18-
- name: Download FDB Server
19-
shell: bash
20-
run: wget -nv https://github.com/apple/foundationdb/releases/download/${{ inputs.fdb_version }}/foundationdb-server_${{ inputs.fdb_version }}-1_amd64.deb
21-
- name: Install FDB Server
22-
shell: bash
23-
run: sudo dpkg -i foundationdb-clients_${{ inputs.fdb_version }}-1_amd64.deb foundationdb-server_${{ inputs.fdb_version }}-1_amd64.deb
24-
- name: Fix FDB Network Addresses
25-
shell: bash
26-
run: sudo sed -i -e "s/public_address = auto:\$ID/public_address = 127.0.0.1:\$ID/g" -e "s/listen_address = public/listen_address = 0.0.0.0:\$ID/g" /etc/foundationdb/foundationdb.conf
27-
- name: Start FDB Server
28-
shell: bash
29-
run: sudo /usr/lib/foundationdb/fdbmonitor /etc/foundationdb/foundationdb.conf --daemonize
30-
- name: Switch FDB to SSD
31-
shell: bash
32-
run: fdbcli --exec "configure single ssd storage_migration_type=aggressive; status"
33-
- name: Set up JDK 17
34-
uses: actions/[email protected]
35-
with:
36-
java-version: '17'
37-
distribution: 'temurin'
38-
- name: Setup Gradle
39-
uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6
40-
- name: Remove JVM args
41-
shell: bash
42-
run: sed -i -e "s/^org\.gradle\..*/#&/g" gradle.properties
4315
- name: Run build and test
44-
shell: bash
45-
run: GRADLE_OPTS="-XX:+HeapDumpOnOutOfMemoryError -Xverify:none -XX:+TieredCompilation -Xmx4096m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED" ./gradlew --no-daemon --console=plain -b ./build.gradle build destructiveTest -PcoreNotStrict ${{ inputs.gradle_args }}
16+
uses: ./actions/run-gradle
17+
with:
18+
gradle_command: build destructiveTest -PcoreNotStrict ${{ inputs.gradle_args }}
4619
- name: Copy Test Reports
4720
shell: bash
4821
if: always()
+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Build and publish release
2+
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Get version
7+
id: get_version
8+
shell: bash
9+
run: |
10+
echo "version=$(python build/versionutils.py gradle.properties)" >> "$GITHUB_OUTPUT"
11+
- name: Run Gradle Test
12+
uses: ./actions/gradle-test
13+
with:
14+
gradle_args: -PreleaseBuild=true -PpublishBuild=true
15+
- name: Publish Artifacts
16+
uses: ./actions/run-gradle
17+
with:
18+
gradle_command: publish -PreleaseBuild=true -PpublishBuild=true -PgithubPublish=true -PcentralPublish=true
19+
20+
# Post release: Update various files which reference version
21+
- name: Update release notes
22+
shell: bash
23+
run: ARTIFACT_VERSION="${{ steps.get_version.outputs.version }}" ./build/update_release_notes.bash
24+
- name: Update YAML test file versions
25+
uses: ./actions/run-gradle
26+
with:
27+
gradle_command: updateYamsql -PreleaseBuild=true
28+
- name: Commit YAML updates
29+
shell: bash
30+
run: python ./build/commit_yamsql_updates.py "${{ steps.get_version.outputs.version }}"
31+
32+
# Create and push the tag
33+
- name: Create tag
34+
shell: bash
35+
run: git tag -m "Release ${{ steps.get_version_outputs.version }}" -f "${{ steps.get_version.outputs.version }}"
36+
- name: Push tag
37+
shell: bash
38+
run: git push origin "${{ steps.get_version.outputs.version }}"
39+
- name: Push Updates
40+
id: push_updates
41+
shell: bash
42+
run: git push origin
43+
- name: Create Merge PR if conflict
44+
if: failure() && steps.push_updates.conclusion == 'failure'
45+
uses: peter-evans/create-pull-request@v7
46+
id: pr_on_conflict
47+
with:
48+
branch: release-build
49+
branch-suffix: timestamp
50+
title: "Updates for ${{ steps.get_version.outputs.version }} release"
51+
sign-commits: true
52+
body: |
53+
Updates from release for version ${{ steps.get_version.outputs.version }}. Conflicts during the build prevented automatic updating. Please resolve conflicts by checking out the current branch, merging, and then deleting this branch.

actions/run-gradle/action.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Run Gradle
2+
3+
inputs:
4+
gradle_command:
5+
description: 'Gradle command to run'
6+
required: true
7+
8+
runs:
9+
using: "composite"
10+
steps:
11+
- name: Remove JVM args
12+
shell: bash
13+
run: sed -i -e "s/^org\.gradle\..*/#&/g" gradle.properties
14+
- name: Run Command
15+
shell: bash
16+
run: GRADLE_OPTS="-XX:+HeapDumpOnOutOfMemoryError -Xverify:none -XX:+TieredCompilation -Xmx4096m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED" ./gradlew --no-daemon --console=plain -b ./build.gradle ${{ inputs.gradle_command }}

actions/setup-base-env/action.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Setup Base Environment
2+
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Set up JDK 17
7+
uses: actions/[email protected]
8+
with:
9+
java-version: '17'
10+
distribution: 'temurin'
11+
- name: Setup Gradle
12+
uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6
13+
- name: Setup Python
14+
uses: actions/setup-python@v5
15+
with:
16+
python-version: '3.13'

actions/setup-fdb/action.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Setup FDB
2+
3+
inputs:
4+
fdb_version:
5+
description: 'Version of FDB to run'
6+
required: false
7+
default: "7.3.42"
8+
9+
runs:
10+
using: "composite"
11+
steps:
12+
- name: Download FDB Client
13+
shell: bash
14+
run: wget -nv https://github.com/apple/foundationdb/releases/download/${{ inputs.fdb_version }}/foundationdb-clients_${{ inputs.fdb_version }}-1_amd64.deb
15+
- name: Download FDB Server
16+
shell: bash
17+
run: wget -nv https://github.com/apple/foundationdb/releases/download/${{ inputs.fdb_version }}/foundationdb-server_${{ inputs.fdb_version }}-1_amd64.deb
18+
- name: Install FDB Server
19+
shell: bash
20+
run: sudo dpkg -i foundationdb-clients_${{ inputs.fdb_version }}-1_amd64.deb foundationdb-server_${{ inputs.fdb_version }}-1_amd64.deb
21+
- name: Fix FDB Network Addresses
22+
shell: bash
23+
run: sudo sed -i -e "s/public_address = auto:\$ID/public_address = 127.0.0.1:\$ID/g" -e "s/listen_address = public/listen_address = 0.0.0.0:\$ID/g" /etc/foundationdb/foundationdb.conf
24+
- name: Start FDB Server
25+
shell: bash
26+
run: sudo /usr/lib/foundationdb/fdbmonitor /etc/foundationdb/foundationdb.conf --daemonize
27+
- name: Switch FDB to SSD
28+
shell: bash
29+
run: fdbcli --exec "configure single ssd storage_migration_type=aggressive; status"

build/update_release_notes.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ def main(argv):
121121
if args.overwrite:
122122
with open(args.filename, 'w') as fout:
123123
fout.write(new_contents)
124-
print 'Updated {} for version {}'.format(args.filename, args.new_version)
124+
print('Updated {} for version {}'.format(args.filename, args.new_version))
125125
else:
126-
print new_contents
126+
print(new_contents)
127127

128128

129129
if __name__ == '__main__':

0 commit comments

Comments
 (0)