-
Notifications
You must be signed in to change notification settings - Fork 3
79 lines (64 loc) · 1.88 KB
/
Copy pathbuild.yml
File metadata and controls
79 lines (64 loc) · 1.88 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
name: Build
on:
push:
branches:
- master
paths:
- "**/*.rs"
- "**/*.toml"
- "**/*.java"
pull_request:
paths:
- "**/*.rs"
- "**/*.toml"
- "**/*.java"
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "21"
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}
restore-keys: |
cargo-${{ runner.os }}-
- name: Build workspace
run: cargo build --workspace --locked
- name: Test workspace
run: cargo test --workspace --locked
- name: Verify compiler example
shell: bash
run: |
mkdir -p target/ci-input target/compiler-example
printf 'public class DemoApp {}\n' > target/ci-input/DemoApp.java
cargo run --locked --example compiler-example -- \
--output-dir target/compiler-example \
target/ci-input/DemoApp.java
javap -v -c target/compiler-example/DemoApp.class
cat > target/compiler-example/LoadDemoApp.java <<'JAVA'
public class LoadDemoApp {
public static void main(String[] args) throws Exception {
Class.forName("DemoApp");
}
}
JAVA
javac -cp target/compiler-example \
-d target/compiler-example \
target/compiler-example/LoadDemoApp.java
java -Xverify:all -cp target/compiler-example LoadDemoApp