Skip to content

Commit 1df3fd0

Browse files
Revert "Revert "refactor: simplify rust workflow and update README""
This reverts commit 1050416.
1 parent 1050416 commit 1df3fd0

File tree

2 files changed

+3
-67
lines changed

2 files changed

+3
-67
lines changed

.github/workflows/rust-build.yml

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ on:
77
description: 'The directory to run jobs from'
88
default: '.'
99
type: string
10-
run-audit:
11-
description: 'Run cargo-audit for security vulnerabilities'
12-
default: true
13-
type: boolean
1410
enable-cache:
1511
description: 'Enable caching of dependencies'
1612
default: true
@@ -19,18 +15,6 @@ on:
1915
description: 'Publish package to crates.io'
2016
default: false
2117
type: boolean
22-
upload-artifact:
23-
description: 'Upload build artifact'
24-
default: false
25-
type: boolean
26-
artifact-name:
27-
description: 'Name of the artifact to upload'
28-
type: string
29-
required: false
30-
artifact-path:
31-
description: 'Path to the artifact to upload'
32-
type: string
33-
required: false
3418
secrets:
3519
CARGO_REGISTRY_TOKEN:
3620
required: false
@@ -69,15 +53,6 @@ jobs:
6953
- name: Run linter (Clippy)
7054
working-directory: ${{ inputs.working-directory }}
7155
run: cargo clippy --all-targets -- -D warnings
72-
73-
- name: Install cargo-audit
74-
if: ${{ inputs.run-audit }}
75-
run: cargo install cargo-audit
76-
77-
- name: Run security audit
78-
if: ${{ inputs.run-audit }}
79-
working-directory: ${{ inputs.working-directory }}
80-
run: cargo audit
8156

8257
- name: Build
8358
working-directory: ${{ inputs.working-directory }}
@@ -87,13 +62,6 @@ jobs:
8762
working-directory: ${{ inputs.working-directory }}
8863
run: cargo test --release
8964

90-
- name: Upload artifact
91-
if: ${{ inputs.upload-artifact }}
92-
uses: actions/upload-artifact@v4
93-
with:
94-
name: ${{ inputs.artifact-name }}
95-
path: ${{ inputs.artifact-path }}
96-
9765
- name: Validate package
9866
if: ${{ inputs.publish-crates-io }}
9967
working-directory: ${{ inputs.working-directory }}

rust-build/README.md

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
# Rust Build Workflow
22

3-
A reusable GitHub Actions workflow for building, linting, testing, and auditing Rust packages, with optional artifact upload and crates.io publishing.
3+
A reusable GitHub Actions workflow for building, linting, testing, and publishing Rust packages, with optional dependency caching and working directory support.
44

55
## Features
66

77
- Build and test Rust packages
88
- Lint code using `clippy`
99
- Check formatting with `cargo fmt`
10-
- Run security audits with `cargo audit`
1110
- Cache dependencies for faster builds
12-
- Set a working directory for monorepos
13-
- Upload build artifacts
11+
- Set a working directory (for monorepos or nested crates)
1412
- Publish to crates.io
15-
- All operations are performed in a single job (no redundant toolchain installs)
1613

1714
## Usage
1815

@@ -26,11 +23,8 @@ jobs:
2623
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/rust-build.yml@main
2724
with:
2825
working-directory: './my-crate'
29-
run-audit: true
3026
enable-cache: true
31-
upload-artifact: true
32-
artifact-name: my-crate
33-
artifact-path: target/release/my-crate
27+
publish-crates-io: false
3428
secrets:
3529
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
3630
```
@@ -40,11 +34,7 @@ jobs:
4034
| Name | Description | Default | Required |
4135
| ------------------- | --------------------------------------------------------- | -------- | -------- |
4236
| `working-directory` | The directory to run jobs from | `.` | No |
43-
| `run-audit` | Run `cargo audit` for security vulnerabilities | `true` | No |
4437
| `enable-cache` | Enable caching of dependencies | `true` | No |
45-
| `upload-artifact` | Upload a build artifact after building | `false` | No |
46-
| `artifact-name` | Name of the artifact to upload | – | No |
47-
| `artifact-path` | Path to the artifact to upload | – | No |
4838
| `publish-crates-io` | Publish the package to crates.io (only if build succeeds) | `false` | No |
4939

5040
Note: All builds use the release profile by default. There is no build-target input anymore
@@ -75,28 +65,6 @@ jobs:
7565
working-directory: './my-crate'
7666
```
7767

78-
### Disable Security Audit
79-
80-
```yaml
81-
jobs:
82-
build-and-test:
83-
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/rust-build.yml@main
84-
with:
85-
run-audit: false
86-
```
87-
88-
### Upload Artifact After Build
89-
90-
```yaml
91-
jobs:
92-
build-and-upload:
93-
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/rust-build.yml@main
94-
with:
95-
upload-artifact: true
96-
artifact-name: my-crate
97-
artifact-path: target/release/my-crate
98-
```
99-
10068
### Publish to crates.io (requires CARGO_REGISTRY_TOKEN)
10169

10270
```yaml

0 commit comments

Comments
 (0)