-
Notifications
You must be signed in to change notification settings - Fork 150
146 lines (130 loc) · 4.51 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: Continuous Integration
on:
pull_request:
branches: ['**', '!update/**', '!pr/**']
push:
branches: ['**', '!update/**', '!pr/**']
tags: [v*]
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_CREDENTIAL_HOST: ${{ secrets.SONATYPE_CREDENTIAL_HOST }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Generate matrix
id: set-matrix
run: |
echo -n "matrix=" >> $GITHUB_OUTPUT
./mill resolve "spark-excel[_,_]" | \
jq -Rsc 'split("\n") | map(capture("spark-excel\\[(?<scala>[^,]+),(?<spark>[^\\]]+)\\]") | select(.)) | {include: .}' >> $GITHUB_OUTPUT
build:
needs: prepare
name: Build and Test
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.prepare.outputs.matrix) }}
runs-on: ubuntu-latest
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download Java (temurin@11)
id: download-java-temurin-11
uses: typelevel/download-java@v2
with:
distribution: temurin
java-version: 11
- name: Setup Java (temurin@11)
uses: actions/setup-java@v4
with:
distribution: jdkfile
java-version: 11
jdkFile: ${{ steps.download-java-temurin-11.outputs.jdkFile }}
- name: Cache mill
uses: actions/cache@v4
with:
path: |
~/.mill
~/.ivy2/cache
~/.coursier/cache/v1
~/.cache/coursier/v1
~/AppData/Local/Coursier/Cache/v1
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-mill-cache-v2-${{ hashFiles('**/*.mill') }}-${{ hashFiles('project/build.properties') }}
- name: Test
run: ./mill spark-excel[${{ matrix.scala }},${{ matrix.spark }}].test
- name: Publish Test Report
uses: mikepenz/action-junit-report@v5
if: always() # always run even if the previous step fails
with:
fail_on_failure: false
include_passed: false
detailed_summary: true
annotate_only: true
require_tests: false
report_paths: 'out/**/test-report.xml'
publish:
name: Publish Artifacts
needs: [build]
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.12.20]
java: [temurin@11]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download Java (temurin@11)
id: download-java-temurin-11
if: matrix.java == 'temurin@11'
uses: typelevel/download-java@v2
with:
distribution: temurin
java-version: 11
- name: Setup Java (temurin@11)
if: matrix.java == 'temurin@11'
uses: actions/setup-java@v4
with:
distribution: jdkfile
java-version: 11
jdkFile: ${{ steps.download-java-temurin-11.outputs.jdkFile }}
- name: Cache mill
uses: actions/cache@v4
with:
path: |
~/.mill
~/.ivy2/cache
~/.coursier/cache/v1
~/.cache/coursier/v1
~/AppData/Local/Coursier/Cache/v1
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-mill-cache-v2-${{ hashFiles('**/*.mill') }}-${{ hashFiles('project/build.properties') }}
- name: Import GPG Key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.PGP_SECRET }}
passphrase: ${{ secrets.PGP_PASSPHRASE }}
trust_level: 5
- name: Publish
run: |
export GPG_TTY=$(tty)
./mill -i mill.contrib.sonatypecentral.SonatypeCentralPublishModule/publishAll \
--publishArtifacts __.publishArtifacts \
--username $SONATYPE_USERNAME \
--password $SONATYPE_PASSWORD \
--gpgArgs "--passphrase=$PGP_PASSPHRASE,--no-tty,--pinentry-mode,loopback,--batch,--yes,-a,-b" \
--bundleName dev.mauch-spark-excel-$(date +%Y-%m-%d-%H-%M)