Skip to content

Commit

Permalink
Update release workflow with protoc and accurate versioning (#162)
Browse files Browse the repository at this point in the history
* remove score, algo and rules from crate

* remove useless struct

* 149 design a protobuf file for grpc (#152)

* Add gRPC dependencies

* Add a first version of the protobuf file and rust build script

* grpc: Add docs to the proto

* grpc: Fix hub connection response type

* grpc: Remove hub connection as it is done via http

* grpc: Add stream for update requests

* change protofile name in build script

* add prost-types and tokio-stream to deps

* gRPC: Send filelister output over the wire

* put prost_types back to the build deps

* grpc: Add FileInfoCreate procedure to proto

* Config: Add gRPC endpoint in default config

* grpc: Add first implementation of the gRPC client

* build: Update dependencies in Cargo.toml

Remove crossbeam-channel from Cargo.lock

* grpc(proto): Update file event message and response naming convention.

* grpc: switch to tokio::sync::mpsc

Allow conversion of channel to stream automatically

* grpc: pass by ref and remove crossbeam dep

* grpc: stage cargo.toml

* Remove comments and unecessary code

* error: rename `MyError` to `AgentError`

* fix: trim quotes from agent UUID

* hub: Add error management to Hub client code

---------

Co-authored-by: majent4 <[email protected]>

* Remove myfiles from repo (#156)

* myfiles: remove mod from repo

* remove unused dependencies

* Update Dockerfile

* Update Dockerfile

* Add moved event support support (#161)

* Add gRPC dependencies

* Add a first version of the protobuf file and rust build script

* grpc: Add docs to the proto

* grpc: Fix hub connection response type

* grpc: Remove hub connection as it is done via http

* grpc: Add stream for update requests

* change protofile name in build script

* add prost-types and tokio-stream to deps

* gRPC: Send filelister output over the wire

* put prost_types back to the build deps

* grpc: Add FileInfoCreate procedure to proto

* Config: Add gRPC endpoint in default config

* grpc: Add first implementation of the gRPC client

* build: Update dependencies in Cargo.toml

Remove crossbeam-channel from Cargo.lock

* grpc(proto): Update file event message and response naming convention.

* grpc: switch to tokio::sync::mpsc

Allow conversion of channel to stream automatically

* grpc: pass by ref and remove crossbeam dep

* grpc: stage cargo.toml

* Remove comments and unecessary code

* error: rename `MyError` to `AgentError`

* fix: trim quotes from agent UUID

* hub: Add error management to Hub client code

* Install protoc in Dockerfile

* hub(grpc): fix config

* hub(grpc): fix config and configuration file

* Merge origin/dev into 149-design-a-protobuf-file-for-grpc

* Fix imports due to bad merge

* grpc(proto): Add repeated field to path for moved event

* hub(grpc): Add support for moved events and majority of update events

* docker.json: use grpc port 8080

---------

Co-authored-by: majent4 <[email protected]>

* gh: download protoc in CI for tests

* gh: unzip protoc in authorized dest and add dest to path

* gha: add protoc to path for linux and macos

* gha: add protoc to path for linux and macos

* gha: add protoc to path for linux and macos

* gha: add protoc to path for linux and macos

* gha: add perms to path for linux and macos

* gha: debug

* gha: debug

* gha: debug

* gha: debug

* gha: debug

* gha: debug

* file_info: update tests

* tests: fix tests

* Implement tests error enum (#160)

* myfiles: remove mod from repo

* remove unused dependencies

* crate: cleaning crate

* Merge dev into branch

* final error handling

* rename uuid mod to agent_uuid

* cargo: restore bin for release pipeline

* cargo: bump h2 deps

* gh: install protoc for release

* gh: fix conditions in workflow jobs

* gh: download protoc before building

* gh: fix protoc release name download

* gh: upload file to release

* gh: release remove exess argument

* gh: fix bin release name

* gh: fix bin release name

* gh: fix bin release name

* gh: fix bin release name

* gh: fix bin release name

* gh: fix bin release name

* gh: fix bin release name

* gh: fix bin release name

* gh: fix bin release name

* gh: fix bin release name

* gh: fix bin release name

* gh: fix bin release name

* gh: fix bin release name

---------

Co-authored-by: majent4 <[email protected]>
  • Loading branch information
Cavonstavant and majent4 authored Jun 17, 2024
1 parent 95bc8d5 commit 4e3b2dc
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ env:

jobs:
build-and-push:
if: github.repository == 'tidybee/tidybee-agent' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest

permissions:
Expand Down
28 changes: 24 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ env:
LINUX_AMD64_TARGET: x86_64-unknown-linux-gnu
MACOS_TARGET: x86_64-apple-darwin
WINDOWS_TARGET: x86_64-pc-windows-msvc
PROTOC_VERSION: 27.1
PB_REL: https://github.com/protocolbuffers/protobuf/releases
PROTOC: protoc/bin/protoc

jobs:
build:
Expand All @@ -22,18 +25,29 @@ jobs:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
rust_channel: stable
protoc_release_name: linux-x86_64
- os: macos-latest
target: x86_64-apple-darwin
rust_channel: stable
protoc_release_name: osx-x86_64
- os: windows-latest
target: x86_64-pc-windows-msvc
rust_channel: stable
protoc_release_name: win64
steps:
- uses: actions/checkout@v4

- name: Install protoc from release
shell: bash
run: |
curl -LO ${{ env.PB_REL }}/download/v${{ env.PROTOC_VERSION }}/protoc-${{ env.PROTOC_VERSION }}-${{ matrix.protoc_release_name }}.zip
unzip protoc-${{ env.PROTOC_VERSION }}-${{ matrix.protoc_release_name }}.zip -d protoc
- uses: crusty-pie/toolchain@v1
with:
toolchain: ${{ matrix.rust_channel }}
targets: ${{ matrix.target }}

- uses: Swatinem/rust-cache@v2
- name: cargo build
env:
Expand Down Expand Up @@ -76,14 +90,20 @@ jobs:
path: ${{ env.ARTIFACT_DIR }}
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Rename binaries from latest to current version
run: |
cp ${{ env.ARTIFACT_DIR }}/${{ env.LINUX_AMD64_TARGET }}/${{ env.BIN_NAME }}-${{ github.ref_name }}-${{ env.LINUX_AMD64_TARGET }}/ubuntu-latest-${{ env.BIN_NAME }} ${{ env.ARTIFACT_DIR }}/${{ env.LINUX_AMD64_TARGET }}-$(echo ${{ github.ref_name }} | sed 's/v//; s/\./-/g')-${{ env.BIN_NAME }}
cp ${{ env.ARTIFACT_DIR }}/${{ env.MACOS_TARGET }}/${{ env.BIN_NAME }}-${{ github.ref_name }}-${{ env.MACOS_TARGET }}/macos-latest-${{ env.BIN_NAME }} ${{ env.ARTIFACT_DIR }}/${{ env.MACOS_TARGET }}-$(echo ${{ github.ref_name }} | sed 's/v//; s/\./-/g')-${{ env.BIN_NAME }}
cp ${{ env.ARTIFACT_DIR }}/${{ env.WINDOWS_TARGET }}/${{ env.BIN_NAME }}-${{ github.ref_name }}-${{ env.WINDOWS_TARGET }}/windows-latest-${{ env.BIN_NAME }}.exe ${{ env.ARTIFACT_DIR }}/${{ env.WINDOWS_TARGET }}-$(echo ${{ github.ref_name }} | sed 's/v//; s/\./-/g')-${{ env.BIN_NAME }}.exe
- name: Debug artifact directory
run: ls -lRa ${{ env.ARTIFACT_DIR }}

- name: Create a Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create ${{ github.ref_name }} \
${{ env.ARTIFACT_DIR }}/${{ env.LINUX_AMD64_TARGET }}/${{ env.BIN_NAME }}-${{ github.ref_name }}-${{ env.LINUX_AMD64_TARGET }}/ubuntu-latest-${{ env.BIN_NAME }} \
${{ env.ARTIFACT_DIR }}/${{ env.MACOS_TARGET }}/${{ env.BIN_NAME }}-${{ github.ref_name }}-${{ env.MACOS_TARGET }}/macos-latest-${{ env.BIN_NAME }} \
${{ env.ARTIFACT_DIR }}/${{ env.WINDOWS_TARGET }}/${{ env.BIN_NAME }}-${{ github.ref_name }}-${{ env.WINDOWS_TARGET }}/windows-latest-${{ env.BIN_NAME }}.exe --title ${{ github.ref_name }} --generate-notes
gh release upload ${{ github.ref_name }} \
${{ env.ARTIFACT_DIR }}/x86_64-unknown-linux-gnu-$(echo ${{ github.ref_name }} | sed 's/v//; s/\./-/g')-tidybee-agent \
${{ env.ARTIFACT_DIR }}/x86_64-apple-darwin-$(echo ${{ github.ref_name }} | sed 's/v//; s/\./-/g')-tidybee-agent \
${{ env.ARTIFACT_DIR }}/x86_64-pc-windows-msvc-$(echo ${{ github.ref_name }} | sed 's/v//; s/\./-/g')-tidybee-agent.exe
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,7 @@ ctor = "0.2.5"

[build-dependencies]
tonic-build = "0.11.0"

[[bin]]
name = "tidybee-agent"
path = "src/main.rs"

0 comments on commit 4e3b2dc

Please sign in to comment.