Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
65 changes: 43 additions & 22 deletions .github/workflows/ci_master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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' ) }}
Expand All @@ -30,32 +30,39 @@ 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' ) }}
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:
Expand All @@ -64,25 +71,35 @@ 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
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0

- 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' ) }}
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:
Expand All @@ -95,15 +112,19 @@ jobs:
git config --global user.email "<>"
git config --global push.followTags true
lein pom
export VERSION=$(grep "<version>" 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 "<version>" | 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 "<version>" | 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
119 changes: 119 additions & 0 deletions .github/workflows/ci_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: "CI - Pull Requests"

on:
pull_request:
branches:
- 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: 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:
IP_STACK_ACCESS_KEY: ${{ secrets.IP_STACK_ACCESS_KEY }}
run: lein test

deploy-snapshot:
needs: test
runs-on: ubuntu-latest
timeout-minutes: 5
# Deploy snapshots for PRs so they can be tested elsewhere
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: 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:
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 "<version>" 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}}"; PR: "${{github.event.pull_request.number}}"; successfully deployed to Clojars"
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ pom.xml.asc
.lsp
.idea/
lein-protodeps.iml
.cider-repl-history
.cider-repl-history
.java-version
2 changes: 1 addition & 1 deletion src/leiningen/protodeps.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
33 changes: 32 additions & 1 deletion test/leiningen/protodeps_test.clj
Original file line number Diff line number Diff line change
@@ -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]))

Expand Down Expand Up @@ -71,3 +71,34 @@
(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"))))