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
name: Publish to crates.io
on:
push:
tags:
# Only on SemVer tags like "7.3.0".
# Push a new tag to make a new release.
# It should match the version in Cargo.toml
# (Perhaps we could add a check for this?)
- "[0-9]+.[0-9]+.[0-9]+"
jobs:
build:
runs-on: ubuntu-latest
services:
ldap:
image: openidentityplatform/opendj
ports:
- 1389:1389
options: >
--env ROOT_USER_DN="cn=manager"
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Get LDAP container ID
id: ldap_container_id
run: echo "LDAP_CONTAINER_ID=$(docker ps --filter 'ancestor=openidentityplatform/opendj:latest' -q)" >> $GITHUB_ENV
- name: Copy LDIF to LDAP container
run: docker cp ./data/data.ldif ${{ env.LDAP_CONTAINER_ID }}:/tmp/data.ldif
- name: Import LDIF into OpenDJ
run: |
docker exec ${{ job.services.ldap.id }} \
/opt/opendj/bin/ldapmodify -h localhost -p 1389 -D "cn=manager" -w password -a -f /tmp/data.ldif
# Step 3: Install Rust
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
# Step 4: Build the Rust project
- name: Build
run: cargo build --verbose
# Step 5: Run unit tests
- name: Install llvm-tools and cargo-llvm-cov
run: |
rustup component add llvm-tools-preview
cargo install cargo-llvm-cov
- name: Run coverage
run: |
cargo llvm-cov --lcov --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: lcov.info
flags: unittests
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
# Check that there are no SemVer violations before releasing.
# https://github.com/obi1kenobi/cargo-semver-checks
- name: Check semver
uses: obi1kenobi/cargo-semver-checks-action@v2
with:
feature-group: default-features
features: pool
# Another check with the mutually exclusive tls-rustls feature enabled.
- name: Check semver
uses: obi1kenobi/cargo-semver-checks-action@v2
with:
feature-group: only-explicit-features
features: tls-rustls,pool
- name: Deploy to crates.io
run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_TOKEN }}