Skip to content

Commit

Permalink
Merge pull request #1198 from jerus-org/1191-version-30
Browse files Browse the repository at this point in the history
1191 version 30
  • Loading branch information
jerusdp authored Dec 8, 2024
2 parents 3e823cd + 242fbbd commit 803af45
Show file tree
Hide file tree
Showing 90 changed files with 1,463 additions and 937 deletions.
306 changes: 20 additions & 286 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ parameters:
description: "If true, the make release treats as workspace."

orbs:
toolkit: jerus-org/[email protected]
node: circleci/[email protected]
# sonarcloud: sonarsource/[email protected]
toolkit: jerus-org/[email protected]

executors:
rust_env:
Expand All @@ -35,120 +33,6 @@ executors:
base-env:
docker:
- image: jerusdp/ci-rust:base
commands:
make_github_release:
parameters:
pcu_verbosity:
type: string
default: "-vv"
description: "The verbosity of the pcu command"
pcu_update_changelog:
type: boolean
default: false
description: "The verbosity of the pcu command"
pcu_prefix:
type: string
default: "v"
description: "The verbosity of the pcu command"
pcu_workspace:
type: boolean
default: false
description: "Whether or not to set the workspace flag of the pcu command"
pcu_package:
type: string
default: ""
description: "Package to release and/or publish"
steps:
- run:
name: Create Github release
command: |
set -exo pipefail
if [ << parameters.pcu_package >> != "" ] ; then
package="--package << parameters.pcu_package >>"
# prefix="<< parameters.pcu_package >>-<< parameters.pcu_prefix >> "
pcu <<parameters.pcu_verbosity>> release $update_changelog $package --prefix <<parameters.pcu_prefix>>
exit
fi
if [ <<parameters.pcu_workspace>> == true ] ; then
pcu <<parameters.pcu_verbosity>> release $update_changelog --prefix <<parameters.pcu_prefix>> --workspace
exit
fi
if [ "" != "${SEMVER}" ] ; then
if [ <<parameters.pcu_update_changelog>> == true ] ; then
update_changelog="-update_changelog"
else
update_changelog=""
fi
pcu <<parameters.pcu_verbosity>> release $update_changelog --prefix <<parameters.pcu_prefix>> --semver ${SEMVER}
fi
make_cargo_release:
parameters:
publish:
type: boolean
default: true
description: "If true, the release will be published."
first_release:
type: boolean
default: false
description: "If true, the release will be published as first release."
specific_version:
type: boolean
default: false
description: "If true, the release will be published with a specific version."
version:
type: string
default: ""
description: "Specific version number to release"
no_push:
type: boolean
default: false
description: "Whether or not cargo release should push the changes"
package:
type: string
default: ""
description: "Package to release and/or publish"
steps:
- run:
name: Find next level and publish update
command: |
set -exo pipefail
if [ << parameters.package >> != "" ] ; then
package="--package << parameters.package >>"
fi
if [ << parameters.publish >> == true ] ; then
publish="--publish"
else
publish="--no-publish"
fi
cargo release changes
if [ << parameters.first_release >> == true ] ; then
cargo release $package $publish --execute --no-confirm --sign-tag -c first-release.toml 0.1.0
else
if [ << parameters.specific_version >> == true ] && [ "<< parameters.version >>" != "" ] ; then
export NEXTSV_LEVEL=<< parameters.version >>
else
export NEXTSV_LEVEL=$(nextsv -q -c other require -f CHANGELOG.md feature)
fi
echo $NEXTSV_LEVEL
if [ $NEXTSV_LEVEL != "none" ] ; then
cargo release changes
if [ << parameters.no_push >> == true ] ; then
cargo release $package $publish --no-push --execute --no-confirm --sign-tag "$NEXTSV_LEVEL"
else
cargo release $package $publish --execute --no-confirm --sign-tag "$NEXTSV_LEVEL"
fi
else
echo "Not ready to release yet."
circleci step halt
fi
fi

jobs:
test-suite:
Expand Down Expand Up @@ -197,168 +81,6 @@ jobs:
cargo_package: << parameters.cargo_package >>
cargo_bin: << parameters.cargo_bin >>

wasm_test:
executor: rust_env
steps:
- checkout
- node/install
- run:
name: Installing wasm-pack
command: |
cargo install wasm-pack
wasm-pack -V
- run:
name: Running wasm tests
command: |
set -ex
cd test-wasm
wasm-pack test --node
make_release:
executor:
name: rust_env

parameters:
ssh_fingerprint:
type: string
min_rust_version:
type: string
pcu_verbosity:
type: string
default: "-vv"
description: "The verbosity of the pcu command"
version:
type: string
default: ""
description: |
Specific version number to release
specific_version:
type: boolean
default: false
description: |
Make a specific release, if true version must be set to the specific version number
first_release:
type: boolean
default: false
description: |
Request that a first release (v0.1.0) be created
publish:
type: boolean
default: true
description: |
Publish the release
github_release:
type: boolean
default: true
description: |
Create a github release
cargo_release:
type: boolean
default: true
description: |
Create a cargo release
update_pcu:
type: boolean
default: false
description: |
Update pcu
pcu_update_changelog:
type: boolean
default: false
description: "To update the changelog when making the github release"
pcu_push:
type: boolean
default: false
description: "To use the pcu push command"
pcu_semver:
type: boolean
default: false
description: "Whether or not set the semver version flag"
pcu_no_push:
type: boolean
default: false
description: "Whether or not prevent final push of commit"
pcu_commit_message:
type: string
default: "chore: test push"
description: "The commit message to use for the pcu test push"
pcu_prefix:
type: string
default: "v"
description: "The verbosity of the pcu command"
pcu_workspace:
type: boolean
default: false
description: "Whether or not to set the workspace flag of the pcu command"
package:
type: string
default: ""
description: "The package to publish"

