Skip to content

Commit 8717c6d

Browse files
oshadmihdoordt
andauthored
Upgrade GitHub Actions and add testing for cargo registry token (#422)
* Upgrade GitHub Actions and add testing for cargo registry token * Fix CI failure by installing clang * Fix CI failure of runtime combined with static - build bindgen dynamically * Fix CI failure of runtime combined with static - avoid no-default-features * Fix CI failures of runtime combined with static - remove runtime feature from default bindgen * Code review - comment to clarify static and runtime conflict Co-authored-by: Henk Oordt <hd@oordt.dev> * Code review - comment to clarify static and runtime conflicts Co-authored-by: Henk Oordt <hd@oordt.dev> --------- Co-authored-by: Henk Oordt <hd@oordt.dev>
1 parent 00de524 commit 8717c6d

File tree

4 files changed

+50
-19
lines changed

4 files changed

+50
-19
lines changed

.github/workflows/ci.yml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,24 @@ jobs:
6363
with:
6464
python-version: '3.10'
6565

66+
- name: Install Clang (for bindgen)
67+
run: |
68+
if [[ "${{ runner.os }}" == "Linux" ]]; then
69+
sudo apt-get update
70+
sudo apt-get install -y libclang-dev
71+
elif [[ "${{ runner.os }}" == "macOS" ]]; then
72+
# Install LLVM which provides libclang
73+
brew install llvm
74+
# Set environment variables for bindgen to find libclang
75+
echo "LIBCLANG_PATH=$(brew --prefix llvm)/lib" >> $GITHUB_ENV
76+
echo "LLVM_CONFIG_PATH=$(brew --prefix llvm)/bin/llvm-config" >> $GITHUB_ENV
77+
fi
78+
6679
- name: Install toolchain
6780
id: tc
68-
uses: actions-rs/toolchain@v1
81+
uses: dtolnay/rust-toolchain@master
6982
with:
7083
toolchain: ${{ matrix.toolchain }}
71-
profile: minimal
72-
override: true
7384
components: rustfmt, clippy
7485

7586
- name: Setup cache
@@ -80,22 +91,22 @@ jobs:
8091
~/.cargo/registry
8192
~/.cargo/git
8293
target
83-
key: ${{ runner.os }}-test-${{ steps.tc.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.toml') }}
94+
key: ${{ runner.os }}-test-${{ matrix.toolchain }}-${{ hashFiles('**/Cargo.toml') }}
8495

8596
- name: Format
8697
run: cargo fmt --all -- --check
8798

8899
- name: Clippy
89-
run: cargo clippy --all-targets --no-default-features --features "bindgen/runtime min-redis-compatibility-version-${{ matrix.redis-version[0] }}"
100+
run: cargo clippy --all-targets --no-default-features --features min-redis-compatibility-version-${{ matrix.redis-version[0] }},bindgen-runtime
90101

91102
- name: Build debug
92-
run: cargo build --no-default-features --features "bindgen/runtime min-redis-compatibility-version-${{ matrix.redis-version[0] }}"
103+
run: cargo build --no-default-features --features min-redis-compatibility-version-${{ matrix.redis-version[0] }},bindgen-runtime
93104

94105
- name: Build release
95-
run: cargo build --release --no-default-features --features "bindgen/runtime min-redis-compatibility-version-${{ matrix.redis-version[0] }}"
106+
run: cargo build --release --no-default-features --features min-redis-compatibility-version-${{ matrix.redis-version[0] }},bindgen-runtime
96107

97108
- name: Test
98-
run: cargo test --no-default-features --features "bindgen/runtime min-redis-compatibility-version-${{ matrix.redis-version[0] }}"
109+
run: cargo test --no-default-features --features min-redis-compatibility-version-${{ matrix.redis-version[0] }},bindgen-runtime
99110

100111
- name: Doc
101112
run: cargo doc --no-default-features --features "all-features-but-xor bindgen/runtime min-redis-compatibility-version-${{ matrix.redis-version[0] }}"

.github/workflows/cratesio-publish.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,15 @@ jobs:
88
runs-on: ubuntu-latest
99

1010
steps:
11-
- uses: actions/checkout@v2
12-
- uses: actions-rs/toolchain@v1
13-
with:
14-
toolchain: stable
15-
override: true
11+
- uses: actions/checkout@v4
12+
- uses: dtolnay/rust-toolchain@stable
1613

1714
- name: get version from tag
1815
id: get_version
1916
run: |
2017
realversion="${GITHUB_REF/refs\/tags\//}"
2118
realversion="${realversion//v/}"
22-
echo "::set-output name=VERSION::$realversion"
19+
echo "VERSION=$realversion" >> $GITHUB_OUTPUT
2320
2421
- name: Set the version for publishing
2522
uses: ciiiii/toml-editor@1.0.0
@@ -50,20 +47,20 @@ jobs:
5047
value: "${{ steps.get_version.outputs.VERSION }}"
5148

5249
- name: Publishing redismodule-rs-macros-internals
53-
uses: katyo/publish-crates@v1
50+
uses: katyo/publish-crates@v2
5451
with:
5552
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
5653
path: './redismodule-rs-macros-internals'
5754
args: --allow-dirty
5855

5956
- name: Publishing redismodule-rs
60-
uses: katyo/publish-crates@v1
57+
uses: katyo/publish-crates@v2
6158
with:
6259
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
6360
args: --allow-dirty
6461

6562
- name: Publishing redismodule-rs-macros
66-
uses: katyo/publish-crates@v1
63+
uses: katyo/publish-crates@v2
6764
with:
6865
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
6966
path: './redismodule-rs-macros'
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Test Registry Token
2+
3+
on:
4+
workflow_dispatch: # Manual trigger only
5+
6+
jobs:
7+
test-token:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
- uses: actions-rs/toolchain@v1
12+
with:
13+
toolchain: stable
14+
override: true
15+
16+
- name: Test registry token login
17+
run: |
18+
echo "Testing cargo login with registry token..."
19+
# Use environment variable to avoid any risk of token exposure
20+
echo "$CARGO_REGISTRY_TOKEN" | cargo login
21+
echo "✅ Registry token login successful"
22+
env:
23+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,9 @@ min-redis-compatibility-version-7-0 = ["redis-module/min-redis-compatibility-ver
156156
min-redis-compatibility-version-6-2 = ["redis-module/min-redis-compatibility-version-6-2"]
157157
min-redis-compatibility-version-6-0 = ["redis-module/min-redis-compatibility-version-6-0"]
158158

159-
# Enable static linking to libclang in bindgen
159+
# Enable static linking to libclang in bindgen (incompatible with `bindgen-runtime`)
160160
bindgen-static = ["bindgen/static"]
161-
# Enable dynamic linking to libclang in bindgen
161+
# Enable dynamic linking to libclang in bindgen (default, incompatible with `bindgen-static`)
162162
bindgen-runtime = ["bindgen/runtime"]
163163

164164
# List all features here, that are not in a exclusive or relationship

0 commit comments

Comments
 (0)