Skip to content

Add task to collect proto files and add steps to release them with tester, nightly and stable builds #1931

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Oct 25, 2022
9 changes: 9 additions & 0 deletions .github/workflows/publish-go-nightly-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,15 @@ jobs:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.DIST_DIR }}

- name: Install Task
uses: arduino/setup-task@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x

- name: Collect proto files
run: task protoc:collect

- name: Create checksum file
working-directory: ${{ env.DIST_DIR}}
run: |
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/publish-go-tester-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,39 @@ jobs:
path: ${{ env.DIST_DIR }}/${{ matrix.os.path }}
name: ${{ matrix.os.name }}

proto-files:
needs:
- package-name-prefix
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install Task
uses: arduino/setup-task@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x

- name: Collect proto files
run: |
PACKAGE_NAME_PREFIX=${{ needs.package-name-prefix.outputs.prefix }}
export PACKAGE_NAME_PREFIX
task protoc:collect

- name: Upload proto files zip
uses: actions/upload-artifact@v3
with:
path: ${{ env.DIST_DIR }}/*.zip
name: rpc-protocol-files

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you think about adding this as an additional step in the matrix of build job? It seems like almost all the steps are the same, we could avoid some code duplication.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's semantically correct, this job doesn't build anything in itself.
It also would require some changes to that job to make it more generic if we want to go toward that direction too.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't duplicate the code that way. There are some things that could be made in order to achieve that:

  • If we move the task protoc:collect to DistTask.yml the workflow do not require any big change.
  • another idea would be to simply rename the task as dist:protoc-collect
  • or maybe just move dist: in the matrix.os.task

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't DistTask.ymlshared in other projects too? I thought of putting it there but didn't cause of that.

Second and third might work but we'd still need to reword the build job and os matrix variable to be generic.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mhh yes, the DistTask.yaml is shared and probably better to not touch it... Second and third seems more approachable to me with the proper rewording

checksums:
needs:
- build
- proto-files
- package-name-prefix
runs-on: ubuntu-latest

Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/release-go-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,15 @@ jobs:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.DIST_DIR }}

- name: Install Task
uses: arduino/setup-task@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x

- name: Collect proto files
run: task protoc:collect

- name: Create checksum file
working-directory: ${{ env.DIST_DIR}}
run: |
Expand Down
7 changes: 7 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,13 @@ tasks:
cmds:
- buf lint rpc

protoc:collect:
desc: Create a zip file containing all .proto files in DIST_DIR
dir: rpc
cmds:
- mkdir ../{{.DIST_DIR}}
- zip -r ../{{.DIST_DIR}}/{{.PROJECT_NAME}}_{{.VERSION}}_proto.zip * -i \*.proto

protoc:format:
desc: Perform formatting of the protobuf definitions
cmds:
Expand Down