-
Notifications
You must be signed in to change notification settings - Fork 49
147 lines (126 loc) · 3.83 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
name: CI
on:
pull_request:
branches: ["main", "series/*"]
push:
branches: ["main", "series/*"]
tags: ["v*"]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Test ${{matrix.scalaVersion}} (${{matrix.scalaPlatform}})
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
java: [8]
scalaVersion: ["2_12", "2_13", "3"]
scalaPlatform: ["jvm", "js", "native"]
runs-on: ${{ matrix.os }}
env:
BUILD_KEY: ${{matrix.scalaVersion}}_${{matrix.scalaPlatform}}
steps:
- name: Checkout current branch
uses: actions/checkout@v2
- name: Cache
uses: coursier/cache-action@v6
with:
extraKey: ${{ env.BUILD_KEY }}
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
cache: 'sbt'
- name: Run tests
run: |
sbt test_$BUILD_KEY \
pushRemoteCache_$BUILD_KEY
- name: Run checks
if: matrix.scalaVersion == '2_13' && matrix.scalaPlatform == 'jvm'
run: |
sbt scalafix_$BUILD_KEY \
scalafixTests_$BUILD_KEY \
scalafmt_$BUILD_KEY \
"docs/mdoc --in $PWD/README.md"
- name: Upload compilation cache
uses: actions/upload-artifact@v2
with:
name: compilation-${{env.BUILD_KEY}}.zip
path: /tmp/remote-cache
# This is dummy stage to configure github checks in a way
# that is agnostic to the build matrix
build-success-checkpoint:
runs-on: ubuntu-latest
needs: build
steps:
- name: Build matrix completed
run: echo "Build result is a ${{ needs.build.result }}"
documentation:
name: Documentation
runs-on: ubuntu-latest
steps:
- name: Checkout current branch
uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '8'
cache: 'sbt'
- name: Run mdoc
run: sbt "docs/mdoc"
publish:
name: Publish
needs: [documentation, build]
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || (github.ref == 'refs/heads/main'))
runs-on: ubuntu-latest
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '8'
cache: 'sbt'
- name: Download compilation cache
uses: actions/download-artifact@v2
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: |
sbt 'pullRemoteCache; ci-release'
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
site:
name: Publish Site
needs: [publish]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v3
with:
fetch-depth: 0
lfs: true
- uses: laughedelic/coursier-setup@v1
with:
jvm: adopt:8
apps: ammonite sbt
- name: Cache
uses: coursier/cache-action@v3
- name: Release site
run: |
mkdir -p $HOME/.ssh
ssh-keyscan -t rsa github.com >> $HOME/.ssh/known_hosts
sbt docs/docusaurusCreateSite
amm scripts/releaseSite.sc
env:
GITHUB_DEPLOY_KEY: ${{ secrets.GIT_DEPLOY_KEY }}