Skip to content
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

CI: add release workflow for building binaries #260

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

daywalker90
Copy link
Contributor

This PR adds a workflow to create a release with release binaries.

It cross compiles for:

  • x86_64-unknown-linux-gnu
  • aarch64-unknown-linux-gnu
  • armv7-unknown-linux-gnueabihf

using cross and only requires glibc >= 2.31.

I packaged teosd and teos-cli together while watchtower-client is in an extra archive.

For better cross compatibility i removed the dependency to the system specific openssl and replaced it with rustls-tls.

For this job to trigger you have to push an annotated tag. It will only trigger on tags that represent final releases.

This project does not have a CHANGELOG.md so i commented in two methods on how to provide the content body for the release:

  • either create a CHANGELOG.md that adheres to the formatting of keepachangelog
  • or use the message from the annotated tag (can also be a file with -F)

You can of course also just edit the release body manually on the website but then it won't show in the notification email that is send to users.

Copy link
Collaborator

@mariocynicys mariocynicys left a comment

Choose a reason for hiding this comment

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

Gave this a quick review. Will have to test it thoroughly in a fork.

.github/workflows/release.yml Outdated Show resolved Hide resolved
Comment on lines +30 to +28
cross build --release --locked --target x86_64-unknown-linux-gnu
cross build --release --locked --target armv7-unknown-linux-gnueabihf
cross build --release --locked --target aarch64-unknown-linux-gnu
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we add macos & windows as well?, if possible.

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 tried with macos but gave up sorry.

Copy link
Member

Choose a reason for hiding this comment

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

I'm happy to take a look at this. How were you testing it?

Comment on lines 33 to 38
tar -czf "teos-${{github.ref_name}}-aarch64-linux-gnu.tar.gz" --transform 's|.*/||' "target/aarch64-unknown-linux-gnu/release/teosd" "target/aarch64-unknown-linux-gnu/release/teos-cli"
tar -czf "teos-${{github.ref_name}}-armv7-linux-gnueabihf.tar.gz" --transform 's|.*/||' "target/armv7-unknown-linux-gnueabihf/release/teosd" "target/armv7-unknown-linux-gnueabihf/release/teos-cli"
tar -czf "teos-${{github.ref_name}}-x86_64-linux-gnu.tar.gz" --transform 's|.*/||' "target/x86_64-unknown-linux-gnu/release/teosd" "target/x86_64-unknown-linux-gnu/release/teos-cli"
tar -czf "watchtower-client-${{github.ref_name}}-aarch64-linux-gnu.tar.gz" --transform 's|.*/||' "target/aarch64-unknown-linux-gnu/release/watchtower-client"
tar -czf "watchtower-client-${{github.ref_name}}-armv7-linux-gnueabihf.tar.gz" --transform 's|.*/||' "target/armv7-unknown-linux-gnueabihf/release/watchtower-client"
tar -czf "watchtower-client-${{github.ref_name}}-x86_64-linux-gnu.tar.gz" --transform 's|.*/||' "target/x86_64-unknown-linux-gnu/release/watchtower-client"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's split this part into its own step for a little bit more readability.

Also, what do you think about removing the gnu & gnueabihf endings?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Personally i don't care about these. I removed them.

@daywalker90 daywalker90 force-pushed the release-ci branch 6 times, most recently from 38eef37 to 6972d03 Compare June 30, 2024 14:43
@@ -16,7 +16,7 @@ path = "src/main.rs"
backoff = { version = "0.4.0", features = ["tokio"] }
hex = { version = "0.4.3", features = [ "serde" ] }
home = "0.5.3"
reqwest = { version = "0.11", features = [ "blocking", "json", "socks" ] }
reqwest = { version = "0.11", default-features = false, features = [ "blocking", "json", "socks", "rustls-tls" ] }
Copy link
Member

Choose a reason for hiding this comment

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

Why is rustls-tls required now?

Comment on lines +67 to +80
# - name: Get Changelog Entry
# id: changelog_reader
# uses: mindsers/changelog-reader-action@v2
# with:
# version: ${{ steps.tag_name.outputs.current_version }}
# path: ./CHANGELOG.md

# - name: Get tag message
# id: get_tag_message
# run: |
# TAG_NAME=$(echo "${GITHUB_REF}" | sed 's/refs\/tags\///')
# TAG_MESSAGE=$(git for-each-ref --format='%(contents)' "refs/tags/${TAG_NAME}")
# echo "tag_name=${TAG_NAME}" >> "$GITHUB_OUTPUT"
# echo "tag_message=${TAG_MESSAGE}" >> "$GITHUB_OUTPUT"
Copy link
Member

Choose a reason for hiding this comment

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

This can be cleaned

Comment on lines +92 to +93
# body: "${{ steps.changelog_reader.outputs.changes }} \n\n### Release binaries info\n\n- Release binaries were built using rust ${{ needs.build.outputs.rust-version }}\n- Linux release binaries require glibc>=2.31"
# body: "${{ steps.get_tag_message.outputs.tag_message }} \n\n### Release binaries info\n\n- Release binaries were built using rust ${{ needs.build.outputs.rust-version }}\n- Linux release binaries require glibc>=2.31"
Copy link
Member

Choose a reason for hiding this comment

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

This ca be cleaned

Comment on lines +30 to +28
cross build --release --locked --target x86_64-unknown-linux-gnu
cross build --release --locked --target armv7-unknown-linux-gnueabihf
cross build --release --locked --target aarch64-unknown-linux-gnu
Copy link
Member

Choose a reason for hiding this comment

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

I'm happy to take a look at this. How were you testing it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants