-
Notifications
You must be signed in to change notification settings - Fork 71
180 lines (156 loc) · 5.12 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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
name: CI
on:
workflow_dispatch:
inputs:
publishSnapshot:
description: "Publish Snapshot"
required: false
default: false
type: boolean
publishMicrosite:
description: "Publish Microsite"
required: false
default: false
type: boolean
push:
branches: ["main", "series/**", "feature/**"]
tags: ["v*"]
pull_request:
branches: ["**"]
schedule:
# midnight, every Monday and Thursday
- cron: '0 0 * * 1,4'
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Test ${{matrix.scalaVersion}} (${{matrix.scalaPlatform}})
strategy:
fail-fast: true
matrix:
scalaVersion: ["2_12", "2_13", "3_0"]
scalaPlatform: ["jvm", "js"]
exclude:
# Do not build 2.12 artifacts for Scalajs
- scalaVersion: "2_12"
scalaPlatform: "js"
include:
- scalaVersion: "3_0"
scalaPlatform: "native"
runs-on: ubuntu-latest
env:
BUILD_KEY: ${{matrix.scalaVersion}}_${{matrix.scalaPlatform}}
steps:
- name: Checkout current branch
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache
uses: coursier/cache-action@v6
with:
extraKey: ${{ env.BUILD_KEY }}
- name: Setup Java and Scala
uses: coursier/setup-action@v1
with:
jvm: temurin:1.17
- name: Run tests
run: |
sbt test_$BUILD_KEY \
pushRemoteCache_$BUILD_KEY \
-J-Xmx4G
- name: Run plugin tests
if: matrix.scalaVersion == '2_12' && matrix.scalaPlatform == 'jvm'
run: |
sbt scripted
- name: Run checks
if: matrix.scalaVersion == '2_13' && matrix.scalaPlatform == 'jvm'
run: |
sbt scalafmtCheckAll \
headerCheck \
"docs/mdoc"
(cd ./modules/website && yarn && yarn swizzle docusaurus-lunr-search SearchBar --danger --wrap && yarn build)
- name: Check for untracked changes
run: |
git status
./scripts/check-dirty.sh
echo "Built $(cat version)"
- name: Check for Binary Compatibility
if: matrix.scalaPlatform == 'jvm'
run: sbt mimaReportBinaryIssuesIfRelevant_$BUILD_KEY
- name: Upload compilation cache
uses: actions/upload-artifact@v4
with:
name: compilation-${{env.BUILD_KEY}}.zip
path: /tmp/remote-cache
build-success-checkpoint:
runs-on: ubuntu-latest
needs: build
steps:
- name: Build matrix completed
run: echo "Build result is a ${{ needs.build.result }}"
release:
name: Release
needs: build
if:
startsWith(github.ref, 'refs/tags/v') ||
github.event.inputs.publishSnapshot == 'true' ||
github.event_name == 'schedule'
runs-on: ubuntu-latest
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Java and Scala
uses: coursier/setup-action@v1
with:
jvm: temurin:1.17
- name: Cache
uses: coursier/cache-action@v6
- name: Download compilation cache
uses: actions/download-artifact@v4
with:
path: /tmp/remote-cache
- name: Unpack compilation cache
run: cd /tmp/remote-cache && (ls | xargs -I {} sh -c 'cp -r {}/* .')
- name: Publish ${{ github.ref }}
run: |
echo $PGP_SECRET | base64 --decode | gpg --import --no-tty --batch --yes
sbt 'pullRemoteCache; release' -J-Xmx2G
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
microsite:
name: Publish Docs Microsite
if:
startsWith(github.ref, 'refs/tags/v') ||
github.event.inputs.publishMicrosite == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Java and Scala
uses: coursier/setup-action@v1
with:
jvm: temurin:1.17
- name: Cache
uses: coursier/cache-action@v6
- name: Resolve latest smithy4s-core version
# export the version only when we trigger publish manually
if: ${{ github.event_name == 'workflow_dispatch' }}
run: echo "SMITHY4S_VERSION=$(cs resolve com.disneystreaming.smithy4s:smithy4s-core_2.13:latest.stable | head -1 | awk -F':' '{print $3}')" >> $GITHUB_ENV
- name: Compile Documentation Markdown Files
run: sbt "docs/mdoc"
- name: Build Microsite
run: cd ./modules/website && yarn && yarn swizzle docusaurus-lunr-search SearchBar --danger --wrap && yarn build
- name: Publish Microsite
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./modules/website/build
publish_branch: gh-pages