diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1cecd3a425..738ade9d3e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,16 +1,16 @@ name: CI on: - pull_request: + push: branches: - main - - develop + pull_request: permissions: contents: read jobs: - build: + test: name: Build and Test runs-on: ubuntu-latest steps: @@ -22,5 +22,5 @@ jobs: distribution: 'temurin' cache: maven - - name: Build and test - run: mvn clean verify -B \ No newline at end of file + - name: Run tests + run: mvn test -B \ No newline at end of file diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml deleted file mode 100644 index c883fb3f9e..0000000000 --- a/.github/workflows/docker.yml +++ /dev/null @@ -1,193 +0,0 @@ -name: Docker Build and Push - -on: - push: - tags: - - '*.*.*' - -permissions: - contents: read - -jobs: - build-jvm: - name: Build JVM artifact - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-java@v4 - with: - java-version: '25' - distribution: 'temurin' - cache: maven - - - name: Build JVM artifact - run: mvn clean package -DskipTests -q - - - uses: actions/upload-artifact@v4 - with: - name: jvm-artifact - path: target/quarkus-app/ - retention-days: 1 - - build-native-amd64: - name: Build native artifact (amd64) - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: graalvm/setup-graalvm@v1 - with: - java-version: '24' - distribution: 'mandrel' - cache: maven - github-token: ${{ secrets.GITHUB_TOKEN }} - - - name: Build native executable - run: mvn clean package -Dnative -DskipTests -B - - - uses: actions/upload-artifact@v4 - with: - name: native-amd64 - path: | - target/*-runner - target/*.properties - target/*.so - if-no-files-found: warn - retention-days: 1 - - build-native-arm64: - name: Build native artifact (arm64) - runs-on: ubuntu-24.04-arm - steps: - - uses: actions/checkout@v4 - - - uses: graalvm/setup-graalvm@v1 - with: - java-version: '24' - distribution: 'mandrel' - cache: maven - github-token: ${{ secrets.GITHUB_TOKEN }} - - - name: Build native executable - run: mvn clean package -Dnative -DskipTests -B - - - uses: actions/upload-artifact@v4 - with: - name: native-arm64 - path: | - target/*-runner - target/*.properties - target/*.so - if-no-files-found: warn - retention-days: 1 - - push-jvm: - name: Push JVM Docker image - needs: build-jvm - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Extract version from tag - id: version - run: echo "version=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT" - - - uses: docker/setup-buildx-action@v3 - - - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - uses: actions/download-artifact@v4 - with: - name: jvm-artifact - path: target/quarkus-app/ - - - name: Build and push JVM image - uses: docker/build-push-action@v6 - with: - context: . - file: Dockerfile.jvm-package - platforms: linux/amd64,linux/arm64 - push: true - tags: | - ${{ secrets.DOCKERHUB_USERNAME }}/floci:latest-jvm - ${{ secrets.DOCKERHUB_USERNAME }}/floci:${{ steps.version.outputs.version }}-jvm - cache-from: type=gha - cache-to: type=gha,mode=max - build-args: | - VERSION=${{ steps.version.outputs.version }} - - push-native: - name: Push native Docker images - needs: [build-native-amd64, build-native-arm64] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Extract version from tag - id: version - run: echo "version=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT" - - - uses: docker/setup-buildx-action@v3 - - - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - uses: actions/download-artifact@v4 - with: - name: native-amd64 - path: native/amd64/ - - - uses: actions/download-artifact@v4 - with: - name: native-arm64 - path: native/arm64/ - - - name: Prepare amd64 target - run: | - mkdir -p target - cp native/amd64/* target/ - chmod +x target/*-runner - - - name: Build and push amd64 native image - uses: docker/build-push-action@v6 - with: - context: . - file: Dockerfile.native-package - platforms: linux/amd64 - push: true - tags: ${{ secrets.DOCKERHUB_USERNAME }}/floci:${{ steps.version.outputs.version }}-amd64 - build-args: | - VERSION=${{ steps.version.outputs.version }} - - - name: Prepare arm64 target - run: | - rm -rf target - mkdir -p target - cp native/arm64/* target/ - chmod +x target/*-runner - - - name: Build and push arm64 native image - uses: docker/build-push-action@v6 - with: - context: . - file: Dockerfile.native-package - platforms: linux/arm64 - push: true - tags: ${{ secrets.DOCKERHUB_USERNAME }}/floci:${{ steps.version.outputs.version }}-arm64 - build-args: | - VERSION=${{ steps.version.outputs.version }} - BINARY_FILE=native-arm64 - - - name: Create and push multi-arch manifest - run: | - docker buildx imagetools create \ - --tag ${{ secrets.DOCKERHUB_USERNAME }}/floci:latest \ - --tag ${{ secrets.DOCKERHUB_USERNAME }}/floci:${{ steps.version.outputs.version }} \ - ${{ secrets.DOCKERHUB_USERNAME }}/floci:${{ steps.version.outputs.version }}-amd64 \ - ${{ secrets.DOCKERHUB_USERNAME }}/floci:${{ steps.version.outputs.version }}-arm64 \ No newline at end of file diff --git a/.github/workflows/edge.yml b/.github/workflows/edge.yml new file mode 100644 index 0000000000..a2d0deb14f --- /dev/null +++ b/.github/workflows/edge.yml @@ -0,0 +1,54 @@ +name: Edge + +# Builds and publishes the JVM image from the tip of main as the `edge` Docker tag. +# Runs on a weekly schedule (every Monday 00:00 UTC) and can be triggered manually. +# Uses JVM-only build to keep runtime cost low (~2-3 min vs ~15 min for native). +# +# Published tag: hectorvent/floci:edge +# +# Required secrets: DOCKERHUB_USERNAME, DOCKERHUB_TOKEN + +on: + schedule: + - cron: '0 0 * * 1' # Every Monday at 00:00 UTC + workflow_dispatch: # Allow maintainers to trigger manually + +permissions: + contents: read + +jobs: + build-and-push-edge: + name: Build and push edge image + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + ref: main + + - uses: actions/setup-java@v4 + with: + java-version: '25' + distribution: 'temurin' + cache: maven + + - name: Build JVM artifact + run: mvn clean package -DskipTests -q + + - uses: docker/setup-buildx-action@v3 + + - uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push edge image + uses: docker/build-push-action@v6 + with: + context: . + file: Dockerfile.jvm-package + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/floci:edge + cache-from: type=gha + cache-to: type=gha,mode=max \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b5c0efa80b..2b694be915 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,32 +1,212 @@ name: Release +# Triggered when a version tag (e.g. 1.2.3) is pushed. +# Builds native (amd64 + arm64) and JVM Docker images and pushes them to Docker Hub. +# +# Published tags: +# Native: hectorvent/floci:1.2.3 hectorvent/floci:latest +# JVM: hectorvent/floci:1.2.3-jvm hectorvent/floci:latest-jvm +# +# Required secrets: DOCKERHUB_USERNAME, DOCKERHUB_TOKEN + on: push: - branches: - - main - - develop + tags: + - '[0-9]+.[0-9]+.[0-9]+' permissions: - contents: write + contents: read jobs: - release: - name: Semantic Release + # ── Build JVM artifact ──────────────────────────────────────────────────── + build-jvm: + name: Build JVM artifact runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - token: ${{ secrets.GH_TOKEN }} - persist-credentials: true # Change this to true - - name: Semantic Release - uses: cycjimmy/semantic-release-action@v4 + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-java@v4 with: - extra_plugins: | - @semantic-release/changelog - @semantic-release/git - @semantic-release/exec - env: - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + java-version: '25' + distribution: 'temurin' + cache: maven + + - name: Build JVM artifact + run: mvn clean package -DskipTests -q + + - uses: actions/upload-artifact@v4 + with: + name: jvm-artifact + path: target/quarkus-app/ + retention-days: 1 + + # ── Build native artifact — amd64 ──────────────────────────────────────── + build-native-amd64: + name: Build native artifact (amd64) + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: graalvm/setup-graalvm@v1 + with: + java-version: '24' + distribution: 'mandrel' + cache: maven + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Build native executable + run: mvn clean package -Dnative -DskipTests -B + + - uses: actions/upload-artifact@v4 + with: + name: native-amd64 + path: | + target/*-runner + target/*.properties + target/*.so + if-no-files-found: warn + retention-days: 1 + + # ── Build native artifact — arm64 ──────────────────────────────────────── + build-native-arm64: + name: Build native artifact (arm64) + runs-on: ubuntu-24.04-arm + + steps: + - uses: actions/checkout@v4 + + - uses: graalvm/setup-graalvm@v1 + with: + java-version: '24' + distribution: 'mandrel' + cache: maven + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Build native executable + run: mvn clean package -Dnative -DskipTests -B + + - uses: actions/upload-artifact@v4 + with: + name: native-arm64 + path: | + target/*-runner + target/*.properties + target/*.so + if-no-files-found: warn + retention-days: 1 + + # ── Push JVM Docker image ───────────────────────────────────────────────── + push-jvm: + name: Push JVM Docker image + needs: build-jvm + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Extract version + id: version + run: echo "version=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT" + + - uses: docker/setup-buildx-action@v3 + + - uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - uses: actions/download-artifact@v4 + with: + name: jvm-artifact + path: target/quarkus-app/ + + - name: Build and push JVM image + uses: docker/build-push-action@v6 + with: + context: . + file: Dockerfile.jvm-package + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ${{ secrets.DOCKERHUB_USERNAME }}/floci:${{ steps.version.outputs.version }}-jvm + ${{ secrets.DOCKERHUB_USERNAME }}/floci:latest-jvm + cache-from: type=gha + cache-to: type=gha,mode=max + build-args: | + VERSION=${{ steps.version.outputs.version }} + + # ── Push native Docker images (multi-arch manifest) ─────────────────────── + push-native: + name: Push native Docker images + needs: [build-native-amd64, build-native-arm64] + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Extract version + id: version + run: echo "version=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT" + + - uses: docker/setup-buildx-action@v3 + + - uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - uses: actions/download-artifact@v4 + with: + name: native-amd64 + path: native/amd64/ + + - uses: actions/download-artifact@v4 + with: + name: native-arm64 + path: native/arm64/ + + - name: Prepare amd64 target + run: | + mkdir -p target + cp native/amd64/* target/ + chmod +x target/*-runner + + - name: Build and push amd64 native image + uses: docker/build-push-action@v6 + with: + context: . + file: Dockerfile.native-package + platforms: linux/amd64 + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/floci:${{ steps.version.outputs.version }}-amd64 + build-args: | + VERSION=${{ steps.version.outputs.version }} + + - name: Prepare arm64 target + run: | + rm -rf target + mkdir -p target + cp native/arm64/* target/ + chmod +x target/*-runner + + - name: Build and push arm64 native image + uses: docker/build-push-action@v6 + with: + context: . + file: Dockerfile.native-package + platforms: linux/arm64 + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/floci:${{ steps.version.outputs.version }}-arm64 + build-args: | + VERSION=${{ steps.version.outputs.version }} + + # Combine the two platform-specific images into a single multi-arch manifest + - name: Create and push multi-arch manifest + run: | + docker buildx imagetools create \ + --tag ${{ secrets.DOCKERHUB_USERNAME }}/floci:${{ steps.version.outputs.version }} \ + --tag ${{ secrets.DOCKERHUB_USERNAME }}/floci:latest \ + ${{ secrets.DOCKERHUB_USERNAME }}/floci:${{ steps.version.outputs.version }}-amd64 \ + ${{ secrets.DOCKERHUB_USERNAME }}/floci:${{ steps.version.outputs.version }}-arm64 \ No newline at end of file diff --git a/.github/workflows/semver.yml b/.github/workflows/semver.yml new file mode 100644 index 0000000000..acb4ca0413 --- /dev/null +++ b/.github/workflows/semver.yml @@ -0,0 +1,45 @@ +name: Semantic Release + +# Runs semantic-release when a maintainer pushes to a release/x.y branch. +# semantic-release analyses commits since the last tag, bumps the version, +# updates CHANGELOG.md + pom.xml, commits them, and pushes a vX.Y.Z tag. +# That tag push then triggers the release.yml Docker publish workflow. +# +# Required secrets: GH_TOKEN (PAT with contents: write) + +on: + push: + branches: + - 'release/[0-9]+.x' + - 'release/[0-9]+.[0-9]+.x' + +permissions: + contents: write + +jobs: + release: + name: Semantic Release + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.GH_TOKEN }} + persist-credentials: true + + - uses: actions/setup-java@v4 + with: + java-version: '25' + distribution: 'temurin' + cache: maven + + - name: Run semantic-release + uses: cycjimmy/semantic-release-action@v4 + with: + extra_plugins: | + @semantic-release/changelog + @semantic-release/git + @semantic-release/exec + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} \ No newline at end of file diff --git a/.releaserc.json b/.releaserc.json index b5b3ecf4ad..630d497b3b 100644 --- a/.releaserc.json +++ b/.releaserc.json @@ -1,10 +1,9 @@ { "tagFormat": "${version}", "branches": [ - "main", { - "name": "develop", - "prerelease": "dev" + "name": "release/+([0-9])?(.{+([0-9]),x}).x", + "channel": "${name.replace(/^release\\//,'')}" } ], "plugins": [ @@ -26,9 +25,9 @@ "@semantic-release/git", { "assets": ["pom.xml", "CHANGELOG.md"], - "message": "chore(release): ${nextRelease.version} \n\n${nextRelease.notes}" + "message": "chore(release): ${nextRelease.version}\n\n${nextRelease.notes}" } ], "@semantic-release/github" ] -} +} \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index baa3a23a4e..26f036890d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -45,6 +45,16 @@ If you prefer to use your own Maven installation (3.9+), you can use `mvn` inste ./mvnw test -Dtest=SsmIntegrationTest#putParameter # single method ``` +## Branching Model + +Floci uses a **tag-driven release model**. Docker images are never published on PR merge — only when a maintainer pushes a version tag. + +| Branch | Purpose | Docker published? | +|---|---|---| +| `main` | Integration branch — all PRs merge here. Treated as unstable/nightly. | No (CI tests only) | +| `release/x.y.x` | Stable line for a minor version. Receives cherry-picked fixes from `main`. | No (CI tests only) | +| `X.Y.Z` tag | Signals a production release. Triggers the full Docker publish pipeline. | Yes (`x.y.z`, `latest`, `x.y.z-jvm`, `latest-jvm`) | + ## Commit Message Format This project uses [Conventional Commits](https://www.conventionalcommits.org/) — semantic-release reads these to generate the changelog and version bumps automatically. @@ -83,9 +93,48 @@ Always implement the **real AWS wire protocol** — never invent custom endpoint ## Pull Request Guidelines -- Keep PRs focused — one feature or fix per PR -- Follow the testing policy below -- Reference any related issues in the PR description +1. Branch off `main`: `git checkout -b feature/my-feature` +2. Open a PR targeting `main`. +3. CI runs tests automatically — all checks must pass before merge. +4. Keep PRs focused — one feature or fix per PR. +5. Reference any related issues in the PR description. + +Docker images are never built on contributor PRs, so merging to `main` is always cheap. + +## Release Process (maintainers) + +### New minor or major release + +```bash +# 1. Create a release branch from main +git checkout main && git pull +git checkout -b release/1.2.x + +# 2. Push — the semver.yml workflow runs semantic-release automatically, +# bumps the version, updates CHANGELOG.md + pom.xml, and pushes tag 1.2.0. +git push origin release/1.2.x + +# 3. The tag push triggers the Docker publish pipeline. +``` + +### Patch release on an existing line + +```bash +git checkout release/1.1.x +git cherry-pick +git push origin release/1.1.x +# semver workflow creates 1.1.x and triggers Docker publish +``` + +### Hotfix + +1. Fix on `main` via the normal PR process. +2. Cherry-pick the merge commit onto the relevant `release/x.y.x` branch and push. +3. If the bug only affects a release branch, open a PR directly against that branch. + +### Edge builds + +The `edge.yml` workflow publishes a JVM-only `hectorvent/floci:edge` image from `main` every Monday at 00:00 UTC. It can also be triggered manually from the Actions tab. ## Testing Policy for Pull Requests