-
Notifications
You must be signed in to change notification settings - Fork 13
145 lines (130 loc) · 4.9 KB
/
Copy pathbuild.yml
File metadata and controls
145 lines (130 loc) · 4.9 KB
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
name: Build
on:
push:
tags: [ 'v*' ]
branches: [ 'main' ]
pull_request:
branches: [ 'main' ]
jobs:
build:
name: Compile + test
timeout-minutes: 15
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci skip')"
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- uses: bleep-build/bleep-setup-action@v0.0.3
- uses: coursier/cache-action@v7
with:
extraFiles: bleep.yaml
- name: Compile
run: bleep compile
- name: Run tests
run: bleep test jatatui-tests
build-native:
name: Build JNI library on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-24.04
jni-folder: .bleep/generated-resources/crossterm/tui.scripts.GenJniLibrary
- os: ubuntu-22.04-arm
jni-folder: .bleep/generated-resources/crossterm/tui.scripts.GenJniLibrary
- os: macos-15-intel
jni-folder: .bleep/generated-resources/crossterm/tui.scripts.GenJniLibrary
- os: macos-latest
jni-folder: .bleep/generated-resources/crossterm/tui.scripts.GenJniLibrary
- os: windows-latest
jni-folder: .bleep\generated-resources\crossterm\tui.scripts.GenJniLibrary
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- uses: bleep-build/bleep-setup-action@v0.0.3
- uses: coursier/cache-action@v7
with:
extraFiles: bleep.yaml
- name: Cache cargo
uses: actions/cache@v5
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: jatatui-v1-${{ runner.arch }}-${{ runner.os }}-cargo-${{ hashFiles('crossterm/cargo/**/Cargo.lock', 'crossterm/cargo/**/*.rs') }}
restore-keys: jatatui-v1-${{ runner.arch }}-${{ runner.os }}-cargo-
# Sourcegen on the crossterm project triggers cargo to build the native lib and copy it to
# generated-resources. Running the JNI smoke test verifies the lib loads correctly.
- name: Build native lib + smoke-test JNI
if: runner.os != 'Windows'
run: bleep test jatatui-tests --only jatatui.tests.crossterm.CrosstermBackendTest
- name: Build native lib + smoke-test JNI (windows)
if: runner.os == 'Windows'
shell: cmd
run: bleep test jatatui-tests --only jatatui.tests.crossterm.CrosstermBackendTest
- name: Upload native lib artifact
uses: actions/upload-artifact@v4
with:
name: jatatui-jni-${{ matrix.os }}
path: ${{ matrix.jni-folder }}
retention-days: 1
publish:
name: Publish to Sonatype
timeout-minutes: 20
runs-on: ubuntu-latest
needs: [ build, build-native ]
if: "startsWith(github.ref, 'refs/tags/v')"
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- uses: bleep-build/bleep-setup-action@v0.0.3
- uses: coursier/cache-action@v7
with:
extraFiles: bleep.yaml
# Tag form: vX.Y.Z → version X.Y.Z
- name: Resolve version from tag
id: ver
run: |
TAG="${GITHUB_REF#refs/tags/}"
VERSION="${TAG#v}"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "Resolved version: $VERSION"
- name: Download all native artifacts
uses: actions/download-artifact@v4
with:
path: .bleep/generated-resources/crossterm/tui.scripts.GenJniLibrary
pattern: jatatui-jni-*
merge-multiple: true
- name: List downloaded native libs
run: find .bleep/generated-resources/crossterm
# Force bleep to load + record the build before publish, then bump file timestamps so the
# downloaded native libs are considered current (otherwise the sourcegen tracker reruns
# cargo, which we don't have toolchains for here).
- name: Prime build
run: bleep projects
- name: Touch downloaded artifacts
run: find .bleep/generated-resources/crossterm -type f -exec touch {} +
- name: Publish to Sonatype
run: bleep publish sonatype --version "${{ steps.ver.outputs.version }}" --assert-release
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
- name: GitHub Release
uses: softprops/action-gh-release@v2
with:
name: "jatatui ${{ steps.ver.outputs.version }}"
tag_name: ${{ steps.ver.outputs.tag }}
prerelease: false
generate_release_notes: true