diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..0280bb4 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,16 @@ +version: 2 +updates: + - package-ecosystem: cargo + directory: "/" + schedule: + interval: daily + open-pull-requests-limit: 10 + commit-message: + prefix: "dep-update: " + - package-ecosystem: github-actions + directory: "/" + schedule: + interval: daily + commit-message: + prefix: "dep-update: " + open-pull-requests-limit: 10 diff --git a/.github/mergify.yml b/.github/mergify.yml new file mode 100644 index 0000000..a83631d --- /dev/null +++ b/.github/mergify.yml @@ -0,0 +1,14 @@ +pull_request_rules: + - name: Automatic merge for Dependabot pull requests + conditions: + - author=dependabot[bot] + actions: + merge: + method: squash + - name: Automatic update to the main branch for pull requests + conditions: + - -conflict + - -draft + - -author=dependabot[bot] + actions: + update: diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 210ba39..27b2642 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -4,6 +4,7 @@ on: branches: - main pull_request: + jobs: build: runs-on: ubuntu-latest @@ -11,24 +12,12 @@ jobs: CI: 1 CARGO_INCREMENTAL: 0 steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Install Rust - uses: actions-rs/toolchain@v1 + - name: Checkout code + uses: actions/checkout@v4 with: - toolchain: 1.63.0-x86_64-unknown-linux-gnu - profile: minimal - override: true - - name: Generate Cargo.lock - uses: actions-rs/cargo@v1 - with: { command: generate-lockfile } - - name: Cache Dependencies - uses: Swatinem/rust-cache@v2 + fetch-depth: 0 + - name: Install rust toolchain + uses: dtolnay/rust-toolchain@stable - name: Test timeout-minutes: 10 - run: | - cargo test - - name: Clear the cargo caches - run: | - cargo install cargo-cache --version 0.8.2 --no-default-features --features ci-autoclean - cargo-cache + run: cargo test diff --git a/.github/workflows/continuous-deployment.yaml b/.github/workflows/continuous-deployment.yaml new file mode 100644 index 0000000..1cad050 --- /dev/null +++ b/.github/workflows/continuous-deployment.yaml @@ -0,0 +1,37 @@ +--- +name: Continuous Deployment + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: + push: + branches: + - main + +jobs: + release-plz: + name: Release-plz + runs-on: ubuntu-latest + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_PUBLISH_KEY }} + steps: + - name: Generate token + id: generate-token + uses: actions/create-github-app-token@v1 + with: + app-id: ${{ secrets.UNLEASH_BOT_APP_ID }} + private-key: ${{ secrets.UNLEASH_BOT_PRIVATE_KEY }} + + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ steps.generate-token.outputs.token }} + - name: Install rust toolchain + uses: dtolnay/rust-toolchain@stable + - name: Run release-plz + uses: MarcoIeni/release-plz-action@v0.5 + env: + GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml deleted file mode 100644 index 4693d38..0000000 --- a/.github/workflows/publish.yaml +++ /dev/null @@ -1,39 +0,0 @@ -name: Release -on: - push: - tags: - - 'v*' - -jobs: - build: - runs-on: ubuntu-latest - env: - CI: 1 - CARGO_INCREMENTAL: 0 - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.64.0-x86_64-unknown-linux-gnu - profile: minimal - override: true - - name: Generate Cargo.lock - uses: actions-rs/cargo@v1 - with: { command: generate-lockfile } - - name: Cache Dependencies - uses: Swatinem/rust-cache@v2 - - name: Test - timeout-minutes: 10 - run: | - cargo test - - name: Publish - run: | - cargo publish - env: - CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} - - name: Clear the cargo caches - run: | - cargo install cargo-cache --version 0.8.2 --no-default-features --features ci-autoclean - cargo-cache diff --git a/Cargo.lock b/Cargo.lock index 1372a90..2a01e9c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "actix-codec" @@ -408,9 +408,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", @@ -423,9 +423,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -433,15 +433,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", @@ -450,15 +450,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-macro" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", @@ -467,21 +467,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-channel", "futures-core", @@ -1184,9 +1184,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "xxhash-rust" -version = "0.8.12" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a5cbf750400958819fb6178eaa83bee5cd9c29a26a40cc241df8c70fdd46984" +checksum = "fdd20c5420375476fbd4394763288da7eb0cc0b8c11deed431a91562af7335d3" [[package]] name = "zerocopy" diff --git a/Cargo.toml b/Cargo.toml index d071064..7b8cde4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,9 +12,9 @@ license = "MIT" actix-service = "2.0.2" actix-web = { version = "4.9.0", default-features = false } base64 = "0.22.1" -futures = "0.3.30" +futures = "0.3.31" str-buf = "3.0.3" -xxhash-rust = { version = "0.8.12", features = ["xxh3"] } +xxhash-rust = { version = "0.8.15", features = ["xxh3"] } [dev-dependencies] actix-web = { version = "4.9.0", default-features = false, features = [ diff --git a/release-plz.toml b/release-plz.toml new file mode 100644 index 0000000..7405dde --- /dev/null +++ b/release-plz.toml @@ -0,0 +1,106 @@ +[workspace] + +changelog_update = true + +dependencies_update = true + +git_tag_enable = true + +git_release_enable = false + +pr_labels = ["release"] + +allow_dirty = false + +publish_allow_dirty = false + +semver_check = false + + +[changelog] + +commit_parsers = [ + { message = "^feat", group = "๐Ÿš€ Features" }, + { message = "^fix", group = "๐Ÿ› Bug Fixes" }, + { message = "^doc", group = "๐Ÿ“š Documentation" }, + { message = "^perf", group = "โšก Performance" }, + { message = "^refactor", group = "๐Ÿšœ Refactor" }, + { message = "^style", group = "๐ŸŽจ Styling" }, + { message = "^test", group = "๐Ÿงช Testing" }, + { message = "^dep-update", group = " Dependency updates" }, + { message = "^build\\(deps\\)", group = " Dependency updates" }, + { message = "^chore\\(release\\): prepare for", skip = true }, + { message = "^chore\\(deps.*\\)", skip = true }, + { message = "^chore\\(pr\\)", skip = true }, + { message = "^chore\\(pull\\)", skip = true }, + { message = "^chore|^ci", group = "โš™๏ธ Miscellaneous Tasks" }, + { body = ".*security", group = "๐Ÿ›ก๏ธ Security" }, + { message = "^revert", group = "โ—€๏ธ Revert" }, + { message = ".*", group = "๐Ÿ’ผ Other" }, +] + +commit_preprocessors = [ + # Replace `foo` with `bar` + { pattern = "foo", replace = "bar" }, + + # Replace `` in the template body with the repository URL + { pattern = '', replace = "https://github.com/unleash/actix-middleware-etag" }, + + # Replace multiple spaces with a single space. + { pattern = " +", replace = " " }, + + # Replace the issue number with the link. + { pattern = "\\(#([0-9]+)\\)", replace = "([#${1}](https://github.com/unleash/actix-middleware-etag/issues/${1}))" }, + # Remove prefix + { pattern = 'Merged PR #[0-9]: (.*)', replace = "$1" }, + + # Remove gitmoji from commit messages, both actual UTF emoji and :emoji: + { pattern = ' *(:\w+:|[\p{Emoji_Presentation}\p{Extended_Pictographic}\u{200D}]) *', replace = "" }, + + # Hyperlink PR references from merge commits. + { pattern = "Merge pull request #([0-9]+) from [^ ]+", replace = "PR # [${1}](https://github.com/unleash/actix-middleware-etag/pull/${1}):" }, + + # Hyperlink commit links, with short commit hash as description. + { pattern = "https://github.com/unleash/actix-middleware-etag/commit/([a-f0-9]{7})[a-f0-9]*", replace = "commit # [${1}](${0})" }, + + # Linear issue references + { pattern = "\\(([0-9]-[0-9]+)\\)", replace = "Linear issue: [${1}](https://linear.app/unleash/issue/${1})"}, + + # Hyperlink bare commit hashes like "abcd1234" in commit logs, with short commit hash as description. + { pattern = "([ \\n])(([a-f0-9]{7})[a-f0-9]*)", replace = "${1}commit # [${3}](https://github.com/unleash/actix-middleware-etag/commit/${2})" }, +] + +body = """ + +## [{{ version | trim_start_matches(pat="v") }}]\ + {%- if release_link -%}\ + ({{ release_link }})\ + {% endif %} \ + - {{ timestamp | date(format="%Y-%m-%d") }} +{% for group, commits in commits | group_by(attribute="group") %} +### {{ group | striptags | trim | upper_first }} + {% for commit in commits %} + {%- if commit.scope -%} + - *({{commit.scope}})* {% if commit.breaking %}[**breaking**] {% endif %}\ + {{ commit.message }}{{ self::username(commit=commit) }}\ + {%- if commit.links %} \ + ({% for link in commit.links %}[{{link.text}}]({{link.href}}) {% endfor -%})\ + {% endif %} + {% else -%} + - {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message }}{{ self::username(commit=commit) }}{{ self::pr(commit=commit) }} + {% endif -%} + {% endfor -%} +{% endfor %} +{%- if remote.contributors %} +### Contributors +{% for contributor in remote.contributors %} + * @{{ contributor.username }} +{%- endfor %} +{% endif -%} +{%- macro username(commit) -%} + {% if commit.remote.username %} (by @{{ commit.remote.username }}){% endif -%} +{% endmacro -%} +{%- macro pr(commit) -%} + {% if commit.remote.pr_number %} - #{{ commit.remote.pr_number }}{% endif -%} +{% endmacro -%} +"""