Skip to content

Commit

Permalink
chore: hakari + better drop
Browse files Browse the repository at this point in the history
  • Loading branch information
zeeshanlakhani committed Jan 25, 2024
1 parent d565307 commit 0fc8048
Show file tree
Hide file tree
Showing 26 changed files with 688 additions and 100 deletions.
30 changes: 30 additions & 0 deletions .config/hakari.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This file contains settings for `cargo hakari`.
# See https://docs.rs/cargo-hakari/latest/cargo_hakari/config for a full list of options.

hakari-package = "homestar-workspace-hack"

# Format version for hakari's output. Version 4 requires cargo-hakari 0.9.22 or above.
dep-format-version = "4"

workspace-hack-line-style = "workspace-dotted"

# Setting workspace.resolver = "2" in the root Cargo.toml is HIGHLY recommended.
# Hakari works much better with the new feature resolver.
# For more about the new feature resolver, see:
# https://blog.rust-lang.org/2021/03/25/Rust-1.51.0.html#cargos-new-feature-resolver
resolver = "2"

# Add triples corresponding to platforms commonly used by developers here.
# https://doc.rust-lang.org/rustc/platform-support.html
platforms = [
"wasm32-unknown-unknown",
"wasm32-wasi",
"x86_64-apple-darwin",
"aarch64-apple-darwin",
"x86_64-unknown-linux-gnu",
"x86_64-unknown-linux-musl",
"aarch64-unknown-linux-musl",
]

# Write out exact versions rather than a semver range. (Defaults to false.)
# exact-versions = true
6 changes: 4 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

*

!**/Cargo.toml
Expand All @@ -10,5 +11,6 @@
!diesel.toml
!**/wit

homestar-functions/src
homestar-functions/**/wit
examples
homestar-functions
homestar-workspace-hack
9 changes: 7 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ on:
description: Publish Releases at Anytime

workflow_run:
workflows: [ 🧪 Tests and Checks ]
workflows: [🧪 Tests and Checks]
branches: [main]
types: [ completed ]
types: [completed]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -50,6 +50,11 @@ jobs:
- name: Cache Project
uses: Swatinem/rust-cache@v2

- name: Install cargo-hakari
uses: taiki-e/install-action@v2
with:
tool: cargo-hakari

- name: Run release-plz
uses: MarcoIeni/[email protected]
env:
Expand Down
35 changes: 21 additions & 14 deletions .github/workflows/tests_and_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: 🧪 Tests and Checks

on:
push:
branches: [ main ]
branches: [main]

pull_request:
branches: [ '**' ]
branches: ["**"]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -48,8 +48,8 @@ jobs:
needs: changes
if: ${{ needs.changes.outputs.rust == 'true' || needs.changes.outputs.examples == 'true' }}
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -90,12 +90,19 @@ jobs:
- name: Run Linter
run: cargo clippy --all -- -D warnings

# TODO: Return upon new version.
# - name: Verify Publishing of crates
# uses: katyo/publish-crates@v2
# if: ${{ matrix.rust-toolchain == 'stable' }}
# with:
# dry-run: true
- name: Install cargo-hakari
if: ${{ matrix.rust-toolchain == 'stable' }}
uses: taiki-e/install-action@v2
with:
tool: cargo-hakari

- name: Check workspace-hack Cargo.toml is up-to-date
if: ${{ matrix.rust-toolchain == 'stable' }}
run: cargo hakari generate --diff

- name: Check Crates Depend on workspace-hack
if: ${{ matrix.rust-toolchain == 'stable' }}
run: cargo hakari manage-deps --dry-run

# Only "test" release build on push event.
- name: Test Release
Expand Down Expand Up @@ -140,8 +147,8 @@ jobs:
needs: changes
if: ${{ needs.changes.outputs.rust == 'true' }}
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -283,8 +290,8 @@ jobs:
needs: changes
if: ${{ needs.changes.outputs.rust == 'true' }}
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
Expand Down
12 changes: 10 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,16 @@ repos:
args: ["--workspace", "--document-private-items"]
types: [rust]
pass_filenames: false
- id: cargo-hakari
name: workspace-hack
description: Ensure workspace-hack works correctly
entry: bash -c 'cargo hakari generate --diff && cargo hakari manage-deps --dry-run && cargo hakari verify'
language: rust
files: Cargo\.(toml|lock)
pass_filenames: false

- repo: https://github.com/kamadorueda/alejandra
rev: bb7f2ad3f176aa8e9e2944a10061f7989c8fef17 # frozen: 1.3.0
rev: bb7f2ad3f176aa8e9e2944a10061f7989c8fef17 # frozen: 1.3.0
hooks:
- id: alejandra
files: \.nix$
Expand All @@ -55,6 +62,7 @@ repos:
args: ["fmt"]
types:
- toml
exclude: homestar-workspace-hack/Cargo.toml

- repo: https://github.com/compilerla/conventional-pre-commit
rev: v2.1.1
Expand All @@ -75,7 +83,7 @@ repos:
- id: check-yaml
- id: check-json
- id: check-added-large-files
args: ['--maxkb=4000']
args: ["--maxkb=4000"]
- id: detect-private-key
exclude: __testkey
- id: check-executables-have-shebangs
Expand Down
Loading

0 comments on commit 0fc8048

Please sign in to comment.