diff --git a/.gitlab/ci/pipelines/before_merging.yml b/.gitlab/ci/pipelines/before_merging.yml index 548462500cb7288f9b9fffa3686fcb5d1cbf141b..d8fcd06e054406e80f44db361de448f653658777 100644 --- a/.gitlab/ci/pipelines/before_merging.yml +++ b/.gitlab/ci/pipelines/before_merging.yml @@ -2146,6 +2146,41 @@ trigger:rpm_repository_partial_auto: trigger: include: .gitlab/ci/pipelines/rpm_repository_partial_auto.yml +trigger:homebrew_auto: + stage: test + rules: + - changes: + - scripts/ci/install-gsutil.sh + - scripts/packaging/Formula/* + - scripts/packaging/homebrew_install.sh + - scripts/packaging/homebrew_release.sh + - scripts/packaging/test_homebrew_install.sh + when: on_success + needs: + - job: trigger + - job: sanity_ci + optional: true + - job: docker:hadolint + optional: true + - job: oc.ocaml_fmt + optional: true + - job: oc.semgrep + optional: true + - job: oc.misc_checks + optional: true + - job: check_jsonnet + optional: true + - job: check_rust_fmt + optional: true + - job: documentation:rst-check + optional: true + - job: nix + optional: true + - job: commit_titles + optional: true + trigger: + include: .gitlab/ci/pipelines/homebrew_auto.yml + kaitai_checks: image: ${ci_image_name}/build:${ci_image_tag} stage: test @@ -4675,6 +4710,15 @@ documentation:linkcheck: - make -C docs redirectcheck - make -C docs linkcheck +trigger:homebrew: + stage: manual + rules: + - when: manual + allow_failure: true + needs: [] + trigger: + include: .gitlab/ci/pipelines/homebrew.yml + trigger:rpm_repository_partial: stage: manual rules: @@ -4800,33 +4844,6 @@ oc.build:rpm:amd64: - fedora:39 - rockylinux:9.3 -oc.build:homebrew: - image: debian:bookworm - stage: manual - tags: - - gcp - rules: - - when: manual - allow_failure: true - needs: [] - dependencies: [] - timeout: 60 minutes - before_script: - - apt update && apt install -y curl git build-essential - - ./scripts/packaging/homebrew_install.sh - - eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" - - eval $(scripts/active_protocols.sh) - - sed "s|%%VERSION%%|0.0.0-dev| ; s|%%CI_MERGE_REQUEST_SOURCE_PROJECT_URL%%|$CI_MERGE_REQUEST_SOURCE_PROJECT_URL|; - s|%%CI_COMMIT_REF_NAME%%|$CI_COMMIT_REF_NAME|; s|%%CI_PROJECT_NAMESPACE%%|$CI_PROJECT_NAMESPACE|; - s|%%PROTO_CURRENT%%|$PROTO_CURRENT|; s|%%PROTO_NEXT%%|$PROTO_NEXT|" scripts/packaging/Formula/octez.rb.template - > scripts/packaging/Formula/octez.rb - script: - - apt install -y autoconf cmake libev-dev libffi-dev libgmp-dev libprotobuf-dev - libsqlite3-dev postgresql-dev protobuf-compiler libhidapi-dev pkg-config zlib1g-dev - - brew install -v scripts/packaging/Formula/octez.rb - variables: - CARGO_NET_OFFLINE: "false" - oc.script.docker_verify_image_arm64: image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.12.0 stage: manual diff --git a/.gitlab/ci/pipelines/debian_repository_full.yml b/.gitlab/ci/pipelines/debian_repository_full.yml index 3b0ff27288535a848f4a1273648ed50367ef95e3..489b2e582ef669bf4eb07c54229fb562446081ed 100644 --- a/.gitlab/ci/pipelines/debian_repository_full.yml +++ b/.gitlab/ci/pipelines/debian_repository_full.yml @@ -224,7 +224,8 @@ apt_repo_debian_current: timeout: 60 minutes before_script: - . ./scripts/version.sh - - ./scripts/ci/prepare-apt-repo.sh + - ./scripts/ci/install-gsutil.sh + - apt install -y apt-utils debsigs script: - ./scripts/ci/create_debian_repo.sh debian bookworm variables: @@ -245,7 +246,8 @@ apt_repo_debian: timeout: 60 minutes before_script: - . ./scripts/version.sh - - ./scripts/ci/prepare-apt-repo.sh + - ./scripts/ci/install-gsutil.sh + - apt install -y apt-utils debsigs script: - ./scripts/ci/create_debian_repo.sh debian bookworm variables: @@ -426,7 +428,8 @@ apt_repo_ubuntu_current: timeout: 60 minutes before_script: - . ./scripts/version.sh - - ./scripts/ci/prepare-apt-repo.sh + - ./scripts/ci/install-gsutil.sh + - apt install -y apt-utils debsigs script: - ./scripts/ci/create_debian_repo.sh ubuntu noble jammy variables: @@ -447,7 +450,8 @@ apt_repo_ubuntu: timeout: 60 minutes before_script: - . ./scripts/version.sh - - ./scripts/ci/prepare-apt-repo.sh + - ./scripts/ci/install-gsutil.sh + - apt install -y apt-utils debsigs script: - ./scripts/ci/create_debian_repo.sh ubuntu noble jammy variables: diff --git a/.gitlab/ci/pipelines/debian_repository_partial.yml b/.gitlab/ci/pipelines/debian_repository_partial.yml index a1f4e6107f9895ee16b5446b81c6720cda252412..94aa77758a84b1d7d801d11fc7f45ed54a1494f7 100644 --- a/.gitlab/ci/pipelines/debian_repository_partial.yml +++ b/.gitlab/ci/pipelines/debian_repository_partial.yml @@ -216,7 +216,8 @@ apt_repo_debian_current: timeout: 60 minutes before_script: - . ./scripts/version.sh - - ./scripts/ci/prepare-apt-repo.sh + - ./scripts/ci/install-gsutil.sh + - apt install -y apt-utils debsigs script: - ./scripts/ci/create_debian_repo.sh debian bookworm variables: @@ -237,7 +238,8 @@ apt_repo_debian: timeout: 60 minutes before_script: - . ./scripts/version.sh - - ./scripts/ci/prepare-apt-repo.sh + - ./scripts/ci/install-gsutil.sh + - apt install -y apt-utils debsigs script: - ./scripts/ci/create_debian_repo.sh debian bookworm variables: diff --git a/.gitlab/ci/pipelines/debian_repository_partial_auto.yml b/.gitlab/ci/pipelines/debian_repository_partial_auto.yml index 5b47c83f06efa8fd4a7d861f8420718890f445d9..1145266587efef0f945db2d081614ae4c129b889 100644 --- a/.gitlab/ci/pipelines/debian_repository_partial_auto.yml +++ b/.gitlab/ci/pipelines/debian_repository_partial_auto.yml @@ -216,7 +216,8 @@ apt_repo_debian_current: timeout: 60 minutes before_script: - . ./scripts/version.sh - - ./scripts/ci/prepare-apt-repo.sh + - ./scripts/ci/install-gsutil.sh + - apt install -y apt-utils debsigs script: - ./scripts/ci/create_debian_repo.sh debian bookworm variables: @@ -237,7 +238,8 @@ apt_repo_debian: timeout: 60 minutes before_script: - . ./scripts/version.sh - - ./scripts/ci/prepare-apt-repo.sh + - ./scripts/ci/install-gsutil.sh + - apt install -y apt-utils debsigs script: - ./scripts/ci/create_debian_repo.sh debian bookworm variables: diff --git a/.gitlab/ci/pipelines/homebrew.yml b/.gitlab/ci/pipelines/homebrew.yml new file mode 100644 index 0000000000000000000000000000000000000000..a80c5c3278ba6304c1c4be493e93b7a55adb4e4d --- /dev/null +++ b/.gitlab/ci/pipelines/homebrew.yml @@ -0,0 +1,61 @@ +# This file was automatically generated, do not edit. +# Edit file ci/bin/main.ml instead. + +workflow: + rules: + - if: $foo != "bar" || $foo == "bar" + when: always + +variables: + PIPELINE_TYPE: homebrew + +stages: +- start +- build + +datadog_pipeline_trace: + image: datadog/ci:v2.44.0 + stage: start + tags: + - gcp + dependencies: [] + allow_failure: true + timeout: 60 minutes + script: + - CI_MERGE_REQUEST_IID=${CI_MERGE_REQUEST_IID:-none} + - DATADOG_SITE=datadoghq.eu datadog-ci tag --level pipeline --tags pipeline_type:$PIPELINE_TYPE + --tags mr_number:$CI_MERGE_REQUEST_IID + +oc.install-homebrew: + image: debian:bookworm + stage: build + tags: + - gcp + needs: + - oc.build-homebrew + dependencies: [] + timeout: 60 minutes + before_script: + - apt-get update && apt-get install -y git curl + - ./scripts/packaging/homebrew_install.sh + - eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv) + script: + - apt-get install -y autoconf cmake g++ libev-dev libffi-dev libgmp-dev libprotobuf-dev + libsqlite3-dev protobuf-compiler libhidapi-dev pkg-config zlib1g-dev libpq-dev + - ./scripts/packaging/test_homebrew_install.sh + variables: + CARGO_NET_OFFLINE: "false" + +oc.build-homebrew: + image: debian:bookworm + stage: build + tags: + - gcp + dependencies: [] + timeout: 60 minutes + script: + - ./scripts/ci/install-gsutil.sh + - apt-get update && apt-get install -y git curl + - ./scripts/packaging/homebrew_release.sh + variables: + CARGO_NET_OFFLINE: "false" diff --git a/.gitlab/ci/pipelines/homebrew_auto.yml b/.gitlab/ci/pipelines/homebrew_auto.yml new file mode 100644 index 0000000000000000000000000000000000000000..fa1d9398cdfee85724f06ad4e17db951324caf93 --- /dev/null +++ b/.gitlab/ci/pipelines/homebrew_auto.yml @@ -0,0 +1,61 @@ +# This file was automatically generated, do not edit. +# Edit file ci/bin/main.ml instead. + +workflow: + rules: + - if: $foo != "bar" || $foo == "bar" + when: always + +variables: + PIPELINE_TYPE: homebrew_auto + +stages: +- start +- build + +datadog_pipeline_trace: + image: datadog/ci:v2.44.0 + stage: start + tags: + - gcp + dependencies: [] + allow_failure: true + timeout: 60 minutes + script: + - CI_MERGE_REQUEST_IID=${CI_MERGE_REQUEST_IID:-none} + - DATADOG_SITE=datadoghq.eu datadog-ci tag --level pipeline --tags pipeline_type:$PIPELINE_TYPE + --tags mr_number:$CI_MERGE_REQUEST_IID + +oc.install-homebrew: + image: debian:bookworm + stage: build + tags: + - gcp + needs: + - oc.build-homebrew + dependencies: [] + timeout: 60 minutes + before_script: + - apt-get update && apt-get install -y git curl + - ./scripts/packaging/homebrew_install.sh + - eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv) + script: + - apt-get install -y autoconf cmake g++ libev-dev libffi-dev libgmp-dev libprotobuf-dev + libsqlite3-dev protobuf-compiler libhidapi-dev pkg-config zlib1g-dev libpq-dev + - ./scripts/packaging/test_homebrew_install.sh + variables: + CARGO_NET_OFFLINE: "false" + +oc.build-homebrew: + image: debian:bookworm + stage: build + tags: + - gcp + dependencies: [] + timeout: 60 minutes + script: + - ./scripts/ci/install-gsutil.sh + - apt-get update && apt-get install -y git curl + - ./scripts/packaging/homebrew_release.sh + variables: + CARGO_NET_OFFLINE: "false" diff --git a/.gitlab/ci/pipelines/merge_train.yml b/.gitlab/ci/pipelines/merge_train.yml index 55a689c99469499bd62902f568e9ff8c7c107e51..cad98f9379eb4fe4ceca40ee4587bbf5dc186a8c 100644 --- a/.gitlab/ci/pipelines/merge_train.yml +++ b/.gitlab/ci/pipelines/merge_train.yml @@ -2146,6 +2146,41 @@ trigger:rpm_repository_partial_auto: trigger: include: .gitlab/ci/pipelines/rpm_repository_partial_auto.yml +trigger:homebrew_auto: + stage: test + rules: + - changes: + - scripts/ci/install-gsutil.sh + - scripts/packaging/Formula/* + - scripts/packaging/homebrew_install.sh + - scripts/packaging/homebrew_release.sh + - scripts/packaging/test_homebrew_install.sh + when: on_success + needs: + - job: trigger + - job: sanity_ci + optional: true + - job: docker:hadolint + optional: true + - job: oc.ocaml_fmt + optional: true + - job: oc.semgrep + optional: true + - job: oc.misc_checks + optional: true + - job: check_jsonnet + optional: true + - job: check_rust_fmt + optional: true + - job: documentation:rst-check + optional: true + - job: nix + optional: true + - job: commit_titles + optional: true + trigger: + include: .gitlab/ci/pipelines/homebrew_auto.yml + kaitai_checks: image: ${ci_image_name}/build:${ci_image_tag} stage: test @@ -4782,33 +4817,6 @@ oc.build:rpm:amd64: - fedora:39 - rockylinux:9.3 -oc.build:homebrew: - image: debian:bookworm - stage: manual - tags: - - gcp - rules: - - when: manual - allow_failure: true - needs: [] - dependencies: [] - timeout: 60 minutes - before_script: - - apt update && apt install -y curl git build-essential - - ./scripts/packaging/homebrew_install.sh - - eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" - - eval $(scripts/active_protocols.sh) - - sed "s|%%VERSION%%|0.0.0-dev| ; s|%%CI_MERGE_REQUEST_SOURCE_PROJECT_URL%%|$CI_MERGE_REQUEST_SOURCE_PROJECT_URL|; - s|%%CI_COMMIT_REF_NAME%%|$CI_COMMIT_REF_NAME|; s|%%CI_PROJECT_NAMESPACE%%|$CI_PROJECT_NAMESPACE|; - s|%%PROTO_CURRENT%%|$PROTO_CURRENT|; s|%%PROTO_NEXT%%|$PROTO_NEXT|" scripts/packaging/Formula/octez.rb.template - > scripts/packaging/Formula/octez.rb - script: - - apt install -y autoconf cmake libev-dev libffi-dev libgmp-dev libprotobuf-dev - libsqlite3-dev postgresql-dev protobuf-compiler libhidapi-dev pkg-config zlib1g-dev - - brew install -v scripts/packaging/Formula/octez.rb - variables: - CARGO_NET_OFFLINE: "false" - oc.script.docker_verify_image_arm64: image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.12.0 stage: manual diff --git a/.gitlab/ci/pipelines/non_release_tag.yml b/.gitlab/ci/pipelines/non_release_tag.yml index ede448d7eb1f5a65c8ffda02b7978f0f4eb5e319..9fe864cb824f9476cd6d76fdab3332090d35473c 100644 --- a/.gitlab/ci/pipelines/non_release_tag.yml +++ b/.gitlab/ci/pipelines/non_release_tag.yml @@ -238,6 +238,27 @@ oc.build:rpm:amd64: - fedora:39 - rockylinux:9.3 +oc.install-release-homebrew: + image: debian:bookworm + stage: build + tags: + - gcp + needs: [] + dependencies: [] + timeout: 60 minutes + script: + - ./scripts/ci/install-gsutil.sh + - apt install -y git build-essential + - ./scripts/packaging/homebrew_install.sh + - eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv) + - ./scripts/packaging/homebrew_release.sh + artifacts: + name: build-$CI_COMMIT_REF_SLUG + expire_in: 1 day + paths: + - public/homebrew/* + when: on_success + docker:merge_manifests: image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.12.0 stage: prepare_release @@ -266,6 +287,7 @@ gitlab:publish: needs: - oc.build:static-x86_64-linux-binaries - oc.build:static-arm64-linux-binaries + - oc.install-release-homebrew - oc.build:rpm:amd64 - oc.build-ubuntu-current_a - oc.build-debian-current_a @@ -274,6 +296,7 @@ gitlab:publish: dependencies: - oc.build:static-x86_64-linux-binaries - oc.build:static-arm64-linux-binaries + - oc.install-release-homebrew - oc.build:rpm:amd64 - oc.build-ubuntu-current_a - oc.build-debian-current_a @@ -479,7 +502,8 @@ apt_repo_debian_current: timeout: 60 minutes before_script: - . ./scripts/version.sh - - ./scripts/ci/prepare-apt-repo.sh + - ./scripts/ci/install-gsutil.sh + - apt install -y apt-utils debsigs script: - ./scripts/ci/create_debian_repo.sh debian bookworm variables: @@ -500,7 +524,8 @@ apt_repo_debian: timeout: 60 minutes before_script: - . ./scripts/version.sh - - ./scripts/ci/prepare-apt-repo.sh + - ./scripts/ci/install-gsutil.sh + - apt install -y apt-utils debsigs script: - ./scripts/ci/create_debian_repo.sh debian bookworm variables: @@ -681,7 +706,8 @@ apt_repo_ubuntu_current: timeout: 60 minutes before_script: - . ./scripts/version.sh - - ./scripts/ci/prepare-apt-repo.sh + - ./scripts/ci/install-gsutil.sh + - apt install -y apt-utils debsigs script: - ./scripts/ci/create_debian_repo.sh ubuntu noble jammy variables: @@ -702,7 +728,8 @@ apt_repo_ubuntu: timeout: 60 minutes before_script: - . ./scripts/version.sh - - ./scripts/ci/prepare-apt-repo.sh + - ./scripts/ci/install-gsutil.sh + - apt install -y apt-utils debsigs script: - ./scripts/ci/create_debian_repo.sh ubuntu noble jammy variables: diff --git a/.gitlab/ci/pipelines/non_release_tag_test.yml b/.gitlab/ci/pipelines/non_release_tag_test.yml index 496006f5a40044f70c73b6f67628970973184abc..dff611b121ce5689a47518d0eede616e3e35737b 100644 --- a/.gitlab/ci/pipelines/non_release_tag_test.yml +++ b/.gitlab/ci/pipelines/non_release_tag_test.yml @@ -238,6 +238,27 @@ oc.build:rpm:amd64: - fedora:39 - rockylinux:9.3 +oc.install-release-homebrew: + image: debian:bookworm + stage: build + tags: + - gcp + needs: [] + dependencies: [] + timeout: 60 minutes + script: + - ./scripts/ci/install-gsutil.sh + - apt install -y git build-essential + - ./scripts/packaging/homebrew_install.sh + - eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv) + - ./scripts/packaging/homebrew_release.sh + artifacts: + name: build-$CI_COMMIT_REF_SLUG + expire_in: 1 day + paths: + - public/homebrew/* + when: on_success + docker:merge_manifests: image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.12.0 stage: prepare_release @@ -266,6 +287,7 @@ gitlab:publish: needs: - oc.build:static-x86_64-linux-binaries - oc.build:static-arm64-linux-binaries + - oc.install-release-homebrew - oc.build:rpm:amd64 - oc.build-ubuntu-current_a - oc.build-debian-current_a @@ -274,6 +296,7 @@ gitlab:publish: dependencies: - oc.build:static-x86_64-linux-binaries - oc.build:static-arm64-linux-binaries + - oc.install-release-homebrew - oc.build:rpm:amd64 - oc.build-ubuntu-current_a - oc.build-debian-current_a @@ -479,7 +502,8 @@ apt_repo_debian_current: timeout: 60 minutes before_script: - . ./scripts/version.sh - - ./scripts/ci/prepare-apt-repo.sh + - ./scripts/ci/install-gsutil.sh + - apt install -y apt-utils debsigs script: - ./scripts/ci/create_debian_repo.sh debian bookworm variables: @@ -500,7 +524,8 @@ apt_repo_debian: timeout: 60 minutes before_script: - . ./scripts/version.sh - - ./scripts/ci/prepare-apt-repo.sh + - ./scripts/ci/install-gsutil.sh + - apt install -y apt-utils debsigs script: - ./scripts/ci/create_debian_repo.sh debian bookworm variables: @@ -681,7 +706,8 @@ apt_repo_ubuntu_current: timeout: 60 minutes before_script: - . ./scripts/version.sh - - ./scripts/ci/prepare-apt-repo.sh + - ./scripts/ci/install-gsutil.sh + - apt install -y apt-utils debsigs script: - ./scripts/ci/create_debian_repo.sh ubuntu noble jammy variables: @@ -702,7 +728,8 @@ apt_repo_ubuntu: timeout: 60 minutes before_script: - . ./scripts/version.sh - - ./scripts/ci/prepare-apt-repo.sh + - ./scripts/ci/install-gsutil.sh + - apt install -y apt-utils debsigs script: - ./scripts/ci/create_debian_repo.sh ubuntu noble jammy variables: diff --git a/.gitlab/ci/pipelines/octez_beta_release_tag.yml b/.gitlab/ci/pipelines/octez_beta_release_tag.yml index f76045c8716384eb35dc55488984e99278699d21..631c5ab4a8ca7d97a8bde1a0c9094705721bd389 100644 --- a/.gitlab/ci/pipelines/octez_beta_release_tag.yml +++ b/.gitlab/ci/pipelines/octez_beta_release_tag.yml @@ -238,6 +238,27 @@ oc.build:rpm:amd64: - fedora:39 - rockylinux:9.3 +oc.install-release-homebrew: + image: debian:bookworm + stage: build + tags: + - gcp + needs: [] + dependencies: [] + timeout: 60 minutes + script: + - ./scripts/ci/install-gsutil.sh + - apt install -y git build-essential + - ./scripts/packaging/homebrew_install.sh + - eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv) + - ./scripts/packaging/homebrew_release.sh + artifacts: + name: build-$CI_COMMIT_REF_SLUG + expire_in: 1 day + paths: + - public/homebrew/* + when: on_success + docker:merge_manifests: image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.12.0 stage: prepare_release @@ -266,6 +287,7 @@ gitlab:release: needs: - oc.build:static-x86_64-linux-binaries - oc.build:static-arm64-linux-binaries + - oc.install-release-homebrew - oc.build:rpm:amd64 - oc.build-ubuntu-current_a - oc.build-debian-current_a @@ -274,6 +296,7 @@ gitlab:release: dependencies: - oc.build:static-x86_64-linux-binaries - oc.build:static-arm64-linux-binaries + - oc.install-release-homebrew - oc.build:rpm:amd64 - oc.build-ubuntu-current_a - oc.build-debian-current_a @@ -480,7 +503,8 @@ apt_repo_debian_current: timeout: 60 minutes before_script: - . ./scripts/version.sh - - ./scripts/ci/prepare-apt-repo.sh + - ./scripts/ci/install-gsutil.sh + - apt install -y apt-utils debsigs script: - ./scripts/ci/create_debian_repo.sh debian bookworm variables: @@ -501,7 +525,8 @@ apt_repo_debian: timeout: 60 minutes before_script: - . ./scripts/version.sh - - ./scripts/ci/prepare-apt-repo.sh + - ./scripts/ci/install-gsutil.sh + - apt install -y apt-utils debsigs script: - ./scripts/ci/create_debian_repo.sh debian bookworm variables: @@ -682,7 +707,8 @@ apt_repo_ubuntu_current: timeout: 60 minutes before_script: - . ./scripts/version.sh - - ./scripts/ci/prepare-apt-repo.sh + - ./scripts/ci/install-gsutil.sh + - apt install -y apt-utils debsigs script: - ./scripts/ci/create_debian_repo.sh ubuntu noble jammy variables: @@ -703,7 +729,8 @@ apt_repo_ubuntu: timeout: 60 minutes before_script: - . ./scripts/version.sh - - ./scripts/ci/prepare-apt-repo.sh + - ./scripts/ci/install-gsutil.sh + - apt install -y apt-utils debsigs script: - ./scripts/ci/create_debian_repo.sh ubuntu noble jammy variables: diff --git a/.gitlab/ci/pipelines/octez_release_tag.yml b/.gitlab/ci/pipelines/octez_release_tag.yml index 41ba6567acb53f78d51b52571e1f7239f563cd88..ebe1edf0073ecceab6761c20e9a73853d0c48d90 100644 --- a/.gitlab/ci/pipelines/octez_release_tag.yml +++ b/.gitlab/ci/pipelines/octez_release_tag.yml @@ -239,6 +239,27 @@ oc.build:rpm:amd64: - fedora:39 - rockylinux:9.3 +oc.install-release-homebrew: + image: debian:bookworm + stage: build + tags: + - gcp + needs: [] + dependencies: [] + timeout: 60 minutes + script: + - ./scripts/ci/install-gsutil.sh + - apt install -y git build-essential + - ./scripts/packaging/homebrew_install.sh + - eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv) + - ./scripts/packaging/homebrew_release.sh + artifacts: + name: build-$CI_COMMIT_REF_SLUG + expire_in: 1 day + paths: + - public/homebrew/* + when: on_success + docker:merge_manifests: image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.12.0 stage: prepare_release @@ -267,6 +288,7 @@ gitlab:release: needs: - oc.build:static-x86_64-linux-binaries - oc.build:static-arm64-linux-binaries + - oc.install-release-homebrew - oc.build:rpm:amd64 - oc.build-ubuntu-current_a - oc.build-debian-current_a @@ -275,6 +297,7 @@ gitlab:release: dependencies: - oc.build:static-x86_64-linux-binaries - oc.build:static-arm64-linux-binaries + - oc.install-release-homebrew - oc.build:rpm:amd64 - oc.build-ubuntu-current_a - oc.build-debian-current_a @@ -481,7 +504,8 @@ apt_repo_debian_current: timeout: 60 minutes before_script: - . ./scripts/version.sh - - ./scripts/ci/prepare-apt-repo.sh + - ./scripts/ci/install-gsutil.sh + - apt install -y apt-utils debsigs script: - ./scripts/ci/create_debian_repo.sh debian bookworm variables: @@ -502,7 +526,8 @@ apt_repo_debian: timeout: 60 minutes before_script: - . ./scripts/version.sh - - ./scripts/ci/prepare-apt-repo.sh + - ./scripts/ci/install-gsutil.sh + - apt install -y apt-utils debsigs script: - ./scripts/ci/create_debian_repo.sh debian bookworm variables: @@ -683,7 +708,8 @@ apt_repo_ubuntu_current: timeout: 60 minutes before_script: - . ./scripts/version.sh - - ./scripts/ci/prepare-apt-repo.sh + - ./scripts/ci/install-gsutil.sh + - apt install -y apt-utils debsigs script: - ./scripts/ci/create_debian_repo.sh ubuntu noble jammy variables: @@ -704,7 +730,8 @@ apt_repo_ubuntu: timeout: 60 minutes before_script: - . ./scripts/version.sh - - ./scripts/ci/prepare-apt-repo.sh + - ./scripts/ci/install-gsutil.sh + - apt install -y apt-utils debsigs script: - ./scripts/ci/create_debian_repo.sh ubuntu noble jammy variables: diff --git a/.gitlab/ci/pipelines/octez_release_tag_test.yml b/.gitlab/ci/pipelines/octez_release_tag_test.yml index f4dfdcea4ecceed41bc8a52e9d18ece26f5b330a..79da0f0833b471463806aaf34b9ae771b7ad5f41 100644 --- a/.gitlab/ci/pipelines/octez_release_tag_test.yml +++ b/.gitlab/ci/pipelines/octez_release_tag_test.yml @@ -239,6 +239,27 @@ oc.build:rpm:amd64: - fedora:39 - rockylinux:9.3 +oc.install-release-homebrew: + image: debian:bookworm + stage: build + tags: + - gcp + needs: [] + dependencies: [] + timeout: 60 minutes + script: + - ./scripts/ci/install-gsutil.sh + - apt install -y git build-essential + - ./scripts/packaging/homebrew_install.sh + - eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv) + - ./scripts/packaging/homebrew_release.sh + artifacts: + name: build-$CI_COMMIT_REF_SLUG + expire_in: 1 day + paths: + - public/homebrew/* + when: on_success + docker:merge_manifests: image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.12.0 stage: prepare_release @@ -267,6 +288,7 @@ gitlab:release: needs: - oc.build:static-x86_64-linux-binaries - oc.build:static-arm64-linux-binaries + - oc.install-release-homebrew - oc.build:rpm:amd64 - oc.build-ubuntu-current_a - oc.build-debian-current_a @@ -275,6 +297,7 @@ gitlab:release: dependencies: - oc.build:static-x86_64-linux-binaries - oc.build:static-arm64-linux-binaries + - oc.install-release-homebrew - oc.build:rpm:amd64 - oc.build-ubuntu-current_a - oc.build-debian-current_a @@ -481,7 +504,8 @@ apt_repo_debian_current: timeout: 60 minutes before_script: - . ./scripts/version.sh - - ./scripts/ci/prepare-apt-repo.sh + - ./scripts/ci/install-gsutil.sh + - apt install -y apt-utils debsigs script: - ./scripts/ci/create_debian_repo.sh debian bookworm variables: @@ -502,7 +526,8 @@ apt_repo_debian: timeout: 60 minutes before_script: - . ./scripts/version.sh - - ./scripts/ci/prepare-apt-repo.sh + - ./scripts/ci/install-gsutil.sh + - apt install -y apt-utils debsigs script: - ./scripts/ci/create_debian_repo.sh debian bookworm variables: @@ -683,7 +708,8 @@ apt_repo_ubuntu_current: timeout: 60 minutes before_script: - . ./scripts/version.sh - - ./scripts/ci/prepare-apt-repo.sh + - ./scripts/ci/install-gsutil.sh + - apt install -y apt-utils debsigs script: - ./scripts/ci/create_debian_repo.sh ubuntu noble jammy variables: @@ -704,7 +730,8 @@ apt_repo_ubuntu: timeout: 60 minutes before_script: - . ./scripts/version.sh - - ./scripts/ci/prepare-apt-repo.sh + - ./scripts/ci/install-gsutil.sh + - apt install -y apt-utils debsigs script: - ./scripts/ci/create_debian_repo.sh ubuntu noble jammy variables: diff --git a/.gitlab/ci/pipelines/schedule_extended_test.yml b/.gitlab/ci/pipelines/schedule_extended_test.yml index cd0011881eeb27e9091554657443902ff4bdc5e8..40948a0fc3633e8a46199db5516d829b698ce8cf 100644 --- a/.gitlab/ci/pipelines/schedule_extended_test.yml +++ b/.gitlab/ci/pipelines/schedule_extended_test.yml @@ -1505,6 +1505,13 @@ trigger:rpm_repository_full: trigger: include: .gitlab/ci/pipelines/rpm_repository_full.yml +trigger:homebrew: + stage: test + rules: + - when: always + trigger: + include: .gitlab/ci/pipelines/homebrew.yml + kaitai_checks: image: ${ci_image_name}/build:${ci_image_tag} stage: test diff --git a/.gitlab/ci/pipelines/schedule_master_test_release.yml b/.gitlab/ci/pipelines/schedule_master_test_release.yml index 9c6ae7f22ddf9ee130b45ea66bfe73e8c768316d..ad0ae898753b87b3fe5061dd547d3c08557e5495 100644 --- a/.gitlab/ci/pipelines/schedule_master_test_release.yml +++ b/.gitlab/ci/pipelines/schedule_master_test_release.yml @@ -238,6 +238,27 @@ oc.build:rpm:amd64: - fedora:39 - rockylinux:9.3 +oc.install-release-homebrew: + image: debian:bookworm + stage: build + tags: + - gcp + needs: [] + dependencies: [] + timeout: 60 minutes + script: + - ./scripts/ci/install-gsutil.sh + - apt install -y git build-essential + - ./scripts/packaging/homebrew_install.sh + - eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv) + - ./scripts/packaging/homebrew_release.sh + artifacts: + name: build-$CI_COMMIT_REF_SLUG + expire_in: 1 day + paths: + - public/homebrew/* + when: on_success + docker:merge_manifests: image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.12.0 stage: prepare_release @@ -266,6 +287,7 @@ gitlab:publish: needs: - oc.build:static-x86_64-linux-binaries - oc.build:static-arm64-linux-binaries + - oc.install-release-homebrew - oc.build:rpm:amd64 - oc.build-ubuntu-current_a - oc.build-debian-current_a @@ -274,6 +296,7 @@ gitlab:publish: dependencies: - oc.build:static-x86_64-linux-binaries - oc.build:static-arm64-linux-binaries + - oc.install-release-homebrew - oc.build:rpm:amd64 - oc.build-ubuntu-current_a - oc.build-debian-current_a @@ -483,7 +506,8 @@ apt_repo_debian_current: timeout: 60 minutes before_script: - . ./scripts/version.sh - - ./scripts/ci/prepare-apt-repo.sh + - ./scripts/ci/install-gsutil.sh + - apt install -y apt-utils debsigs script: - ./scripts/ci/create_debian_repo.sh debian bookworm variables: @@ -504,7 +528,8 @@ apt_repo_debian: timeout: 60 minutes before_script: - . ./scripts/version.sh - - ./scripts/ci/prepare-apt-repo.sh + - ./scripts/ci/install-gsutil.sh + - apt install -y apt-utils debsigs script: - ./scripts/ci/create_debian_repo.sh debian bookworm variables: @@ -685,7 +710,8 @@ apt_repo_ubuntu_current: timeout: 60 minutes before_script: - . ./scripts/version.sh - - ./scripts/ci/prepare-apt-repo.sh + - ./scripts/ci/install-gsutil.sh + - apt install -y apt-utils debsigs script: - ./scripts/ci/create_debian_repo.sh ubuntu noble jammy variables: @@ -706,7 +732,8 @@ apt_repo_ubuntu: timeout: 60 minutes before_script: - . ./scripts/version.sh - - ./scripts/ci/prepare-apt-repo.sh + - ./scripts/ci/install-gsutil.sh + - apt install -y apt-utils debsigs script: - ./scripts/ci/create_debian_repo.sh ubuntu noble jammy variables: diff --git a/ci/bin/code_verification.ml b/ci/bin/code_verification.ml index bed02242f8ba12c3e5eb53fbd0e639f2a9ac9bea..7347ca3f82b72c4cf819fdaf33848ed1b0cc4de0 100644 --- a/ci/bin/code_verification.ml +++ b/ci/bin/code_verification.ml @@ -831,6 +831,22 @@ let jobs pipeline_type = Rpm_repository.child_pipeline_full in + let job_homebrew_trigger_auto = + trigger_job + ~__POS__ + ~rules:(make_rules ~manual:No ~changes:changeset_homebrew ()) + ~stage:Stages.test + ~dependencies:dependencies_needs_start + Homebrew.child_pipeline_full_auto + in + let job_homebrew_trigger_full = + trigger_job + ~__POS__ + ~rules:(make_rules ~manual:No ~changes:changeset_homebrew ()) + ~stage:Stages.test + ~dependencies:dependencies_needs_start + Homebrew.child_pipeline_full + in (* check that ksy files are still up-to-date with octez *) let job_kaitai_checks : tezos_job = job @@ -1613,9 +1629,17 @@ let jobs pipeline_type = let jobs_debian = match pipeline_type with | Before_merging | Merge_train -> - [job_debian_repository_trigger_auto; job_rpm_repository_trigger_auto] + [ + job_debian_repository_trigger_auto; + job_rpm_repository_trigger_auto; + job_homebrew_trigger_auto; + ] | Schedule_extended_test -> - [job_debian_repository_trigger_full; job_rpm_repository_trigger_full] + [ + job_debian_repository_trigger_full; + job_rpm_repository_trigger_full; + job_homebrew_trigger_full; + ] in jobs_debian @ jobs_misc @ jobs_kernels @ jobs_unit @ jobs_install_octez @ jobs_tezt @@ -1811,6 +1835,16 @@ let jobs pipeline_type = ~stage:Stages.manual Rpm_repository.child_pipeline_partial in + let job_homebrew_repository_trigger : tezos_job = + (* We leave the possibility to run this pipeline manually, in particular + to generate the formula on scheduled pipelines *) + trigger_job + ~__POS__ + ~rules:(make_rules ~manual:Yes ()) + ~dependencies:(Dependent []) + ~stage:Stages.manual + Homebrew.child_pipeline_full + in match pipeline_type with | Before_merging | Merge_train -> (* Note: manual jobs in stage [manual] (which is the final @@ -1849,15 +1883,6 @@ let jobs pipeline_type = ~stage:Stages.manual () in - let job_build_homebrew_manual = - job_build_homebrew - ~__POS__ - ~name:"oc.build:homebrew" - ~rules:(make_rules ~manual:Yes ()) - ~dependencies:(Dependent []) - ~stage:Stages.manual - () - in let job_docker_verify_test_amd64 : tezos_job = job_docker_authenticated ~__POS__ @@ -1883,13 +1908,12 @@ let jobs pipeline_type = job_docker_amd64_test_manual; job_docker_arm64_test_manual; job_build_rpm_amd64_manual; - job_build_homebrew_manual; ] @ [job_docker_verify_test_arm64; job_docker_verify_test_amd64] in if pipeline_type = Merge_train then jobs else - job_rpm_repository_trigger_partial + job_homebrew_repository_trigger :: job_rpm_repository_trigger_partial :: job_debian_repository_trigger_partial :: jobs (* No manual jobs on the scheduled pipeline *) | Schedule_extended_test -> [] diff --git a/ci/bin/common.ml b/ci/bin/common.ml index 0dfdea5c01fa62893b8083f6422074d0c64389d5..ccd55e7002aa2d9599367f53124fca0dc2d0dc59 100644 --- a/ci/bin/common.ml +++ b/ci/bin/common.ml @@ -524,6 +524,17 @@ let changeset_rpm_packages = "scripts/ci/create_rpm_repo.sh"; ]) +let changeset_homebrew = + Changeset.( + make + [ + "scripts/packaging/test_homebrew_install.sh"; + "scripts/packaging/homebrew_release.sh"; + "scripts/ci/install-gsutil.sh"; + "scripts/packaging/homebrew_install.sh"; + "scripts/packaging/Formula/*"; + ]) + (** The set of [changes:] that select opam jobs. Note: unlike all other changesets, this one does not include {!changeset_base}. @@ -1106,41 +1117,6 @@ let job_build_rpm_amd64 : unit -> tezos_job = ~arch:Amd64 ~dependencies:(Dependent []) -let job_build_homebrew ?rules ~__POS__ ~name ?(stage = Stages.build) - ?dependencies () : tezos_job = - let image = Images.debian_bookworm in - job - ?rules - ~__POS__ - ~name - ~arch:Amd64 - ?dependencies - ~image - ~stage - ~before_script: - [ - "apt update && apt install -y curl git build-essential"; - "./scripts/packaging/homebrew_install.sh"; - "eval \"$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)\""; - "eval $(scripts/active_protocols.sh)"; - "sed \"s|%%VERSION%%|0.0.0-dev| ; \ - s|%%CI_MERGE_REQUEST_SOURCE_PROJECT_URL%%|$CI_MERGE_REQUEST_SOURCE_PROJECT_URL|; \ - s|%%CI_COMMIT_REF_NAME%%|$CI_COMMIT_REF_NAME|; \ - s|%%CI_PROJECT_NAMESPACE%%|$CI_PROJECT_NAMESPACE|; \ - s|%%PROTO_CURRENT%%|$PROTO_CURRENT|; s|%%PROTO_NEXT%%|$PROTO_NEXT|\" \ - scripts/packaging/Formula/octez.rb.template > \ - scripts/packaging/Formula/octez.rb"; - ] - [ - (* These packages are needed on Linux. For macOS, Homebrew will - make those available locally. *) - "apt install -y autoconf cmake libev-dev libffi-dev libgmp-dev \ - libprotobuf-dev libsqlite3-dev postgresql-dev protobuf-compiler \ - libhidapi-dev pkg-config zlib1g-dev"; - "brew install -v scripts/packaging/Formula/octez.rb"; - ] - |> enable_networked_cargo - let job_build_dynamic_binaries ?rules ~__POS__ ~arch ?(release = false) ?dependencies () = let arch_string = arch_to_string arch in diff --git a/ci/bin/debian_repository.ml b/ci/bin/debian_repository.ml index 53453daded31a700304a6e9a2b30fc81cc5d86fb..8d93f916e47394a7ebb62535e74712f4c6a3011d 100644 --- a/ci/bin/debian_repository.ml +++ b/ci/bin/debian_repository.ml @@ -67,7 +67,9 @@ let make_job_apt_repo ?rules ~__POS__ ~name ?(stage = Stages.publishing) ~name ~image ~before_script: - (before_script ~source_version:true ["./scripts/ci/prepare-apt-repo.sh"]) + (before_script + ~source_version:true + ["./scripts/ci/install-gsutil.sh"; "apt install -y apt-utils debsigs"]) ~variables script diff --git a/ci/bin/homebrew.ml b/ci/bin/homebrew.ml new file mode 100644 index 0000000000000000000000000000000000000000..e9df1caf9199d43ea758d2d3c45466b5d3e7366c --- /dev/null +++ b/ci/bin/homebrew.ml @@ -0,0 +1,80 @@ +(*****************************************************************************) +(* *) +(* SPDX-License-Identifier: MIT *) +(* Copyright (c) 2024 Nomadic Labs. *) +(* *) +(*****************************************************************************) + +open Tezos_ci +open Common + +type homebrew_pipeline = Full | Release + +let jobs pipeline_type : tezos_job list = + let image = Images.debian_bookworm in + let stage = Stages.build in + + (* this job creates a formula from a template + using the homebrew_release.sh script *) + let job_create_homebrew_formula : tezos_job = + job + ~__POS__ + ~name:"oc.build-homebrew" + ~arch:Amd64 + ~image + ~stage + [ + "./scripts/ci/install-gsutil.sh"; + "apt-get update && apt-get install -y git curl"; + "./scripts/packaging/homebrew_release.sh"; + ] + |> enable_networked_cargo + in + + (* this job tests if the formula created by job_create_homebrew_formula + can be compiled and installed *) + let job_build_homebrew_formula : tezos_job = + job + ~__POS__ + ~name:"oc.install-homebrew" + ~arch:Amd64 + ~image + ~stage + ~dependencies:(Dependent [Job job_create_homebrew_formula]) + ~before_script: + [ + "apt-get update && apt-get install -y git curl"; + "./scripts/packaging/homebrew_install.sh"; + "eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"; + ] + [ + (* These packages are needed on Linux. For macOS, Homebrew will + make those available locally. *) + "apt-get install -y autoconf cmake g++ libev-dev libffi-dev libgmp-dev \ + libprotobuf-dev libsqlite3-dev protobuf-compiler libhidapi-dev \ + pkg-config zlib1g-dev libpq-dev"; + "./scripts/packaging/test_homebrew_install.sh"; + ] + |> enable_networked_cargo + in + match pipeline_type with + | Release -> [job_create_homebrew_formula] + | Full -> [job_build_homebrew_formula; job_create_homebrew_formula] + +let jobs pipeline_type = job_datadog_pipeline_trace :: jobs pipeline_type + +let child_pipeline_full = + Pipeline.register_child + "homebrew" + ~description: + "A child pipeline of 'schedule_extended_test' testing the build of \ + homebrew packages." + ~jobs:(jobs Full) + +let child_pipeline_full_auto = + Pipeline.register_child + "homebrew_auto" + ~description: + "A child pipeline of 'schedule_extended_test' testing the homebrew \ + packaging. This pipelines starts automatically" + ~jobs:(jobs Full) diff --git a/ci/bin/release_tag.ml b/ci/bin/release_tag.ml index d379049115c54d3dc8d6089a6ae37b029c63e562..88ad7dc754b136482b2597f8303457be1a50f2c5 100644 --- a/ci/bin/release_tag.ml +++ b/ci/bin/release_tag.ml @@ -93,6 +93,30 @@ let octez_jobs ?(test = false) release_tag_pipeline_type = ~release:true () in + let job_build_homebrew_release = + let artifacts = + Gitlab_ci.Util.artifacts + ~expire_in:(Duration (Days 1)) + ~name:"build-$CI_COMMIT_REF_SLUG" + ~when_:On_success + ["public/homebrew/*"] + in + job + ~__POS__ + ~name:"oc.install-release-homebrew" + ~arch:Amd64 + ~dependencies:(Dependent []) + ~image:Images.debian_bookworm + ~stage:Stages.build + ~artifacts + [ + "./scripts/ci/install-gsutil.sh"; + "apt install -y git build-essential"; + "./scripts/packaging/homebrew_install.sh"; + "eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"; + "./scripts/packaging/homebrew_release.sh"; + ] + in let job_gitlab_release ~dependencies : Tezos_ci.tezos_job = job ~__POS__ @@ -144,6 +168,7 @@ let octez_jobs ?(test = false) release_tag_pipeline_type = [ Artifacts job_static_x86_64_release; Artifacts job_static_arm64_release; + Artifacts job_build_homebrew_release; Artifacts job_build_rpm_amd64; Artifacts job_build_ubuntu_package_current_a; Artifacts job_build_debian_package_current_a; @@ -180,6 +205,7 @@ let octez_jobs ?(test = false) release_tag_pipeline_type = job_docker_amd64; job_docker_arm64; job_build_rpm_amd64; + job_build_homebrew_release; job_docker_merge; job_gitlab_release_or_publish; ] diff --git a/scripts/ci/prepare-apt-repo.sh b/scripts/ci/install-gsutil.sh similarity index 84% rename from scripts/ci/prepare-apt-repo.sh rename to scripts/ci/install-gsutil.sh index e0dd56b45d1bc6d40e650d08425260c9bd9b2e5c..4dbd0e3dfc4a61fdbc90d2cea27ed692f5926be0 100755 --- a/scripts/ci/prepare-apt-repo.sh +++ b/scripts/ci/install-gsutil.sh @@ -1,11 +1,11 @@ #!/bin/sh -# Install depedendencies for the apt_repo job +# Install depedendencies to use gsutils export DEBIAN_FRONTEND=noninteractive apt-get update -apt-get install -y apt-utils debsigs gnupg curl +apt-get install -y gnupg curl # Install google-cloud-cli so we can upload packages to the Google Cloud Storage bucket. gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg \ diff --git a/scripts/packaging/homebrew_release.sh b/scripts/packaging/homebrew_release.sh new file mode 100755 index 0000000000000000000000000000000000000000..8ff2d48a15115471b45cd3bbb50c37b0a2143c8b --- /dev/null +++ b/scripts/packaging/homebrew_release.sh @@ -0,0 +1,98 @@ +#!/bin/sh +# + +# This script assumes that homebrew is correctly installed +# using the script ./scripts/packaging/homebrew_install.sh +# and creates a formula scripts/packaging/octez/homebrew/Formula/octez.rb +# that is ready to be installed with brew + +set -ue + +# If it's a protected branch the value of $bucket will +# be set accordingly but the CI. +BUCKET="$GCP_LINUX_PACKAGES_BUCKET" + +# set version + +. ./scripts/version.sh +. ./scripts/ci/octez-release.sh + +# fetch tags for releases +git fetch -q --tags + +if [ -n "${gitlab_release_no_v:-}" ]; then + VERSION=$gitlab_release_no_v +elif [ -n "${CI_COMMIT_TAG:-}" ]; then + VERSION=$(date +'%Y%m%d%H%M')+$CI_COMMIT_TAG +else + VERSION=$(date +'%Y%m%d%H%M')+$CI_COMMIT_SHORT_SHA +fi + +# prepare target dir + +if [ -n "${gitlab_release_no_v:-}" ]; then + # if it's a release tag, then it can be a RC release or a final release + if [ -n "${gitlab_release_rc_version}" ]; then + # Release candidate + TARGETDIR="public/homebrew/RC/Formula" + else + # Release + TARGETDIR="public/homebrew/Formula" + fi +else + if [ "$CI_COMMIT_REF_PROTECTED" = "false" ]; then + if [ "$CI_COMMIT_REF_NAME" = "RC" ]; then + echo "Cannot create a repository for a branch named 'RC'" + exit 1 + else + # Branch is not protected, this is for testing ordinary MRs + TARGETDIR="public/homebrew/$CI_COMMIT_REF_NAME/Formula" + fi + else + # For protected branches that are not release, we allow + # a repository only for master. + if [ "$CI_COMMIT_REF_NAME" = "master" ]; then + TARGETDIR="public/homebrew/master/Formula" + else + if [ -n "${CI_COMMIT_TAG:-}" ]; then + TARGETDIR="public/homebrew/${CI_COMMIT_TAG}/Formula" + else + echo "Cannot create a repository for a protected branch that is not associated to a tag or master" + exit 1 + fi + fi + fi +fi + +# prepare formula + +mkdir -p "$TARGETDIR" + +#shellcheck disable=SC2046 +eval $(scripts/active_protocols.sh) +sed "s|%%VERSION%%|$VERSION|; \ + s|%%CI_MERGE_REQUEST_SOURCE_PROJECT_URL%%|${CI_MERGE_REQUEST_SOURCE_PROJECT_URL:-$CI_PROJECT_URL}|; \ + s|%%CI_COMMIT_REF_NAME%%|${CI_COMMIT_REF_NAME:-master}|; \ + s|%%CI_PROJECT_NAMESPACE%%|$CI_PROJECT_NAMESPACE|; \ + s|%%PROTO_CURRENT%%|$PROTO_CURRENT|; s|%%PROTO_NEXT%%|$PROTO_NEXT|" \ + scripts/packaging/octez/homebrew/Formula/octez.rb.template > "$TARGETDIR/octez.rb" + +# upload to bucket + +if [ "$CI_COMMIT_REF_PROTECTED" = "true" ]; then + echo "### Logging into protected repo ..." + echo "${GCP_PROTECTED_SERVICE_ACCOUNT}" | base64 -d > protected_sa.json + gcloud auth activate-service-account --key-file=protected_sa.json +else + echo "### Logging into standard repo ..." + # Nothing to do +fi + +GOOGLE_OAUTH_ACCESS_TOKEN=$(gcloud auth print-access-token) +export GOOGLE_OAUTH_ACCESS_TOKEN + +echo "Push to $BUCKET" + +gsutil -m cp -r public/* gs://"${BUCKET}" + +echo "https://$BUCKET.storage.googleapis.com/${TARGETDIR##public/}/octez.rb" diff --git a/scripts/packaging/Formula/octez.rb.template b/scripts/packaging/octez/homebrew/Formula/octez.rb.template similarity index 87% rename from scripts/packaging/Formula/octez.rb.template rename to scripts/packaging/octez/homebrew/Formula/octez.rb.template index bab7c49f0143b902c5dfd69b527a9977bce5cdbc..2280af888e10093d20b86531465b2835c87c3403 100644 --- a/scripts/packaging/Formula/octez.rb.template +++ b/scripts/packaging/octez/homebrew/Formula/octez.rb.template @@ -15,12 +15,12 @@ class Octez < Formula version "%%VERSION%%" license "MIT" - build_dependencies = %w[pkg-config coreutils autoconf rsync wget opam protobuf rustup-init cmake] + build_dependencies = %w[pkg-config coreutils autoconf rsync wget opam protobuf cmake] build_dependencies.each do |dependency| depends_on dependency => :build end - dependencies = %w[gmp hidapi libev libffi] + dependencies = %w[gmp hidapi libev libffi libpq] dependencies.each do |dependency| depends_on dependency end @@ -40,7 +40,9 @@ class Octez < Formula set +x . ./scripts/version.sh - rustup-init --profile minimal --default-toolchain $recommended_rust_version -y + wget https://sh.rustup.rs/rustup-init.sh + chmod +x rustup-init.sh + ./rustup-init.sh --profile minimal --default-toolchain $recommended_rust_version -y opam init --bare --disable-sandboxing . $CARGO_HOME/env diff --git a/scripts/packaging/test_homebrew_install.sh b/scripts/packaging/test_homebrew_install.sh new file mode 100755 index 0000000000000000000000000000000000000000..261f7beef42f76e5e3286f647b6ca10bc7c46da9 --- /dev/null +++ b/scripts/packaging/test_homebrew_install.sh @@ -0,0 +1,62 @@ +#!/bin/sh +# + +set -ue + +# This script assumes that homebrew is correctly installed +# using the script ./scripts/packaging/homebrew_install.sh +# and creates a formula scripts/packaging/Formula/octez.rb +# that is ready to be installed with brew. + +# If it's a protected branch the value of $bucket will +# be set accordingly but the CI. +BUCKET="$GCP_LINUX_PACKAGES_BUCKET" + +# set version + +. scripts/version.sh +. scripts/ci/octez-release.sh + +# prepare target dir + +if [ -n "${gitlab_release_no_v:-}" ]; then + # if it's a release tag, then it can be a RC release or a final release + if [ -n "${gitlab_release_rc_version}" ]; then + # Release candidate + TARGETDIR="homebrew/RC/Formula" + else + # Release + TARGETDIR="homebrew/Formula" + fi +else + if [ "$CI_COMMIT_REF_PROTECTED" = "false" ]; then + if [ "$CI_COMMIT_REF_NAME" = "RC" ]; then + echo "Cannot create a repository for a branch named 'RC'" + exit 1 + else + # Branch is not protected, this is for testing ordinary MRs + TARGETDIR="homebrew/$CI_COMMIT_REF_NAME/Formula" + fi + else + # For protected branches that are not release, we allow + # a repository only for master. + if [ "$CI_COMMIT_REF_NAME" = "master" ]; then + TARGETDIR="homebrew/master/Formula" + else + if [ -n "${CI_COMMIT_TAG}" ]; then + TARGETDIR="homebrew/${CI_COMMIT_TAG}/Formula" + else + echo "Cannot create a repository for a protected branch that is not associated to a tag or master" + exit 1 + fi + fi + fi +fi + +echo "installing formula from https://$BUCKET.storage.googleapis.com/$TARGETDIR/octez.rb" + +# get around the fact that we cannot install a formula directly from https +curl -q "https://$BUCKET.storage.googleapis.com/$TARGETDIR/octez.rb" -O +brew install -v ./octez.rb + +octez-node --version