Skip to content

Commit

Permalink
Increment version in gradle.properties automatically (#3082)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
alecgrieser authored Feb 7, 2025
1 parent c48b652 commit ce93a11
Show file tree
Hide file tree
Showing 16 changed files with 388 additions and 160 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v4.2.2
- name: Setup Base Environment
uses: ./actions/setup-base-env
- name: Setup FDB
uses: ./actions/setup-fdb
- name: Run Gradle Test
uses: ./actions/gradle-test
with:
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/patch_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Patch Release

on:
workflow_dispatch:
inputs:
branch:
description: 'Branch to build off of'
required: true


jobs:
gradle:
runs-on: ubuntu-latest
permissions:
checks: write
contents: write
packages: write
pages: read
pull-requests: write
steps:
- name: Checkout sources
uses: actions/checkout@v4.2.2
with:
ref: ${{ inputs.branch }}
- name: Setup Base Environment
uses: ./actions/setup-base-env
- name: Setup FDB
uses: ./actions/setup-fdb

# Push a version bump back to main. There are failure scenarios that can result
# in published artifacts but an erroneous build, so it's safer to bump the version
# at the beginning
- name: Configure Git
run: |
git config --global user.name 'FoundationDB CI'
git config --global user.email 'foundationdb_ci@apple.com'
- name: Increment Version
run: python build/versionutils.py gradle.properties -u PATCH --increment --commit
- name: Push Version Update
run: git push

- name: Build and publish release
uses: ./actions/release-build-publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
4 changes: 4 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v4.2.2
- name: Setup Base Environment
uses: ./actions/setup-base-env
- name: Setup FDB
uses: ./actions/setup-fdb
- name: Run Gradle Test
uses: ./actions/gradle-test
with:
Expand Down
40 changes: 30 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,42 @@
name: Release

on:
push:
branches:
- 'main'
workflow_dispatch:

jobs:
gradle:
runs-on: ubuntu-latest
permissions:
checks: write
contents: read
contents: write
packages: write
pages: write
pull-requests: write
steps:
- name: Checkout sources
uses: actions/checkout@v4.2.2
- name: Run Gradle Test
uses: ./actions/gradle-test
with:
gradle_args: "-PreleaseBuild=true"
- name: Checkout sources
uses: actions/checkout@v4.2.2
- name: Setup Base Environment
uses: ./actions/setup-base-env
- name: Setup FDB
uses: ./actions/setup-fdb

# Push a version bump back to main. There are failure scenarios that can result
# in published artifacts but an erroneous build, so it's safer to bump the version
# at the beginning
- name: Configure git
run: |
git config --global user.name 'FoundationDB CI'
git config --global user.email 'foundationdb_ci@apple.com'
- name: Increment version
run: python build/versionutils.py gradle.properties --increment --commit
- name: Push version increment
run: git push

- name: Build and publish
uses: ./actions/release-build-publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}

# TODO: Publish documentation updates
92 changes: 0 additions & 92 deletions .idea/compiler.xml

This file was deleted.

33 changes: 3 additions & 30 deletions actions/gradle-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,10 @@ inputs:
runs:
using: "composite"
steps:
- name: Download FDB Client
shell: bash
run: wget -nv https://github.com/apple/foundationdb/releases/download/${{ inputs.fdb_version }}/foundationdb-clients_${{ inputs.fdb_version }}-1_amd64.deb
- name: Download FDB Server
shell: bash
run: wget -nv https://github.com/apple/foundationdb/releases/download/${{ inputs.fdb_version }}/foundationdb-server_${{ inputs.fdb_version }}-1_amd64.deb
- name: Install FDB Server
shell: bash
run: sudo dpkg -i foundationdb-clients_${{ inputs.fdb_version }}-1_amd64.deb foundationdb-server_${{ inputs.fdb_version }}-1_amd64.deb
- name: Fix FDB Network Addresses
shell: bash
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
- name: Start FDB Server
shell: bash
run: sudo /usr/lib/foundationdb/fdbmonitor /etc/foundationdb/foundationdb.conf --daemonize
- name: Switch FDB to SSD
shell: bash
run: fdbcli --exec "configure single ssd storage_migration_type=aggressive; status"
- name: Set up JDK 17
uses: actions/setup-java@v4.7.0
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6
- name: Remove JVM args
shell: bash
run: sed -i -e "s/^org\.gradle\..*/#&/g" gradle.properties
- name: Run build and test
shell: bash
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 }}
uses: ./actions/run-gradle
with:
gradle_command: build destructiveTest -PcoreNotStrict ${{ inputs.gradle_args }}
- name: Copy Test Reports
shell: bash
if: always()
Expand Down
53 changes: 53 additions & 0 deletions actions/release-build-publish/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Build and publish release