steps:
- checkout
- add_ssh_keys:
fingerprints:
- << parameters.ssh_fingerprint >>
- run:
name: Remove original SSH key from agent
command: |
ssh-add -l
ssh-add -d ~/.ssh/id_rsa.pub
ssh-add -l
- toolkit/gpg_key
- toolkit/git_config
- when:
condition: << parameters.update_pcu >>
steps:
- toolkit/install_latest_pcu
- when:
condition: << parameters.github_release >>
steps:
- toolkit/set_env_var_semver:
version: << parameters.version >>
- when:
condition:
and:
- << parameters.cargo_release >>
- not: << parameters.pcu_push >>
steps:
- make_cargo_release:
publish: << parameters.publish >>
first_release: << parameters.first_release >>
specific_version: << parameters.specific_version >>
version: << parameters.version >>
package: << parameters.package >>
- when:
condition:
and:
- << parameters.cargo_release >>
- << parameters.pcu_push >>
steps:
- make_cargo_release:
publish: << parameters.publish >>
first_release: << parameters.first_release >>
specific_version: << parameters.specific_version >>
version: << parameters.version >>
package: << parameters.package >>
no_push: true
- when:
condition: < parameters.pcu_push >>
steps:
- toolkit/push_cmd:
pcu_no_push: << parameters.pcu_no_push >>
pcu_verbosity: << parameters.pcu_verbosity >>
pcu_semver: << parameters.pcu_semver >>
- when:
condition: < parameters.github_release >>
steps:
- make_github_release:
pcu_verbosity: << parameters.pcu_verbosity >>
pcu_update_changelog: << parameters.pcu_update_changelog >>
pcu_prefix: << parameters.pcu_prefix >>
pcu_workspace: << parameters.pcu_workspace >>
pcu_package: << parameters.package >>

workflows:
check_last_commit:
when:
Expand Down Expand Up @@ -391,26 +113,38 @@ workflows:
- toolkit/code_coverage:
min_rust_version: << pipeline.parameters.min-rust-version >>
package: hcaptcha
requires:
- toolkit/security
- toolkit/required_builds:
name: required builds-<< matrix.cargo_package >>
min_rust_version: << pipeline.parameters.min-rust-version >>
docker_tag_suffix: << pipeline.parameters.docker-tag-suffix >>
matrix: &builds
parameters:
cargo_package: [hcaptcha, hcaptcha-cli, mock-verifier]
cargo_package:
[hcaptcha, hcaptcha_derive, hcaptcha-cli, mock-verifier]
requires:
- toolkit/security
- toolkit/optional_builds:
name: optional builds-<< matrix.cargo_package >>
min_rust_version: << pipeline.parameters.min-rust-version >>
docker_tag_suffix: << pipeline.parameters.docker-tag-suffix >>
matrix:
<<: *builds
requires:
- toolkit/security
- toolkit/common_tests:
name: common tests for x86_64
name: common tests for x86_64-<< matrix.cargo_package >>
min_rust_version: << pipeline.parameters.min-rust-version >>
matrix:
<<: *builds
requires:
- toolkit/security
- toolkit/idiomatic_rust:
min_rust_version: << pipeline.parameters.min-rust-version >>
lint_flags: "-A deprecated"
requires:
- toolkit/security
- toolkit/test_doc_build:
min_rust_version: << pipeline.parameters.min-rust-version >>
- run_test_program:
Expand Down Expand Up @@ -442,7 +176,8 @@ workflows:
- toolkit/required_builds
- toolkit/test_doc_build

- wasm_test:
- toolkit/test_wasm:
min_rust_version: << pipeline.parameters.min-rust-version >>
requires:
- toolkit/common_tests
- toolkit/required_builds
Expand All @@ -456,8 +191,7 @@ workflows:
- toolkit/idiomatic_rust
- test-suite
- run_test_program
- toolkit/security
- wasm_test
- toolkit/test_wasm
- toolkit/code_coverage
context:
- release
Expand Down Expand Up @@ -485,7 +219,7 @@ workflows:
- not: << pipeline.parameters.success-flag >>
- not: << pipeline.parameters.validation-flag >>
jobs:
- make_release:
- toolkit/make_release:
name: make for hcaptcha
context:
- release
Expand All @@ -498,7 +232,7 @@ workflows:
publish: false
package: hcaptcha

- make_release:
- toolkit/make_release:
requires:
- make for hcaptcha
name: make releases - << matrix.package >>
Expand Down
Loading

0 comments on commit 803af45

Please sign in to comment.