-
Notifications
You must be signed in to change notification settings - Fork 1
135 lines (115 loc) · 3.71 KB
/
test.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
name: Tests
on:
workflow_dispatch:
workflow_call:
push:
branches: [ main ]
pull_request:
jobs:
clippy:
name: 📎 fmt and clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup update
- run: rustup component add clippy rustfmt
- run: cargo fmt -- --check
- run: cargo clippy --all --all-targets --all-features
test:
name: 🧪 Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- run: |
rustup update
cargo install cargo-tarpaulin
- run: cargo build --all-features
- run: cargo test
env:
RUST_BACKTRACE: 1
cov:
name: ☂️ Coverage
runs-on: ubuntu-latest
container:
image: xd009642/tarpaulin:develop-nightly
options: --security-opt seccomp=unconfined
steps:
- uses: actions/checkout@v4
- name: Generate code coverage
run: |
cargo tarpaulin -p nanopub --out xml --exclude-files lib/src/error.rs --verbose --timeout 120
- name: Upload to codecov.io
uses: codecov/codecov-action@v2
with:
fail_ci_if_error: true
token: ${{secrets.CODECOV_TOKEN}}
docs:
name: 📖 Update docs
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v4
- run: bash ./scripts/docs-install.sh
# - name: Setup mdBook
# uses: peaceiris/actions-mdbook@v1
# with:
# mdbook-version: 'latest'
- run: bash ./scripts/docs-build.sh
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: './target/doc'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
compare:
name: ⏱️ Compare speed with java and python implementations
runs-on: ubuntu-latest
env:
HYPERFINE_VERSION: '1.12.0'
STABLE_PYTHON_VERSION: '3.12'
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ env.STABLE_PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.STABLE_PYTHON_VERSION }}
- uses: actions/setup-java@v3
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '21'
- name: Install hyperfine
run: |
wget https://github.com/sharkdp/hyperfine/releases/download/v${HYPERFINE_VERSION}/hyperfine_${HYPERFINE_VERSION}_amd64.deb
sudo dpkg -i hyperfine_${HYPERFINE_VERSION}_amd64.deb
- name: Install java and python tools
run: |
pip install --upgrade nanopub
wget -O nanopub.jar https://github.com/Nanopublication/nanopub-java/releases/download/nanopub-1.55/nanopub-1.55-jar-with-dependencies.jar
- name: Build ourself
run: cargo build --release
- name: Benchmark
run: |
hyperfine -m 100 --warmup 10 --export-markdown benchmark.md \
'java -jar nanopub.jar sign lib/tests/resources/simple1-rsa.trig -k lib/tests/resources/id_rsa' \
'np sign lib/tests/resources/simple1-rsa.trig -k lib/tests/resources/id_rsa' \
'target/release/nanopub-cli sign lib/tests/resources/simple1-rsa.trig -k lib/tests/resources/id_rsa'
- name: Upload benchmark markdown
uses: actions/upload-artifact@v4
with:
name: benchmark.md
path: ./benchmark.md