Skip to content

Commit 60a3a9e

Browse files
authored
Update CI for PRs
1 parent 21fe86a commit 60a3a9e

File tree

2 files changed

+123
-14
lines changed

2 files changed

+123
-14
lines changed

.github/workflows/ci_master.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@ on:
77

88
jobs:
99
build:
10-
runs-on: ubuntu-20.04
10+
runs-on: ubuntu-latest
1111
timeout-minutes: 5
1212
steps:
1313
- name: Checkout
14-
uses: actions/checkout@v2
14+
uses: actions/checkout@v4
1515

1616
- name: Set up JDK 8
17-
uses: actions/setup-java@v2
17+
uses: actions/setup-java@v4
1818
with:
1919
distribution: zulu
2020
java-version: 8
2121

2222
- name: Restore local Maven repository from cache
23-
uses: actions/cache@v2
23+
uses: actions/cache@v4
2424
with:
2525
path: ~/.m2/repository
2626
key: ${{ runner.os }}-maven-${{ hashFiles( 'project.clj' ) }}
@@ -30,27 +30,27 @@ jobs:
3030
- name: Setup linter
3131
uses: DeLaGuardo/setup-clj-kondo@master
3232
with:
33-
version: '2021.06.18'
33+
version: '2025.07.28'
3434

3535
- name: Lint
36-
run: clj-kondo --lint src
36+
run: clj-kondo --lint src test
3737

3838
test:
3939
needs: build
40-
runs-on: ubuntu-20.04
40+
runs-on: ubuntu-latest
4141
timeout-minutes: 5
4242
steps:
4343
- name: Checkout
44-
uses: actions/checkout@v2
44+
uses: actions/checkout@v4
4545

4646
- name: Set up JDK 8
47-
uses: actions/setup-java@v2
47+
uses: actions/setup-java@v4
4848
with:
4949
distribution: zulu
5050
java-version: 8
5151

5252
- name: Restore local Maven repository from cache
53-
uses: actions/cache@v2
53+
uses: actions/cache@v4
5454
with:
5555
path: ~/.m2/repository
5656
key: ${{ runner.os }}-maven-${{ hashFiles( 'project.clj' ) }}
@@ -64,20 +64,20 @@ jobs:
6464

6565
deploy:
6666
needs: test
67-
runs-on: ubuntu-20.04
67+
runs-on: ubuntu-latest
6868
timeout-minutes: 5
6969
steps:
7070
- name: Checkout
71-
uses: actions/checkout@v2
71+
uses: actions/checkout@v4
7272

7373
- name: Set up JDK 8
74-
uses: actions/setup-java@v2
74+
uses: actions/setup-java@v4
7575
with:
7676
distribution: zulu
7777
java-version: 8
7878

7979
- name: Restore local Maven repository from cache
80-
uses: actions/cache@v2
80+
uses: actions/cache@v4
8181
with:
8282
path: ~/.m2/repository
8383
key: ${{ runner.os }}-maven-${{ hashFiles( 'project.clj' ) }}

.github/workflows/ci_pr.yml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: "CI - Pull Requests"
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
push:
8+
branches-ignore:
9+
- master
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 5
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Set up JDK 8
20+
uses: actions/setup-java@v4
21+
with:
22+
distribution: zulu
23+
java-version: 8
24+
25+
- name: Restore local Maven repository from cache
26+
uses: actions/cache@v4
27+
with:
28+
path: ~/.m2/repository
29+
key: ${{ runner.os }}-maven-${{ hashFiles( 'project.clj' ) }}
30+
restore-keys: |
31+
${{ runner.os }}-maven-
32+
33+
- name: Setup linter
34+
uses: DeLaGuardo/setup-clj-kondo@master
35+
with:
36+
version: '2025.07.28'
37+
38+
- name: Lint
39+
run: clj-kondo --lint src test
40+
41+
test:
42+
needs: build
43+
runs-on: ubuntu-latest
44+
timeout-minutes: 5
45+
steps:
46+
- name: Checkout
47+
uses: actions/checkout@v4
48+
49+
- name: Set up JDK 8
50+
uses: actions/setup-java@v4
51+
with:
52+
distribution: zulu
53+
java-version: 8
54+
55+
- name: Restore local Maven repository from cache
56+
uses: actions/cache@v4
57+
with:
58+
path: ~/.m2/repository
59+
key: ${{ runner.os }}-maven-${{ hashFiles( 'project.clj' ) }}
60+
restore-keys: |
61+
${{ runner.os }}-maven-
62+
63+
- name: Unit tests
64+
env:
65+
IP_STACK_ACCESS_KEY: ${{ secrets.IP_STACK_ACCESS_KEY }}
66+
run: lein test
67+
68+
deploy-snapshot:
69+
needs: test
70+
runs-on: ubuntu-latest
71+
timeout-minutes: 5
72+
# Only deploy snapshots for pushes to non-master branches (not PRs)
73+
if: github.event_name == 'push' && github.ref != 'refs/heads/master'
74+
steps:
75+
- name: Checkout
76+
uses: actions/checkout@v4
77+
78+
- name: Set up JDK 8
79+
uses: actions/setup-java@v4
80+
with:
81+
distribution: zulu
82+
java-version: 8
83+
84+
- name: Restore local Maven repository from cache
85+
uses: actions/cache@v4
86+
with:
87+
path: ~/.m2/repository
88+
key: ${{ runner.os }}-maven-${{ hashFiles( 'project.clj' ) }}
89+
restore-keys: |
90+
${{ runner.os }}-maven-
91+
92+
- name: Deploy SNAPSHOT version
93+
env:
94+
SNAPSHOT_REGEX: ^[0-9]{1,2}[.][0-9]{1,2}[.][0-9]{1,3}-SNAPSHOT$
95+
CLOJARS_USERNAME: ${{ secrets.CLOJARS_USERNAME }}
96+
CLOJARS_PASSWORD: ${{ secrets.CLOJARS_PASSWORD }}
97+
run: |
98+
git config --global user.name "github-actions-bot"
99+
git config --global user.email "<>"
100+
lein pom
101+
export VERSION=$(grep "<version>" pom.xml | head -1 | cut -d ">" -f2 | cut -d "<" -f1)
102+
echo "version is:" $VERSION
103+
if [[ !("$VERSION" =~ $SNAPSHOT_REGEX) ]]
104+
then
105+
echo "Version isn't a SNAPSHOT version:" $VERSION ", skipping deployment to Clojars..."
106+
exit 0
107+
fi
108+
lein deploy
109+
echo "SNAPSHOT version:" $VERSION"; commit: "${{github.sha}}"; branch: "${{github.ref_name}}"; successfully deployed to Clojars"

0 commit comments

Comments
 (0)