runs:
using: "composite"
steps:
- name: Get version
id: get_version
shell: bash
run: |
echo "version=$(python build/versionutils.py gradle.properties)" >> "$GITHUB_OUTPUT"
- name: Run Gradle Test
uses: ./actions/gradle-test
with:
gradle_args: -PreleaseBuild=true -PpublishBuild=true
- name: Publish Artifacts
uses: ./actions/run-gradle
with:
gradle_command: publish -PreleaseBuild=true -PpublishBuild=true -PgithubPublish=true -PcentralPublish=true

# Post release: Update various files which reference version
- name: Update release notes
shell: bash
run: ARTIFACT_VERSION="${{ steps.get_version.outputs.version }}" ./build/update_release_notes.bash
- name: Update YAML test file versions
uses: ./actions/run-gradle
with:
gradle_command: updateYamsql -PreleaseBuild=true
- name: Commit YAML updates
shell: bash
run: python ./build/commit_yamsql_updates.py "${{ steps.get_version.outputs.version }}"

# Create and push the tag
- name: Create tag
shell: bash
run: git tag -m "Release ${{ steps.get_version_outputs.version }}" -f "${{ steps.get_version.outputs.version }}"
- name: Push tag
shell: bash
run: git push origin "${{ steps.get_version.outputs.version }}"
- name: Push Updates
id: push_updates
shell: bash
run: git push origin
- name: Create Merge PR if conflict
if: failure() && steps.push_updates.conclusion == 'failure'
uses: peter-evans/create-pull-request@v7
id: pr_on_conflict
with:
branch: release-build
branch-suffix: timestamp
title: "Updates for ${{ steps.get_version.outputs.version }} release"
sign-commits: true
body: |
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.
16 changes: 16 additions & 0 deletions actions/run-gradle/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Run Gradle

inputs:
gradle_command:
description: 'Gradle command to run'
required: true

runs:
using: "composite"
steps:
- name: Remove JVM args
shell: bash
run: sed -i -e "s/^org\.gradle\..*/#&/g" gradle.properties
- name: Run Command
shell: bash
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 }}
16 changes: 16 additions & 0 deletions actions/setup-base-env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Setup Base Environment

runs:
using: "composite"
steps:
- name: Set up JDK 17
uses: actions/setup-java@v4.7.0
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
29 changes: 29 additions & 0 deletions actions/setup-fdb/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Setup FDB

inputs:
fdb_version:
description: 'Version of FDB to run'
required: false
default: "7.3.42"

runs:
using: "composite"
steps:
- name: Download FDB Client
shell: bash
run: wget -nv https://github.com/apple/foundationdb/releases/download/${{ inputs.fdb_version }}/foundationdb-clients_${{ inputs.fdb_version }}-1_amd64.deb
- name: Download FDB Server
shell: bash
run: wget -nv https://github.com/apple/foundationdb/releases/download/${{ inputs.fdb_version }}/foundationdb-server_${{ inputs.fdb_version }}-1_amd64.deb
- name: Install FDB Server
shell: bash
run: sudo dpkg -i foundationdb-clients_${{ inputs.fdb_version }}-1_amd64.deb foundationdb-server_${{ inputs.fdb_version }}-1_amd64.deb
- name: Fix FDB Network Addresses
shell: bash
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
- name: Start FDB Server
shell: bash
run: sudo /usr/lib/foundationdb/fdbmonitor /etc/foundationdb/foundationdb.conf --daemonize
- name: Switch FDB to SSD
shell: bash
run: fdbcli --exec "configure single ssd storage_migration_type=aggressive; status"
4 changes: 2 additions & 2 deletions build/update_release_notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ def main(argv):
if args.overwrite:
with open(args.filename, 'w') as fout:
fout.write(new_contents)
print 'Updated {} for version {}'.format(args.filename, args.new_version)
print('Updated {} for version {}'.format(args.filename, args.new_version))
else:
print new_contents
print(new_contents)


if __name__ == '__main__':
Expand Down
Loading

0 comments on commit ce93a11

Please sign in to comment.