From ea1cead51bcb581fe0d0b05a97b5891357fa83b2 Mon Sep 17 00:00:00 2001 From: Niklas van Schrick Date: Wed, 31 Jul 2024 22:13:14 +0200 Subject: [PATCH 01/18] Add workflow to validate built packages --- .github/workflows/build.yml | 43 +++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..5d026ee --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,43 @@ +name: Build packages + +on: + push: + +jobs: + rubygems: + runs-on: ubuntu-latest + + defaults: + run: + shell: bash + working-directory: build/ruby + + steps: + # Set up + - uses: actions/checkout@v4 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.2.2' + - name: Install gems + run: bundle install + - name: Generate ruby + run: bundle exec rake generate_ruby:all + - name: Run tests + run: bundle exec rspec + + crates: + runs-on: ubuntu-latest + + defaults: + run: + shell: bash + working-directory: build/rust + + steps: + # Set up + - uses: actions/checkout@v4 + - name: Setup rust + run: rustup update --no-self-update stable + - name: Build create + run: cargo package From b390c25419b2db3d062129c223280a5d44ad1c7f Mon Sep 17 00:00:00 2001 From: Niklas van Schrick Date: Wed, 31 Jul 2024 22:17:53 +0200 Subject: [PATCH 02/18] Add missing build command --- .github/workflows/build.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5d026ee..d822554 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,5 +39,7 @@ jobs: - uses: actions/checkout@v4 - name: Setup rust run: rustup update --no-self-update stable - - name: Build create + - name: Build crate + run: cargo build + - name: Package crate run: cargo package From f1d3be8695ac90c23e20b3a4cc88cf1fb5b42d41 Mon Sep 17 00:00:00 2001 From: Niklas van Schrick Date: Wed, 31 Jul 2024 22:20:09 +0200 Subject: [PATCH 03/18] Add install for protoc --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d822554..0f7298c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,6 +39,8 @@ jobs: - uses: actions/checkout@v4 - name: Setup rust run: rustup update --no-self-update stable + - name: Install protoc + run: apt-get update && apt-get install protobuf-compiler - name: Build crate run: cargo build - name: Package crate From 5d2dbe55983a13abd739101f786e27d70a4b5ceb Mon Sep 17 00:00:00 2001 From: Niklas van Schrick Date: Wed, 31 Jul 2024 22:21:15 +0200 Subject: [PATCH 04/18] Add install for protoc --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0f7298c..ffd883a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,7 +40,7 @@ jobs: - name: Setup rust run: rustup update --no-self-update stable - name: Install protoc - run: apt-get update && apt-get install protobuf-compiler + run: sudo apt-get update && sudo apt-get install protobuf-compiler -y - name: Build crate run: cargo build - name: Package crate From 07fd60cd45626c8547efbf24619da2c598eaecfd Mon Sep 17 00:00:00 2001 From: Niklas van Schrick Date: Wed, 31 Jul 2024 22:24:41 +0200 Subject: [PATCH 05/18] Add install for protoc --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ffd883a..2ac52db 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,7 +40,7 @@ jobs: - name: Setup rust run: rustup update --no-self-update stable - name: Install protoc - run: sudo apt-get update && sudo apt-get install protobuf-compiler -y + run: sudo apt-get update && sudo apt-get install protobuf-compiler -y && protoc --version - name: Build crate run: cargo build - name: Package crate From 9df71f7f25cf5dc6d3ed8aec9bb7b7d94c060864 Mon Sep 17 00:00:00 2001 From: Niklas van Schrick Date: Wed, 31 Jul 2024 22:33:43 +0200 Subject: [PATCH 06/18] Add install for protoc --- .github/workflows/build.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2ac52db..4b4f8c1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,8 +40,10 @@ jobs: - name: Setup rust run: rustup update --no-self-update stable - name: Install protoc - run: sudo apt-get update && sudo apt-get install protobuf-compiler -y && protoc --version + run: curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v28.0-rc1/protoc-28.0-linux-x86_64.zip && unzip protoc-28.0-linux-x86_64.zip -d /proto-bin && chmod +x /proto-bin/bin/protoc && /proto-bin/bin/protoc --version - name: Build crate run: cargo build + env: + PROTOC: /proto-bin/bin/protoc - name: Package crate run: cargo package From 1fa7cb1db0294f41e09336c653b16d1047b7cb1f Mon Sep 17 00:00:00 2001 From: Niklas van Schrick Date: Wed, 31 Jul 2024 22:34:23 +0200 Subject: [PATCH 07/18] Add install for protoc --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4b4f8c1..0766704 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,7 +40,7 @@ jobs: - name: Setup rust run: rustup update --no-self-update stable - name: Install protoc - run: curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v28.0-rc1/protoc-28.0-linux-x86_64.zip && unzip protoc-28.0-linux-x86_64.zip -d /proto-bin && chmod +x /proto-bin/bin/protoc && /proto-bin/bin/protoc --version + run: curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v28.0-rc1/protoc-28.0-rc-1-linux-x86_64.zip && unzip protoc-28.0-rc-1-linux-x86_64.zip -d /proto-bin && chmod +x /proto-bin/bin/protoc && /proto-bin/bin/protoc --version - name: Build crate run: cargo build env: From bedd834bac0ed089b24e602dc642386fa51537c5 Mon Sep 17 00:00:00 2001 From: Niklas van Schrick Date: Wed, 31 Jul 2024 22:36:25 +0200 Subject: [PATCH 08/18] Add install for protoc --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0766704..72dc9cc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,10 +40,10 @@ jobs: - name: Setup rust run: rustup update --no-self-update stable - name: Install protoc - run: curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v28.0-rc1/protoc-28.0-rc-1-linux-x86_64.zip && unzip protoc-28.0-rc-1-linux-x86_64.zip -d /proto-bin && chmod +x /proto-bin/bin/protoc && /proto-bin/bin/protoc --version + run: curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v28.0-rc1/protoc-28.0-rc-1-linux-x86_64.zip && unzip protoc-28.0-rc-1-linux-x86_64.zip -d ${{ runner.temp }}/proto && chmod +x ${{ runner.temp }}/proto/bin/protoc && ${{ runner.temp }}/proto/bin/protoc --version - name: Build crate run: cargo build env: - PROTOC: /proto-bin/bin/protoc + PROTOC: ${{ runner.temp }}/proto/bin/protoc - name: Package crate run: cargo package From e1e992a37c9f2d683377db75ee3c4f0b3e0d494a Mon Sep 17 00:00:00 2001 From: Niklas van Schrick Date: Wed, 31 Jul 2024 22:40:27 +0200 Subject: [PATCH 09/18] Add install for protoc --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 72dc9cc..9d982ac 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -45,5 +45,6 @@ jobs: run: cargo build env: PROTOC: ${{ runner.temp }}/proto/bin/protoc + RUST_BACKTRACE: '1' - name: Package crate run: cargo package From ff8fe19fd4e70b140b5ecae727b975672d14abe7 Mon Sep 17 00:00:00 2001 From: Niklas van Schrick Date: Wed, 31 Jul 2024 22:42:45 +0200 Subject: [PATCH 10/18] Add install for protoc --- .github/workflows/build.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9d982ac..459b52c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,9 +42,6 @@ jobs: - name: Install protoc run: curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v28.0-rc1/protoc-28.0-rc-1-linux-x86_64.zip && unzip protoc-28.0-rc-1-linux-x86_64.zip -d ${{ runner.temp }}/proto && chmod +x ${{ runner.temp }}/proto/bin/protoc && ${{ runner.temp }}/proto/bin/protoc --version - name: Build crate - run: cargo build - env: - PROTOC: ${{ runner.temp }}/proto/bin/protoc - RUST_BACKTRACE: '1' + run: PROTOC=${{ runner.temp }}/proto/bin/protoc cargo build - name: Package crate run: cargo package From 116556341efae75b9051ce27ffcab4e31e288a9a Mon Sep 17 00:00:00 2001 From: Niklas van Schrick Date: Wed, 31 Jul 2024 22:44:54 +0200 Subject: [PATCH 11/18] Add install for protoc --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 459b52c..488f750 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,6 +42,6 @@ jobs: - name: Install protoc run: curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v28.0-rc1/protoc-28.0-rc-1-linux-x86_64.zip && unzip protoc-28.0-rc-1-linux-x86_64.zip -d ${{ runner.temp }}/proto && chmod +x ${{ runner.temp }}/proto/bin/protoc && ${{ runner.temp }}/proto/bin/protoc --version - name: Build crate - run: PROTOC=${{ runner.temp }}/proto/bin/protoc cargo build + run: PATH=${{ runner.temp }}/proto/bin:$PATH cargo build - name: Package crate run: cargo package From 82a0bf2e57c233c863c721c1978c1398ea45e46e Mon Sep 17 00:00:00 2001 From: Niklas van Schrick Date: Wed, 31 Jul 2024 22:46:07 +0200 Subject: [PATCH 12/18] Add install for protoc --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 488f750..f7f9e71 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,5 +43,7 @@ jobs: run: curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v28.0-rc1/protoc-28.0-rc-1-linux-x86_64.zip && unzip protoc-28.0-rc-1-linux-x86_64.zip -d ${{ runner.temp }}/proto && chmod +x ${{ runner.temp }}/proto/bin/protoc && ${{ runner.temp }}/proto/bin/protoc --version - name: Build crate run: PATH=${{ runner.temp }}/proto/bin:$PATH cargo build + env: + RUST_BACKTRACE: 'full' - name: Package crate run: cargo package From 76c2e757ea2cbc6da739ac1109155c307c26f9d2 Mon Sep 17 00:00:00 2001 From: Raphael Date: Wed, 21 Aug 2024 17:44:59 +0200 Subject: [PATCH 13/18] fix: created out-folder if not exists --- build/rust/build.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/build/rust/build.rs b/build/rust/build.rs index f57e9ad..0316276 100644 --- a/build/rust/build.rs +++ b/build/rust/build.rs @@ -1,8 +1,16 @@ +use std::fs::create_dir; use std::io::Result; fn main() -> Result<()> { + + let path = "src/internal"; + + if !std::path::Path::new(&path).exists() { + create_dir(path)?; + } + tonic_build::configure() - .out_dir("src/internal") + .out_dir(path) .build_server(true) .build_client(true) .type_attribute("Variable", "#[derive(serde::Serialize, serde::Deserialize)]") From f43b8da0bd39a5054b516c040ebcfc01f7585717 Mon Sep 17 00:00:00 2001 From: Raphael Date: Wed, 21 Aug 2024 17:57:47 +0200 Subject: [PATCH 14/18] fix: added protoc configuration --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f7f9e71..fca4c99 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,6 +41,8 @@ jobs: run: rustup update --no-self-update stable - name: Install protoc run: curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v28.0-rc1/protoc-28.0-rc-1-linux-x86_64.zip && unzip protoc-28.0-rc-1-linux-x86_64.zip -d ${{ runner.temp }}/proto && chmod +x ${{ runner.temp }}/proto/bin/protoc && ${{ runner.temp }}/proto/bin/protoc --version + - name: Configure protoc + run: protoc --proto_path=internal --rust_out=src/internal - name: Build crate run: PATH=${{ runner.temp }}/proto/bin:$PATH cargo build env: From e47804e98ea1d7b1250b169da96941d899c9781f Mon Sep 17 00:00:00 2001 From: Raphael Date: Wed, 21 Aug 2024 18:02:24 +0200 Subject: [PATCH 15/18] fix: added protoc configuration --- .github/workflows/build.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fca4c99..f7f9e71 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,8 +41,6 @@ jobs: run: rustup update --no-self-update stable - name: Install protoc run: curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v28.0-rc1/protoc-28.0-rc-1-linux-x86_64.zip && unzip protoc-28.0-rc-1-linux-x86_64.zip -d ${{ runner.temp }}/proto && chmod +x ${{ runner.temp }}/proto/bin/protoc && ${{ runner.temp }}/proto/bin/protoc --version - - name: Configure protoc - run: protoc --proto_path=internal --rust_out=src/internal - name: Build crate run: PATH=${{ runner.temp }}/proto/bin:$PATH cargo build env: From 6e7e0db00fb896831390d0b4db5c149617e633d7 Mon Sep 17 00:00:00 2001 From: Raphael Date: Wed, 21 Aug 2024 18:03:52 +0200 Subject: [PATCH 16/18] fix: added cargo package configuration --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f7f9e71..618d557 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -46,4 +46,4 @@ jobs: env: RUST_BACKTRACE: 'full' - name: Package crate - run: cargo package + run: cargo package --allow-dirty From 8839ccd429035e282b548e18978be2497af2a43d Mon Sep 17 00:00:00 2001 From: Raphael Date: Wed, 21 Aug 2024 18:39:51 +0200 Subject: [PATCH 17/18] feat: added publishing steps --- .github/workflows/publish.yml | 27 +++++++++++++++++++++++++++ build/rust/Cargo.lock | 2 +- build/rust/Cargo.toml | 2 +- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ae64016..e57a961 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -39,3 +39,30 @@ jobs: run: bundle exec rake release:rubygem_push - name: Wait for release run: gem exec rubygems-await pkg/*.gem + crates: + runs-on: ubuntu-latest + + environment: packages + + defaults: + run: + shell: bash + working-directory: build/rust + + steps: + # Set up + - uses: actions/checkout@v4 + - name: Setup rust + run: rustup update --no-self-update stable + - name: Install protoc + run: curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v28.0-rc1/protoc-28.0-rc-1-linux-x86_64.zip && unzip protoc-28.0-rc-1-linux-x86_64.zip -d ${{ runner.temp }}/proto && chmod +x ${{ runner.temp }}/proto/bin/protoc && ${{ runner.temp }}/proto/bin/protoc --version + - name: Set version + run: sed -i "s/version = \"0.0.0\"/version = \"${{ github.ref_name }}\"/" Cargo.toml + - name: Cargo Login + run: cargo login ${{secrets.CARGO_REGISTRY_TOKEN}} + + # Release + - name: Publish crate + run: PATH=${{ runner.temp }}/proto/bin:$PATH cargo publish --allow-dirty + env: + RUST_BACKTRACE: 'full' \ No newline at end of file diff --git a/build/rust/Cargo.lock b/build/rust/Cargo.lock index ee7efc6..baa9c6a 100644 --- a/build/rust/Cargo.lock +++ b/build/rust/Cargo.lock @@ -1055,7 +1055,7 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "tucana-internal" -version = "0.0.1" +version = "0.0.0" dependencies = [ "prost", "prost-serde-derive", diff --git a/build/rust/Cargo.toml b/build/rust/Cargo.toml index b9080be..39cf4fc 100644 --- a/build/rust/Cargo.toml +++ b/build/rust/Cargo.toml @@ -1,5 +1,5 @@ [package] -version = "0.0.1" +version = "0.0.0" name = "tucana-internal" edition = "2021" description = "The rust crate for the internal gRPC communication of Code0" From 66445b575bb44c61c1a6955f872623dc3d95075f Mon Sep 17 00:00:00 2001 From: Raphael Date: Wed, 21 Aug 2024 19:38:36 +0200 Subject: [PATCH 18/18] fix: added build step --- .github/workflows/publish.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e57a961..cb564df 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -60,9 +60,11 @@ jobs: run: sed -i "s/version = \"0.0.0\"/version = \"${{ github.ref_name }}\"/" Cargo.toml - name: Cargo Login run: cargo login ${{secrets.CARGO_REGISTRY_TOKEN}} + - name: Build crate + run: PATH=${{ runner.temp }}/proto/bin:$PATH cargo build + env: + RUST_BACKTRACE: 'full' # Release - name: Publish crate - run: PATH=${{ runner.temp }}/proto/bin:$PATH cargo publish --allow-dirty - env: - RUST_BACKTRACE: 'full' \ No newline at end of file + run: cargo publish --allow-dirty