Skip to content

Commit 9198f62

Browse files
authored
ci: publish flow maintenance (#227)
Bring in line with other clj-commons projects by triggering build on git release tag (instead of GitHub UI). Borrow work from clj-commons/pomegranate, where I most recently did this work. This includes: - consolidation of shared setup to composite actions. - using neil to store/bump lib version - automatically including date in changelog release headers (manually back-filled existing) - changelog now using [breaking] and [minor breaking] attributes for release headers - adding a link to changelog from GitHub release Tweaks from pomegranate included: - github-coords is different from release artifact name - our default branch here is main, not master - changelog release headers are level 3 here (as opposed to level 2) Also: - turfed whitespace linting, do not want to maintain/review I'm pretty sure there will be typos and config errors to correct. There are some GitHub Actions YAMLisms I am not entirely sure will work. Tip to lurkers: The VSCode Red Hat YAML extension offers some pretty nice linting and has special validations for GitHub actions YAML. Close #222
1 parent 621fd5d commit 9198f62

25 files changed

+917
-1023
lines changed

.github/workflows/code-coverage.yml

Lines changed: 21 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -10,53 +10,24 @@ jobs:
1010
runs-on: ubuntu-latest
1111

1212
steps:
13-
- uses: actions/checkout@v3
14-
15-
- name: Clojure deps cache
16-
uses: actions/cache@v3
17-
with:
18-
path: |
19-
~/.m2/repository
20-
~/.gitlibs
21-
key: ${{ runner.os }}-cljdeps-${{ hashFiles('deps.edn') }}
22-
restore-keys: ${{ runner.os }}-cljdeps-
23-
24-
- name: Setup Java
25-
uses: actions/setup-java@v3
26-
with:
27-
distribution: 'temurin'
28-
java-version: '11'
29-
30-
- name: Install Clojure tools
31-
uses: DeLaGuardo/[email protected]
32-
with:
33-
cli: 'latest'
34-
bb: 'latest'
35-
36-
- name: Tools versions
37-
run: |
38-
echo "bb --version"
39-
bb --version
40-
echo "java -version"
41-
java -version
42-
echo "clojure -Sdescribe"
43-
clojure -Sdescribe
44-
45-
- name: Download clojure dependencies
46-
run: clojure -Spath
47-
48-
- name: Run Tests with Code Coverage
49-
run: bb test-coverage
50-
51-
- name: Upload Code Coverage Results
52-
run: |
53-
echo "Downloading codecov uploader script"
54-
curl -s https://codecov.io/bash > codecov
55-
echo "Verifying codedov uploader script"
56-
VERSION=$(grep 'VERSION=\".*\"' codecov | cut -d'"' -f2);
57-
for i in 1 256 512
58-
do
59-
sha${i}sum -c --ignore-missing <(curl -s "https://raw.githubusercontent.com/codecov/codecov-bash/${VERSION}/SHA${i}SUM")
60-
done
61-
echo "Uploading to codecov"
62-
bash codecov -f target/coverage/codecov.json
13+
- name: Checkout
14+
uses: actions/checkout@v3
15+
16+
- name: Setup
17+
uses: ./.github/workflows/shared-setup
18+
19+
- name: Run Tests with Code Coverage
20+
run: bb test-coverage
21+
22+
- name: Upload Code Coverage Results
23+
run: |
24+
echo "Downloading codecov uploader script"
25+
curl -s https://codecov.io/bash > codecov
26+
echo "Verifying codedov uploader script"
27+
VERSION=$(grep 'VERSION=\".*\"' codecov | cut -d'"' -f2);
28+
for i in 1 256 512
29+
do
30+
sha${i}sum -c --ignore-missing <(curl -s "https://raw.githubusercontent.com/codecov/codecov-bash/${VERSION}/SHA${i}SUM")
31+
done
32+
echo "Uploading to codecov"
33+
bash codecov -f target/coverage/codecov.json

.github/workflows/libs-test.yml

Lines changed: 24 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,16 @@ jobs:
1616
libs: ${{ steps.set-libs.outputs.libs }}
1717

1818
steps:
19-
- uses: actions/checkout@v3
19+
- name: Checkout
20+
uses: actions/checkout@v3
2021

21-
- name: Clojure deps cache
22-
uses: actions/cache@v3
23-
with:
24-
path: |
25-
~/.m2/repository
26-
~/.gitlibs
27-
# base cache on libs_test.clj script for now... lib deps are embedded in it
28-
key: ${{ runner.os }}-clj-libs-deps-${{ hashFiles('script/test_libs.clj') }}
29-
restore-keys: ${{ runner.os }}-clj-libs-deps-
22+
- name: Setup
23+
uses: ./.github/workflows/shared-setup
3024

31-
- name: Install Clojure tools
32-
uses: DeLaGuardo/[email protected]
33-
with:
34-
cli: 'latest'
35-
bb: 'latest'
36-
37-
- id: set-libs
38-
name: Set libs var for matrix
39-
## call bb script directly instead of as task to avoid task status output
40-
run: echo "libs=$(bb script/test_libs.clj list --format=json)" >> $GITHUB_OUTPUT
25+
- id: set-libs
26+
name: Set libs var for matrix
27+
## call bb script directly instead of as task to avoid task status output
28+
run: echo "libs=$(bb script/test_libs.clj list --format=json)" >> $GITHUB_OUTPUT
4129

4230
libs-test:
4331
needs: enumerate-libs
@@ -48,56 +36,19 @@ jobs:
4836
lib: ${{ fromJSON(needs.enumerate-libs.outputs.libs) }}
4937

5038
steps:
51-
- uses: actions/checkout@v3
52-
with:
53-
fetch-depth: 0
54-
55-
- name: Clojure deps cache
56-
uses: actions/cache@v3
57-
with:
58-
path: |
59-
~/.m2/repository
60-
~/.gitlibs
61-
# base cache on libs_test.clj script for now... lib deps are embedded in it
62-
key: ${{ runner.os }}-clj-libs-deps-${{ hashFiles('script/test_libs.clj') }}
63-
restore-keys: ${{ runner.os }}-clj-libs-deps-
64-
65-
- name: Setup Java
66-
uses: actions/setup-java@v3
67-
with:
68-
distribution: 'temurin'
69-
java-version: '11'
70-
71-
- name: Install planck
72-
run: |
73-
# There are not planck binaries for jammy yet, so hack-around to use focal release
74-
sudo add-apt-repository -y "deb http://cz.archive.ubuntu.com/ubuntu focal main universe"
75-
sudo add-apt-repository -y "deb http://security.ubuntu.com/ubuntu focal-security main"
76-
77-
# is missing after installing planck so compensate
78-
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y libicu66
79-
80-
wget https://launchpad.net/~mfikes/+archive/ubuntu/planck/+files/planck_2.25.0-1ppa1~focal1_amd64.deb
81-
sudo apt-get install ./planck_2.25.0-1ppa1~focal1_amd64.deb
82-
83-
- name: Install Clojure tools
84-
uses: DeLaGuardo/[email protected]
85-
with:
86-
cli: 'latest'
87-
bb: 'latest'
88-
89-
- name: Tools versions
90-
run: |
91-
echo "bb --version"
92-
bb --version
93-
echo "java -version"
94-
java -version
95-
echo "clojure -Sdescribe"
96-
clojure -Sdescribe
97-
echo "lein --version"
98-
lein --version
99-
echo "planck --version"
100-
planck --version
101-
102-
- name: Run Libs Tests
103-
run: bb test-libs run ${{ matrix.lib }}
39+
- name: Checkout
40+
uses: actions/checkout@v3
41+
with:
42+
fetch-depth: 0
43+
44+
- name: Setup
45+
uses: ./.github/workflows/shared-setup
46+
with:
47+
clj-cache-prefix: clj-libs-deps-${{ matrix.lib }}
48+
clj-cache-hash-files: "'script/test_libs.clj','deps.edn','bb.edn'"
49+
50+
- name: Install planck
51+
uses: ./.github/workflows/setup-planck
52+
53+
- name: Run Libs Tests
54+
run: bb test-libs run ${{ matrix.lib }}

.github/workflows/native-image-test.yml

Lines changed: 21 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -22,76 +22,24 @@ jobs:
2222
name: ${{ matrix.os }},jdk ${{ matrix.graal-java }},${{ matrix.test }},clj ${{ matrix.clojure-version }}
2323

2424
steps:
25-
- uses: actions/checkout@v3
26-
27-
#
28-
# Caches
29-
#
30-
- name: Clojure deps cache
31-
uses: actions/cache@v3
32-
with:
33-
path: |
34-
~/.m2/repository
35-
~/.gitlibs
36-
key: ${{ runner.os }}-cljdeps-${{ hashFiles('deps.edn') }}
37-
restore-keys: ${{ runner.os }}-cljdeps-
38-
39-
#
40-
# Install GraalVM
41-
#
42-
- name: Install GraalVM
43-
uses: graalvm/setup-graalvm@v1
44-
with:
45-
version: '22.3.1'
46-
java-version: ${{ matrix.graal-java }}
47-
components: 'native-image'
48-
github-token: ${{ secrets.GITHUB_TOKEN }}
49-
50-
#
51-
# Install Babashka
52-
#
53-
- name: Install Babashka
54-
uses: DeLaGuardo/[email protected]
55-
with:
56-
bb: 'latest'
57-
58-
#
59-
# Install Clojure
60-
#
61-
- name: Install clojure (windows)
62-
# On windows, deps.clj's deps.exe is used in place of clojure to avoid complexities of official clojure install
63-
run: |
64-
PowerShell -Command "iwr -useb https://raw.githubusercontent.com/borkdude/deps.clj/master/install.ps1 | iex"
65-
Rename-Item $HOME\deps.clj\deps.exe clojure.exe
66-
echo "$HOME\deps.clj" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
67-
if: matrix.os == 'windows'
68-
69-
- name: Install Clojure (macos, linux)
70-
uses: DeLaGuardo/[email protected]
71-
with:
72-
cli: 'latest'
73-
if: matrix.os != 'windows'
74-
75-
#
76-
# Summarize installs
77-
#
78-
- name: Tools versions
79-
run: |
80-
echo "bb --version"
81-
bb --version
82-
echo "java -version"
83-
java -version
84-
echo "clojure -Sdescribe"
85-
clojure -Sdescribe
86-
87-
#
88-
# Prep Clojure
89-
#
90-
- name: Download clojure dependencies
91-
run: clojure -Spath
92-
93-
#
94-
# native image tests
95-
#
96-
- name: Execute ${{ matrix.test }} native test
97-
run: bb ${{ matrix.test }} --clojure-version ${{ matrix.clojure-version }}
25+
- name: Checkout
26+
uses: actions/checkout@v3
27+
28+
- name: Setup
29+
uses: ./.github/workflows/shared-setup
30+
with:
31+
jdk: skip
32+
33+
- name: Install GraalVM
34+
uses: graalvm/setup-graalvm@v1
35+
with:
36+
version: '22.3.1'
37+
java-version: ${{ matrix.graal-java }}
38+
components: 'native-image'
39+
github-token: ${{ secrets.GITHUB_TOKEN }}
40+
41+
#
42+
# native image tests
43+
#
44+
- name: Execute ${{ matrix.test }}
45+
run: bb ${{ matrix.test }} --clojure-version ${{ matrix.clojure-version }}

.github/workflows/publish.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Publish
2+
on:
3+
push:
4+
tags:
5+
- 'v\d+.*'
6+
7+
jobs:
8+
unit-test:
9+
uses: ./.github/workflows/unit-test.yml
10+
native-image-test:
11+
uses: ./.github/workflows/native-image-test.yml
12+
libs-test:
13+
uses: ./.github/workflows/libs-test.yml
14+
15+
publish:
16+
environment: publish
17+
runs-on: ubuntu-latest
18+
needs: [unit-test, native-image-test, libs-test]
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v3
23+
24+
- name: Setup
25+
uses: ./.github/workflows/shared-setup
26+
27+
- name: Deploy to clojars
28+
env:
29+
CLOJARS_USERNAME: ${{ secrets.CLOJARS_USERNAME }}
30+
CLOJARS_PASSWORD: ${{ secrets.CLOJARS_PASSWORD }}
31+
run: bb -ci-clojars-deploy
32+
33+
- name: Create GitHub Release
34+
env:
35+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
run: bb -ci-github-create-release
37+
38+
- name: Inform Cljdoc
39+
run: bb -ci-cljdoc-request-build

0 commit comments

Comments
 (0)