-
Notifications
You must be signed in to change notification settings - Fork 3
108 lines (106 loc) · 3.25 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
name: CI
on:
push:
branches:
- '*'
tags:
- 'v*'
pull_request:
branches:
- main
jobs:
test:
runs-on: blacksmith-2vcpu-ubuntu-2204
env:
ENABLE_ASSERTIONS: 1
steps:
- uses: actions/checkout@v4
- name: Coursier cache
uses: useblacksmith/coursier-cache-action@v6
- uses: coursier/setup-action@v1
with:
jvm: zulu:11.0.10
apps: sbt scala
- name: dynver check
run: sbt dynverAssertVersion
- name: Scalafmt
run: sbt scalafmtCheck test:scalafmtCheck
- name: Test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: sbt coverage test coverageReport
- name: Upload coverage
uses: codecov/codecov-action@v4
if: ${{ github.actor != 'dependabot[bot]' }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
- name: Clean up
run: |
rm -rf "$HOME/.ivy2/local" || true
find $HOME/Library/Caches/Coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true
find $HOME/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.sbt -name "*.lock" -delete || true
test-schemas:
runs-on: blacksmith-2vcpu-ubuntu-2204
env:
ENABLE_ASSERTIONS: 1
steps:
- uses: actions/checkout@v4
- name: Coursier cache
uses: useblacksmith/coursier-cache-action@v6
- uses: coursier/setup-action@v1
with:
jvm: zulu:11.0.10
apps: sbt scala
- uses: actions/setup-node@v4
with:
node-version: '16'
cache: 'yarn'
- name: Generate example schemas
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: sbt generateSchemas
- name: Install ajv
run: |
yarn global add ajv-cli ajv-formats
yarn global bin >> $GITHUB_PATH
- name: Validate generated schema
run: |
for schema in target/jsonoid-schemas/*.json; do
ajv compile --spec=draft2020 -s $schema -c ajv-formats
done
assemble:
needs: [test, test-schemas]
runs-on: blacksmith-2vcpu-ubuntu-2204
permissions:
id-token: write
attestations: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Coursier cache
uses: useblacksmith/coursier-cache-action@v6
- uses: taiki-e/install-action@parse-changelog
- name: Set build timestamp
run: echo "SOURCE_DATE_EPOCH=$(date -d $(parse-changelog CHANGELOG.md -t | rev | cut -d' ' -f1 | rev) '+%s')" >> "$GITHUB_ENV"
- uses: coursier/setup-action@v1
with:
jvm: zulu:11.0.10
apps: sbt scala
- name: Assemble
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: sbt assembly
- name: Upload JAR
uses: actions/upload-artifact@v4
with:
name: jsonoid-discovery.jar
if-no-files-found: error
path: target/scala-2.13/jsonoid-discovery*.jar
- name: Attest build provenance
uses: actions/attest-build-provenance@v1
if: ${{ github.event_name != 'pull_request' }}
with:
subject-path: 'target/scala-2.13/jsonoid-discovery*.jar'