From ce65bf950ea1c62516cc0f50a85eefd371e9a32a Mon Sep 17 00:00:00 2001 From: DeveloperC <DeveloperC@protonmail.com> Date: Wed, 24 Jul 2024 14:35:11 +0100 Subject: [PATCH] ci: removing GitLab CI/CD configuration (#18) --- .gitlab-ci.yml | 246 ------------------------------------------------- 1 file changed, 246 deletions(-) delete mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index a1d7ce3..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,246 +0,0 @@ -stages: - - clean-git-history-checking - - conventional-commits-linting - - conventional-commits-next-version-checking - - formatting - - linting - - compiling - - unit-testing - - end-to-end-testing - - lib-crates-io-publishing - - bin-crates-io-publishing - - release-binary-compiling - - -services: - - docker:dind - - -variables: - DOCKER_HOST: tcp://docker:2375 - EARTHLY_EXEC_CMD: "/bin/sh" - SEMANTIC_VERSIONING_REGEX: "[0-9][0-9]*[.][0-9][0-9]*[.][0-9][0-9]*" - BIN_TAG_PREFIX: "bin-" - LIB_TAG_PREFIX: "lib-" - BIN_TAG_REGEX: "${BIN_TAG_PREFIX}${SEMANTIC_VERSIONING_REGEX}" - LIB_TAG_REGEX: "${LIB_TAG_PREFIX}${SEMANTIC_VERSIONING_REGEX}" - BIN_DIRECTORY: "conventional_commits_linter" - LIB_DIRECTORY: "conventional_commits_linter_lib" - END_TO_END_TESTS_DIRECTORY: "${BIN_DIRECTORY}/end-to-end-tests" - BIN_NAME: "conventional_commits_linter" - RELEASE_CLI: "release-cli-linux-amd64" - GIT_CLIFF_VERSION: "0.6.0" - - -clean-git-history-checking: - stage: clean-git-history-checking - image: rust - before_script: - - cargo install clean_git_history - script: - # Check all the commits in the branch. - - /usr/local/cargo/bin/clean_git_history --from-reference "origin/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}" - rules: - - if: $CI_MERGE_REQUEST_ID - - -conventional-commits-linting: - stage: conventional-commits-linting - image: rust - before_script: - - cargo install conventional_commits_linter - script: - # Lint all the commits in the branch. - - /usr/local/cargo/bin/conventional_commits_linter --from-reference "origin/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}" --allow-angular-type-only - rules: - - if: $CI_MERGE_REQUEST_ID - - -bin-conventional-commits-next-version-checking: - stage: conventional-commits-next-version-checking - image: rust - before_script: - - cargo install conventional_commits_next_version - script: - # Get current version. - - current_version=$(grep "^version = \"${SEMANTIC_VERSIONING_REGEX}\"$" "${BIN_DIRECTORY}/Cargo.toml" | cut -d '"' -f 2) - # Get latest tag. - - latest_tag=$(git tag --sort=committerdate | grep "${BIN_TAG_REGEX}" | tail -1) - - latest_version=$(echo "${latest_tag}" | cut -d '-' -f 2) - # Check current vs expected. - - /usr/local/cargo/bin/conventional_commits_next_version --calculation-mode "Batch" --from-reference "${latest_tag}" --from-version "${latest_version}" --current-version "${current_version}" --monorepo "${BIN_DIRECTORY}/" - rules: - - if: $CI_MERGE_REQUEST_ID - - -lib-conventional-commits-next-version-checking: - stage: conventional-commits-next-version-checking - image: rust - before_script: - - cargo install conventional_commits_next_version - script: - # Get current version. - - current_version=$(grep "^version = \"${SEMANTIC_VERSIONING_REGEX}\"$" "${LIB_DIRECTORY}/Cargo.toml" | cut -d '"' -f 2) - # Get latest tag. - - latest_tag=$(git tag --sort=committerdate | grep "${LIB_TAG_REGEX}" | tail -1) - - latest_version=$(echo "${latest_tag}" | cut -d '-' -f 2) - # Check current vs expected. - - /usr/local/cargo/bin/conventional_commits_next_version --calculation-mode "Batch" --from-reference "${latest_tag}" --from-version "${latest_version}" --current-version "${current_version}" --monorepo "${LIB_DIRECTORY}/" - rules: - - if: $CI_MERGE_REQUEST_ID - - -conventional-commits-linter-formatting: - stage: formatting - image: rust - before_script: - - rustup component add rustfmt - script: - - cargo fmt --all -- --check --config=group_imports=StdExternalCrate - rules: - - if: $CI_MERGE_REQUEST_ID - - -end-to-end-tests-formatting: - stage: formatting - image: earthly/earthly - script: - - earthly --ci +check-e2e-formatting - rules: - - if: $CI_MERGE_REQUEST_ID - - -linting: - stage: linting - image: rust - before_script: - - rustup component add clippy - script: - - cargo clippy --verbose --workspace --all-targets -- -D warnings - - cargo clippy --verbose --workspace --all-targets --all-features -- -D warnings - - cargo clippy --verbose --workspace --all-targets --no-default-features -- -D warnings - rules: - - if: $CI_MERGE_REQUEST_ID - - -compiling: - stage: compiling - image: rust - script: - - cargo build --verbose --workspace - - cargo build --verbose --workspace --all-features - - cargo build --verbose --workspace --no-default-features - rules: - - if: $CI_MERGE_REQUEST_ID - - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - - -unit-testing: - stage: unit-testing - image: rust - script: - - cargo test --verbose --workspace - - cargo test --verbose --workspace --all-features - - cargo test --verbose --workspace --no-default-features - rules: - - if: $CI_MERGE_REQUEST_ID - - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - - -end-to-end-testing: - stage: end-to-end-testing - image: rust - before_script: - - apt update - - apt install python3-minimal python3-pip python3-venv git -y - - cargo build - - cd "${END_TO_END_TESTS_DIRECTORY}" - - python3 -m venv .venv - - source .venv/bin/activate - - python3 -m pip install -r requirements.txt - script: - - behave - rules: - - if: $CI_MERGE_REQUEST_ID - - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - - -lib-crates-io-publishing: - stage: lib-crates-io-publishing - image: rust - script: - # Get current version. - - current_version=$(grep "^version = \"${SEMANTIC_VERSIONING_REGEX}\"$" "${LIB_DIRECTORY}/Cargo.toml" | cut -d '"' -f 2) - # If the tag already exist then exit. - - new_tag="${LIB_TAG_PREFIX}${current_version}" - - git tag -l | grep -q "^${new_tag}$" && exit 0 - # Get latest tag. - - latest_tag=$(git tag --sort=committerdate | grep "${LIB_TAG_REGEX}" | tail -1) - # Publish the crate. - - cargo publish --manifest-path "${LIB_DIRECTORY}/Cargo.toml" --token "${GITLAB_CRATES_IO_TOKEN}" - # Install release description generator. - - wget "https://github.com/orhun/git-cliff/releases/download/v${GIT_CLIFF_VERSION}/git-cliff-${GIT_CLIFF_VERSION}-x86_64-unknown-linux-musl.tar.gz" - - tar xzvf "git-cliff-${GIT_CLIFF_VERSION}-x86_64-unknown-linux-musl.tar.gz" - # Generate the release description. - - release_description=$(./git-cliff-${GIT_CLIFF_VERSION}/git-cliff "${latest_tag}.." --tag "${new_tag}" --strip all --include-path "${LIB_DIRECTORY}/*") - # Install GitlabCI cli releasing tool. - - wget "https://release-cli-downloads.s3.amazonaws.com/latest/${RELEASE_CLI}" - - chmod 755 "${RELEASE_CLI}" - # Create the new release. - - ./${RELEASE_CLI} create - --name "${new_tag}" - --description "${release_description}" - --tag-name "${new_tag}" - --ref "${CI_COMMIT_SHA}" - rules: - - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - - -bin-crates-io-publishing: - stage: bin-crates-io-publishing - image: rust - script: - # Get current version. - - current_version=$(grep "^version = \"${SEMANTIC_VERSIONING_REGEX}\"$" "${BIN_DIRECTORY}/Cargo.toml" | cut -d '"' -f 2) - # If the tag already exist then exit. - - new_tag="${BIN_TAG_PREFIX}${current_version}" - - git tag -l | grep -q "^${new_tag}$" && exit 0 - # Get latest tag. - - latest_tag=$(git tag --sort=committerdate | grep "${BIN_TAG_REGEX}" | tail -1) - # Publish the crate. - - cargo publish --manifest-path "${BIN_DIRECTORY}/Cargo.toml" --token "${GITLAB_CRATES_IO_TOKEN}" - # Install release description generator. - - wget "https://github.com/orhun/git-cliff/releases/download/v${GIT_CLIFF_VERSION}/git-cliff-${GIT_CLIFF_VERSION}-x86_64-unknown-linux-musl.tar.gz" - - tar xzvf "git-cliff-${GIT_CLIFF_VERSION}-x86_64-unknown-linux-musl.tar.gz" - # Generate the release description. - - release_description=$(./git-cliff-${GIT_CLIFF_VERSION}/git-cliff "${latest_tag}.." --tag "${new_tag}" --strip all --include-path "${BIN_DIRECTORY}/*") - # Install GitlabCI cli releasing tool. - - wget "https://release-cli-downloads.s3.amazonaws.com/latest/${RELEASE_CLI}" - - chmod 755 "${RELEASE_CLI}" - # Create the new release. - - ./${RELEASE_CLI} create - --name "${new_tag}" - --description "${release_description}" - --tag-name "${new_tag}" - --ref "${CI_COMMIT_SHA}" - --assets-link '{"name":"x86_64-linux-musl-binary.zip","url":"https://gitlab.com/DeveloperC/'${BIN_NAME}'/-/jobs/artifacts/'${new_tag}'/download?job=release-binary-compiling-x86_64-linux-musl"}' - rules: - - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - - -release-binary-compiling-x86_64-linux-musl: - stage: release-binary-compiling - image: rust:alpine - before_script: - - apk add --no-cache musl-dev git - script: - - cargo build --release --target x86_64-unknown-linux-musl - # Delete the directory so we can use the name for the binary. - - rm -rf "${BIN_NAME}" - - mv "target/x86_64-unknown-linux-musl/release/${BIN_NAME}" "${BIN_NAME}" - - strip "${BIN_NAME}" - artifacts: - paths: - - $BIN_NAME - rules: - - if: '$CI_COMMIT_TAG =~ /^bin-.*$/'