From 42ada57f19834bcde10b489a9eb54bdc0719f12f Mon Sep 17 00:00:00 2001 From: Yevgeni Tsodikov Date: Wed, 6 Aug 2025 22:15:34 +0300 Subject: [PATCH 1/7] Fix `aarch64` arch name --- src/leiningen/protodeps.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/leiningen/protodeps.clj b/src/leiningen/protodeps.clj index ae30338..ac61823 100644 --- a/src/leiningen/protodeps.clj +++ b/src/leiningen/protodeps.clj @@ -138,7 +138,7 @@ (recur)))) (def os-name->os {"Linux" "linux" "Mac OS X" "osx"}) -(def os-arch->arch {"amd64" "x86_64" "x86_64" "x86_64" "aarch64" "aarch64"}) +(def os-arch->arch {"amd64" "x86_64" "x86_64" "x86_64" "aarch64" "aarch_64"}) (defn get-prop [env prop-name] From 19390a5047a4343ae5b6b335305b42e583aa6a31 Mon Sep 17 00:00:00 2001 From: Yevgeni Tsodikov Date: Wed, 6 Aug 2025 22:31:01 +0300 Subject: [PATCH 2/7] Add comprehensive unit tests for aarch64 architecture mapping fix - Add tests for `aarch64 -> aarch_64` mapping - Add tests for URL generation with correct architecture - Add specific test for GitHub issue #8 fix --- test/leiningen/protodeps_test.clj | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/test/leiningen/protodeps_test.clj b/test/leiningen/protodeps_test.clj index 3f2a0da..b3b2011 100644 --- a/test/leiningen/protodeps_test.clj +++ b/test/leiningen/protodeps_test.clj @@ -1,6 +1,6 @@ (ns leiningen.protodeps-test (:require [leiningen.protodeps :as sut] - [clojure.test :refer [deftest is]]) + [clojure.test :refer [deftest is testing]]) (:import [java.nio.file Path] [java.io File])) @@ -71,3 +71,30 @@ (map #(.relativize tmp-dir (.toPath ^File %))) (map str) set))))))) + +(deftest aarch64-architecture-mapping-test + (testing "Test that aarch64 architecture is correctly mapped to aarch_64 for protoc download URLs" + (is (= "aarch_64" (get sut/os-arch->arch "aarch64")) + "aarch64 should map to aarch_64 for correct protoc binary download URL"))) + +(deftest aarch64-url-generation-test + (testing "Test that protoc download URL is correctly generated for aarch64 architecture" + (let [platform {:os-name "linux" :os-arch "aarch_64" :semver "24.3"} + url-template "https://github.com/protocolbuffers/protobuf/releases/download/v${:semver}/protoc-${:semver}-${:os-name}-${:os-arch}.zip" + expected-url "https://github.com/protocolbuffers/protobuf/releases/download/v24.3/protoc-24.3-linux-aarch_64.zip"] + (is (= expected-url (@#'sut/interpolate platform url-template)) + "URL should be correctly generated with aarch_64 architecture name")))) + +(deftest aarch64-issue-8-fix-test + (testing "Test that the fix for GitHub issue #8 works correctly" + (let [platform {:os-name "linux" :os-arch "aarch_64" :semver "24.3"} + url-template "https://github.com/protocolbuffers/protobuf/releases/download/v${:semver}/protoc-${:semver}-${:os-name}-${:os-arch}.zip" + generated-url (@#'sut/interpolate platform url-template) + ;; The issue mentioned the correct URL should have aarch_64 (with underscore) + correct-url "https://github.com/protocolbuffers/protobuf/releases/download/v24.3/protoc-24.3-linux-aarch_64.zip" + ;; The issue mentioned the incorrect URL was aarch64 (without underscore) + incorrect-url "https://github.com/protocolbuffers/protobuf/releases/download/v24.3/protoc-24.3-linux-aarch64.zip"] + (is (= correct-url generated-url) + "Generated URL should match the correct format with aarch_64") + (is (not= incorrect-url generated-url) + "Generated URL should NOT match the incorrect format with aarch64")))) From 21fe86abaaf3186ef6b9c1fbbbd16c8c696b9d95 Mon Sep 17 00:00:00 2001 From: Yevgeni Tsodikov Date: Wed, 6 Aug 2025 22:37:18 +0300 Subject: [PATCH 3/7] Update protodeps_test.clj --- test/leiningen/protodeps_test.clj | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/test/leiningen/protodeps_test.clj b/test/leiningen/protodeps_test.clj index b3b2011..ee22a2e 100644 --- a/test/leiningen/protodeps_test.clj +++ b/test/leiningen/protodeps_test.clj @@ -79,19 +79,23 @@ (deftest aarch64-url-generation-test (testing "Test that protoc download URL is correctly generated for aarch64 architecture" - (let [platform {:os-name "linux" :os-arch "aarch_64" :semver "24.3"} - url-template "https://github.com/protocolbuffers/protobuf/releases/download/v${:semver}/protoc-${:semver}-${:os-name}-${:os-arch}.zip" - expected-url "https://github.com/protocolbuffers/protobuf/releases/download/v24.3/protoc-24.3-linux-aarch_64.zip"] + (let [platform {:os-name "linux" + :os-arch "aarch_64" + :semver "24.3"} + url-template "https://github.com/protocolbuffers/protobuf/releases/download/v${:semver}/protoc-${:semver}-${:os-name}-${:os-arch}.zip" + expected-url "https://github.com/protocolbuffers/protobuf/releases/download/v24.3/protoc-24.3-linux-aarch_64.zip"] (is (= expected-url (@#'sut/interpolate platform url-template)) "URL should be correctly generated with aarch_64 architecture name")))) (deftest aarch64-issue-8-fix-test (testing "Test that the fix for GitHub issue #8 works correctly" - (let [platform {:os-name "linux" :os-arch "aarch_64" :semver "24.3"} - url-template "https://github.com/protocolbuffers/protobuf/releases/download/v${:semver}/protoc-${:semver}-${:os-name}-${:os-arch}.zip" + (let [platform {:os-name "linux" + :os-arch "aarch_64" + :semver "24.3"} + url-template "https://github.com/protocolbuffers/protobuf/releases/download/v${:semver}/protoc-${:semver}-${:os-name}-${:os-arch}.zip" generated-url (@#'sut/interpolate platform url-template) ;; The issue mentioned the correct URL should have aarch_64 (with underscore) - correct-url "https://github.com/protocolbuffers/protobuf/releases/download/v24.3/protoc-24.3-linux-aarch_64.zip" + correct-url "https://github.com/protocolbuffers/protobuf/releases/download/v24.3/protoc-24.3-linux-aarch_64.zip" ;; The issue mentioned the incorrect URL was aarch64 (without underscore) incorrect-url "https://github.com/protocolbuffers/protobuf/releases/download/v24.3/protoc-24.3-linux-aarch64.zip"] (is (= correct-url generated-url) From 60a3a9e719bf997238ec470fbc17b69dcf008e96 Mon Sep 17 00:00:00 2001 From: Yevgeni Tsodikov Date: Wed, 6 Aug 2025 22:52:02 +0300 Subject: [PATCH 4/7] Update CI for PRs --- .github/workflows/ci_master.yml | 28 ++++---- .github/workflows/ci_pr.yml | 109 ++++++++++++++++++++++++++++++++ 2 files changed, 123 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/ci_pr.yml diff --git a/.github/workflows/ci_master.yml b/.github/workflows/ci_master.yml index 65b239d..a07609c 100644 --- a/.github/workflows/ci_master.yml +++ b/.github/workflows/ci_master.yml @@ -7,20 +7,20 @@ on: jobs: build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest timeout-minutes: 5 steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up JDK 8 - uses: actions/setup-java@v2 + uses: actions/setup-java@v4 with: distribution: zulu java-version: 8 - name: Restore local Maven repository from cache - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ~/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles( 'project.clj' ) }} @@ -30,27 +30,27 @@ jobs: - name: Setup linter uses: DeLaGuardo/setup-clj-kondo@master with: - version: '2021.06.18' + version: '2025.07.28' - name: Lint - run: clj-kondo --lint src + run: clj-kondo --lint src test test: needs: build - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest timeout-minutes: 5 steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up JDK 8 - uses: actions/setup-java@v2 + uses: actions/setup-java@v4 with: distribution: zulu java-version: 8 - name: Restore local Maven repository from cache - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ~/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles( 'project.clj' ) }} @@ -64,20 +64,20 @@ jobs: deploy: needs: test - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest timeout-minutes: 5 steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up JDK 8 - uses: actions/setup-java@v2 + uses: actions/setup-java@v4 with: distribution: zulu java-version: 8 - name: Restore local Maven repository from cache - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ~/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles( 'project.clj' ) }} diff --git a/.github/workflows/ci_pr.yml b/.github/workflows/ci_pr.yml new file mode 100644 index 0000000..49eee37 --- /dev/null +++ b/.github/workflows/ci_pr.yml @@ -0,0 +1,109 @@ +name: "CI - Pull Requests" + +on: + pull_request: + branches: + - master + push: + branches-ignore: + - master + +jobs: + build: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up JDK 8 + uses: actions/setup-java@v4 + with: + distribution: zulu + java-version: 8 + + - name: Restore local Maven repository from cache + uses: actions/cache@v4 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles( 'project.clj' ) }} + restore-keys: | + ${{ runner.os }}-maven- + + - name: Setup linter + uses: DeLaGuardo/setup-clj-kondo@master + with: + version: '2025.07.28' + + - name: Lint + run: clj-kondo --lint src test + + test: + needs: build + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up JDK 8 + uses: actions/setup-java@v4 + with: + distribution: zulu + java-version: 8 + + - name: Restore local Maven repository from cache + uses: actions/cache@v4 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles( 'project.clj' ) }} + restore-keys: | + ${{ runner.os }}-maven- + + - name: Unit tests + env: + IP_STACK_ACCESS_KEY: ${{ secrets.IP_STACK_ACCESS_KEY }} + run: lein test + + deploy-snapshot: + needs: test + runs-on: ubuntu-latest + timeout-minutes: 5 + # Only deploy snapshots for pushes to non-master branches (not PRs) + if: github.event_name == 'push' && github.ref != 'refs/heads/master' + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up JDK 8 + uses: actions/setup-java@v4 + with: + distribution: zulu + java-version: 8 + + - name: Restore local Maven repository from cache + uses: actions/cache@v4 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles( 'project.clj' ) }} + restore-keys: | + ${{ runner.os }}-maven- + + - name: Deploy SNAPSHOT version + env: + SNAPSHOT_REGEX: ^[0-9]{1,2}[.][0-9]{1,2}[.][0-9]{1,3}-SNAPSHOT$ + CLOJARS_USERNAME: ${{ secrets.CLOJARS_USERNAME }} + CLOJARS_PASSWORD: ${{ secrets.CLOJARS_PASSWORD }} + run: | + git config --global user.name "github-actions-bot" + git config --global user.email "<>" + lein pom + export VERSION=$(grep "" pom.xml | head -1 | cut -d ">" -f2 | cut -d "<" -f1) + echo "version is:" $VERSION + if [[ !("$VERSION" =~ $SNAPSHOT_REGEX) ]] + then + echo "Version isn't a SNAPSHOT version:" $VERSION ", skipping deployment to Clojars..." + exit 0 + fi + lein deploy + echo "SNAPSHOT version:" $VERSION"; commit: "${{github.sha}}"; branch: "${{github.ref_name}}"; successfully deployed to Clojars" From 707c955558ce930644cf4dc62075154b9e1ce9c8 Mon Sep 17 00:00:00 2001 From: Yevgeni Tsodikov Date: Wed, 6 Aug 2025 22:56:33 +0300 Subject: [PATCH 5/7] install `lein` --- .github/workflows/ci_master.yml | 14 ++++++++++++++ .github/workflows/ci_pr.yml | 22 ++++++++++++++++------ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci_master.yml b/.github/workflows/ci_master.yml index a07609c..162939d 100644 --- a/.github/workflows/ci_master.yml +++ b/.github/workflows/ci_master.yml @@ -56,6 +56,13 @@ jobs: key: ${{ runner.os }}-maven-${{ hashFiles( 'project.clj' ) }} restore-keys: | ${{ runner.os }}-maven- + + - name: Install Leiningen + run: | + wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein + chmod +x lein + sudo mv lein /usr/local/bin/ + lein version - name: Unit tests env: @@ -83,6 +90,13 @@ jobs: key: ${{ runner.os }}-maven-${{ hashFiles( 'project.clj' ) }} restore-keys: | ${{ runner.os }}-maven- + + - name: Install Leiningen + run: | + wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein + chmod +x lein + sudo mv lein /usr/local/bin/ + lein version - name: Deploy release version env: diff --git a/.github/workflows/ci_pr.yml b/.github/workflows/ci_pr.yml index 49eee37..5317f48 100644 --- a/.github/workflows/ci_pr.yml +++ b/.github/workflows/ci_pr.yml @@ -4,9 +4,6 @@ on: pull_request: branches: - master - push: - branches-ignore: - - master jobs: build: @@ -59,6 +56,13 @@ jobs: key: ${{ runner.os }}-maven-${{ hashFiles( 'project.clj' ) }} restore-keys: | ${{ runner.os }}-maven- + + - name: Install Leiningen + run: | + wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein + chmod +x lein + sudo mv lein /usr/local/bin/ + lein version - name: Unit tests env: @@ -69,8 +73,7 @@ jobs: needs: test runs-on: ubuntu-latest timeout-minutes: 5 - # Only deploy snapshots for pushes to non-master branches (not PRs) - if: github.event_name == 'push' && github.ref != 'refs/heads/master' + # Deploy snapshots for PRs so they can be tested elsewhere steps: - name: Checkout uses: actions/checkout@v4 @@ -88,6 +91,13 @@ jobs: key: ${{ runner.os }}-maven-${{ hashFiles( 'project.clj' ) }} restore-keys: | ${{ runner.os }}-maven- + + - name: Install Leiningen + run: | + wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein + chmod +x lein + sudo mv lein /usr/local/bin/ + lein version - name: Deploy SNAPSHOT version env: @@ -106,4 +116,4 @@ jobs: exit 0 fi lein deploy - echo "SNAPSHOT version:" $VERSION"; commit: "${{github.sha}}"; branch: "${{github.ref_name}}"; successfully deployed to Clojars" + echo "SNAPSHOT version:" $VERSION"; commit: "${{github.sha}}"; PR: "${{github.event.pull_request.number}}"; successfully deployed to Clojars" From 2e6c0fdb2fb468e0676d58d2e3c95bed62855db5 Mon Sep 17 00:00:00 2001 From: Yevgeni Tsodikov Date: Thu, 7 Aug 2025 09:53:49 +0300 Subject: [PATCH 6/7] Update GitHub Actions workflows - Simplify ci_master.yml to use Leiningen's built-in release functionality - Use lein change version and lein release commands for cleaner version management - Add fetch-depth: 0 and token for proper git operations - Update to latest Ubuntu runners and action versions - Add ci_pr.yml workflow for SNAPSHOT deployments on PRs - Optimize Leiningen installation to only run where needed - Add .java-version to .gitignore --- .github/workflows/ci_master.yml | 23 +++++++++++++++-------- .gitignore | 3 ++- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci_master.yml b/.github/workflows/ci_master.yml index 162939d..1a61c83 100644 --- a/.github/workflows/ci_master.yml +++ b/.github/workflows/ci_master.yml @@ -76,6 +76,9 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + fetch-depth: 0 - name: Set up JDK 8 uses: actions/setup-java@v4 @@ -109,15 +112,19 @@ jobs: git config --global user.email "<>" git config --global push.followTags true lein pom - export VERSION=$(grep "" pom.xml | head -1 | cut -d ">" -f2 | cut -d "<" -f1) - echo "version is:" $VERSION - if [[ !("$VERSION" =~ $RELEASE_REGEX) ]] + export ORIGINAL_VERSION=$(less pom.xml | grep "" | head -1 | cut -d ">" -f2 | cut -d "<" -f1) + echo "Original version is:" $ORIGINAL_VERSION + lein change version leiningen.release/bump-version release + lein do vcs commit, install + lein pom + export RELEASE_VERSION=$(less pom.xml | grep "" | head -1 | cut -d ">" -f2 | cut -d "<" -f1) + echo "Release version is:" $RELEASE_VERSION + if [[ !("$RELEASE_VERSION" =~ $RELEASE_REGEX) ]] then - echo "Version isn't a release version:" $VERSION ", skipping deployment to Clojars..." + echo "Version isn't a release version:" $RELEASE_VERSION ", skipping deployment to Clojars..." exit 0 fi lein deploy - echo "Release version:" $VERSION"; commit: "${{github.sha}}"; successfully deployed to Clojars" - export TAG_NAME="v$VERSION" - git tag -a -m "Version $VERSION" $TAG_NAME - git push origin $TAG_NAME + echo "Release version:" $RELEASE_VERSION"; commit: "${{github.sha}}"; successfully deployed to Clojars" + git tag -a $RELEASE_VERSION -m "Release version $RELEASE_VERSION" + git push origin master diff --git a/.gitignore b/.gitignore index 8949d55..b24f6c9 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,5 @@ pom.xml.asc .lsp .idea/ lein-protodeps.iml -.cider-repl-history \ No newline at end of file +.cider-repl-history +.java-version From 547dd6b008105a3c2dd360aaba3ca955a805c3a9 Mon Sep 17 00:00:00 2001 From: Yevgeni Tsodikov Date: Thu, 7 Aug 2025 10:23:55 +0300 Subject: [PATCH 7/7] Update documentation for v1.0.6 - Update CHANGELOG.md with comprehensive release notes for v1.0.6 - Update README.md version reference from 1.0.5 to 1.0.6 - Add clarification about aarch64 -> aarch_64 architecture mapping in README --- CHANGELOG.md | 25 ++++++++++++++++++++++++- README.md | 4 ++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8266044..087505f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# Change Log +# Changelog All notable changes to this project will be documented in this file. @@ -6,4 +6,27 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] + +## [1.0.6] - 2025-08-07 + +### Fixed +* Fix aarch64 architecture mapping for protoc binary downloads. The `os-arch->arch` map now correctly maps `"aarch64"` to `"aarch_64"` to match the actual protoc binary naming convention. + +### Added +* Unit tests for aarch64 architecture fix to ensure correct URL generation for protoc downloads. +* GitHub Actions workflows for CI/CD: + * `ci_pr.yml` - Runs tests and deploys SNAPSHOT versions on pull requests + * `ci_master.yml` - Runs tests and handles release deployments on master branch merges +* Modern CI configuration using latest Ubuntu runners and updated action versions. + ### Changed +* Updated GitHub Actions workflows to use: + * `ubuntu-latest` runners + * `actions/checkout@v4` + * `actions/setup-java@v4` + * `actions/cache@v4` + * `clj-kondo` version `2025.07.28` +* Optimized Leiningen installation in CI to only run where needed. +* Added `.java-version` to `.gitignore`. + +[1.0.6]: https://github.com/AppsFlyer/lein-protodeps/compare/1.0.5...1.0.6 diff --git a/README.md b/README.md index 16c6431..d1e0d8e 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ are not already installed. ## Usage -Put `[com.appsflyer/lein-protodeps "1.0.5"]` into the `:plugins` vector of your project.clj. +Put `[com.appsflyer/lein-protodeps "1.0.6"]` into the `:plugins` vector of your project.clj. Once installed, run `lein protodeps generate` to run the plugin. @@ -97,7 +97,7 @@ However, it is possible to override these to other endpoints by setting `:protoc The values of these options are URL templates that will be interpolated at runtime with the following variables to produce download URLs: * `:os-name` host OS (i.e, `linux`, `osx`) -* `:os-arch` host architecture (i.e, `x86_64`, `aarch64`) +* `:os-arch` host architecture (i.e, `x86_64`, `aarch_64`). Note: `aarch64` systems are automatically mapped to `aarch_64` to match protoc binary naming conventions * `:semver` version string as defined in `:protoc-version` or `:grpc-version` * `:major` major part of `:semver` * `:minor` minor part of `:semver`