-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Build and Publish refactor #8
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
Open
Mqxx
wants to merge
44
commits into
main
Choose a base branch
from
jsr-publish
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
01f0070
feat: refactor, added documentation
Mqxx 012a18d
fix: refactor build and publish workflows
Mqxx 2df8bee
Update publish_jsr.yml
Mqxx e0f10fc
fix: renamed worflow files
Mqxx 33c2765
fix: publish on separate branch
Mqxx af332b7
feat: Also publish jsr.json
Mqxx 59810ec
feat: Refactor
Mqxx f2c0c36
Update build_binary.yml
Mqxx 09d971e
Update build_binary.yml
Mqxx e43bf63
Update build_binary.yml
Mqxx e0c3d52
Update jsr.json.in
Mqxx 25972c3
Update build_binary.yml
Mqxx 4be407f
Update jsr.json.in
Mqxx df84c17
Update build_binary.yml
Mqxx b2d24cf
Update embed_binary.sh
Mqxx ad68ba2
Update embed_binary.sh
Mqxx ac43fe2
Update publish_jsr.yml
Mqxx d002eac
Update embed_binary.sh
Mqxx 6a2c112
fix: use sh instead of txt and source it
Mqxx a089bc0
fix: env
Mqxx a298763
Update publish_jsr.yml
Mqxx 0d82a0d
Update build_binary.yml
Mqxx 59f8213
fix: renamed
Mqxx 3712b9b
Update publish_jsr.yml
Mqxx 2fcc0f6
fix: refactor varaible naming
Mqxx 0e3be99
fix: Permissions
Mqxx 7f3405c
fix: Permissions
Mqxx e4c0e89
feat: Changed version generation
Mqxx 94007b2
Update build_binary.yml
Mqxx 7a543cb
Update build_binary.yml
Mqxx 18611ae
Update build_binary.yml
Mqxx a88b9c2
Update build_binary.yml
Mqxx 0b6ab38
Update build_binary.yml
Mqxx 9c5a34c
Update CMakeLists.txt
Mqxx 2e600e6
Update build_binary.yml
Mqxx dc7575c
Update build_binary.yml
Mqxx c2ea7a8
Update build_binary.yml
Mqxx 796eb21
Update build_binary.yml
Mqxx 48a4cdf
Update CMakeLists.txt
Mqxx 20a1ee7
Update build_binary.yml
Mqxx 57e78a6
Update build_binary.yml
Mqxx 503fe12
Update publish_jsr.yml
Mqxx 27a8407
Update publish_jsr.yml
Mqxx 328b1cf
Update jsr.json
Mqxx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| name: 'Build Binary' | ||
| description: | | ||
| This workflow builds the binary files for Linux. The build binaries are stored as artifact | ||
| and may be reused by other workflows. | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main ] | ||
|
|
||
| pull_request: {} | ||
|
|
||
| jobs: | ||
| build-binary: | ||
| name: 'Build Binary' | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: 'Checkout repository' | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Set up GCC | ||
| uses: egor-tensin/setup-gcc@v2 | ||
| with: | ||
| version: '14' | ||
| platform: 'x64' | ||
|
|
||
| - name: 'Setup CMake' | ||
| uses: jwlawson/actions-setup-cmake@v2 | ||
| with: | ||
| cmake-version: '3.31.x' | ||
|
|
||
| - name: 'Configure CMake' | ||
| env: | ||
| CXX: g++ | ||
|
|
||
| run: | | ||
| cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release | ||
|
|
||
| - name: 'Build' | ||
| id: 'build' | ||
| run: | | ||
| cmake --build build --config Release | ||
|
|
||
| . build/env.sh | ||
| echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: 'Upload artifacts' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: libcpp_bindings_linux_x86_64 | ||
| path: build/libcpp_bindings_linux.so* | ||
|
|
||
| outputs: | ||
| version: ${{ steps.build.outputs.VERSION }} | ||
|
|
||
| trigger-publish: | ||
| name: 'Trigger Publish' | ||
| needs: ['build-binary'] | ||
| uses: ./.github/workflows/publish_jsr.yml | ||
| with: | ||
| publish: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | ||
| version: ${{ needs.build-binary.outputs.version }} | ||
| artifact-name: libcpp_bindings_linux_x86_64 | ||
|
|
||
| permissions: | ||
| contents: read | ||
| id-token: write |
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| name: 'Publish JSR' | ||
| description: | | ||
| This workflow serializes the build binary to Base64 and generates a JSON file with meta data about the file. | ||
| The file then gets published to JSR (@serial/cpp-bindings-linux). | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| publish: | ||
| description: 'Whether to actually publish' | ||
| required: true | ||
| type: boolean | ||
|
|
||
| version: | ||
| description: 'Package version' | ||
| required: true | ||
| type: string | ||
|
|
||
| artifact-name: | ||
| description: 'Name of the artifact' | ||
| required: true | ||
| type: string | ||
|
|
||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
|
|
||
| jobs: | ||
| publish-jsr: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: 'Checkout repository' | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: 'Setup Deno' | ||
| uses: denoland/setup-deno@v2 | ||
| with: | ||
| deno-version: '2.x' | ||
|
|
||
| - name: 'Download artifact' | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: ${{ inputs.artifact-name }} | ||
| path: 'artifacts' | ||
|
|
||
| - name: 'Prepare files for JSR' | ||
| run: | | ||
| mkdir -p ./jsr/bin | ||
|
|
||
| cp ./artifacts/libcpp_bindings_linux.so ./jsr/bin/x86_64.so | ||
|
|
||
| ./jsr/scripts/set_version.sh jsr/jsr.json "${{ inputs.version }}" | ||
|
|
||
| ./jsr/scripts/binary_to_json.sh \ | ||
| ./artifacts/libcpp_bindings_linux.so \ | ||
| ./jsr/bin/x86_64.json \ | ||
| linux-x86_64 | ||
|
|
||
| - name: 'Publish package to JSR (normal)' | ||
| if: inputs.publish | ||
| working-directory: jsr | ||
| run: | | ||
| deno publish --allow-dirty | ||
|
|
||
| - name: 'Publish package to JSR (dry-run)' | ||
| if: ${{ !inputs.publish }} | ||
| working-directory: jsr | ||
| run: | | ||
| deno publish --allow-dirty --dry-run | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| bin/ | ||
| !src/bin/ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wird die jsr.json nicht mehr gebraucht?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope. That's what the version.txt gets generated for. The JSR.json.in still exists in the repository and get's replaced during the publishing.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a script or readme on how to publish something (locally)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do. 👍🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently the entire publishing is done using the CI. I am not sure if a "guide on how to publish locally" will be useful? Is there a specific reason why we should allow publishing an package locally? I we allow publishing packages locally, then I would need to rewrite some of the publishing steps to be sh files (that's not the problem, question is if it is even reasonable...?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not, there is a option --dry-run, so why not let devs test locally before they push to upstream?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
testing in CI is a pain, and people cant push anyways without a token on local setups, but let them at least test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. I will refactor it so that you are able to publish dry locally