Skip to content

Commit

Permalink
build: introduce a new feature 'release' that includes the 'self-upda…
Browse files Browse the repository at this point in the history
…te' feature (#1307)

This is intended to be used in our CI/CD pipelines, so we don't need to
add 'self-update' feature manually, as that is error-prone.

---------

Signed-off-by: simonsan <[email protected]>
  • Loading branch information
simonsan authored Oct 11, 2024
1 parent 9c1239e commit a635073
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
feature: [default]
feature: [release]
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- name: Install Rust toolchain
Expand All @@ -48,15 +48,15 @@ jobs:
components: clippy
- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2
- name: Run clippy
run: cargo clippy --locked --all-targets --features ${{ matrix.feature }} --features self-update -- -D warnings
run: cargo clippy --locked --all-targets --features ${{ matrix.feature }} -- -D warnings

test:
name: Test
runs-on: ${{ matrix.job.os }}
strategy:
matrix:
rust: [stable]
feature: [default]
feature: [release]
job:
- os: macos-latest
- os: ubuntu-latest
Expand All @@ -79,7 +79,7 @@ jobs:
toolchain: stable
- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2
- name: Run Cargo Test
run: cargo test -r --all-targets --features ${{ matrix.feature }} --features self-update --workspace
run: cargo test -r --all-targets --features ${{ matrix.feature }} --workspace

docs:
name: Build docs
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/cross-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
fail-fast: false
matrix:
rust: [stable]
feature: [default]
feature: [release]
job:
- os: windows-latest
os-name: windows
Expand Down Expand Up @@ -93,7 +93,6 @@ jobs:
use-cross: ${{ matrix.job.use-cross }}
all-features: "false"
feature: ${{ matrix.feature }}
extra-cargo-build-args: --features self-update

result:
name: Result (Cross-CI)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ jobs:
sign-release: true
hash-release: true
use-project-version: true
extra-cargo-build-args: --features self-update
extra-cargo-build-args: --features release

publish-nightly:
if: ${{ github.repository_owner == 'rustic-rs' && github.ref == 'refs/heads/main' }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ jobs:
hash-release: true
use-project-version: true
use-tag-version: true # IMPORTANT: this is being used to make sure the tag that is built is in the archive filename, so automation can download the correct version
extra-cargo-build-args: --features self-update
extra-cargo-build-args: --features release

create-release:
name: Creating release with artifacts
Expand Down
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@ rustic - fast, encrypted, deduplicated backups powered by Rust

[features]
default = ["tui", "webdav"]
release = ["default", "self-update"]

# Allocators
mimalloc = ["dep:mimalloc"]
jemallocator = ["dep:jemallocator-global"]

# Commands
self-update = ["dep:self_update", "dep:semver"]
tui = ["dep:ratatui", "dep:crossterm", "dep:tui-textarea"]
webdav = ["dep:dav-server", "dep:warp", "dep:tokio", "rustic_core/webdav"]
Expand Down

0 comments on commit a635073

Please sign in to comment.