-
Notifications
You must be signed in to change notification settings - Fork 218
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: Build prqlc-clib
as artifacts
#4075
Merged
Merged
Changes from 11 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
da8477a
ci: Build `prqlc-clib` as artifacts
max-sixty b4aefe9
a762d48
95d49e3
aabdc9d
b9df845
cd5ea14
8ee1096
6e12a23
24e6aa2
25bb3be
43c9d07
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 contains 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,97 @@ | ||
name: build-prqlc-clib | ||
description: > | ||
A version of `build-prqlc` for the C bindings. | ||
|
||
Note that this is quite open to change, including names and which files we | ||
package. Contributions and/or suggestions are welcome. | ||
|
||
inputs: | ||
target: | ||
description: Build target | ||
required: true | ||
profile: | ||
description: Build profile option; `dev` or `release`. | ||
required: true | ||
features: | ||
description: Features to enable | ||
default: "" | ||
outputs: | ||
artifact-name: | ||
description: The name of the artifact | ||
value: ${{ steps.echo-artifact-name.outputs.artifact-name }} | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- run: rustup target add ${{ inputs.target }} | ||
shell: bash | ||
|
||
- run: ./.github/workflows/scripts/set_version.sh | ||
shell: bash | ||
|
||
- uses: Swatinem/rust-cache@v2 | ||
with: | ||
# Share cache with `test-rust`, except for `musl` targets. | ||
save-if: | ||
${{ (github.ref == 'refs/heads/main') && contains(inputs.target, | ||
'musl') }} | ||
shared-key: rust-${{ inputs.target }} | ||
prefix-key: ${{ env.version }} | ||
|
||
- if: runner.os == 'Linux' | ||
shell: bash | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y musl-tools | ||
|
||
- if: runner.os == 'Windows' && inputs.profile == 'release' | ||
shell: bash | ||
run: | | ||
echo 'RUSTFLAGS=-Ctarget-feature=+crt-static' >>"$GITHUB_ENV" | ||
|
||
- if: inputs.target == 'aarch64-unknown-linux-musl' | ||
shell: bash | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y gcc-aarch64-linux-gnu | ||
echo 'CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-gnu-gcc' >>"$GITHUB_ENV" | ||
echo 'CC=aarch64-linux-gnu-gcc' >>"$GITHUB_ENV" | ||
|
||
- name: cargo build | ||
uses: richb-hanover/cargo@v1.1.0 | ||
with: | ||
command: build | ||
args: | ||
--profile=${{ inputs.profile }} --locked --target=${{ inputs.target }} | ||
--features=${{ inputs.features }} ${{ contains(inputs.target, 'musl') | ||
&& '--package=prqlc-clib' || '--all-targets' }} | ||
|
||
- name: Create artifact for Linux and macOS | ||
shell: bash | ||
if: runner.os != 'Windows' | ||
run: | | ||
export ARTIFACT_NAME="prqlc_lib-v${{ github.ref_type == 'tag' && github.ref_name || 0 }}-${{ matrix.target }}.tar.gz" | ||
echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >>"$GITHUB_ENV" | ||
cd target/${{ matrix.target }}/${{ inputs.profile == 'release' && 'release' || 'debug' }} | ||
ls -al | ||
tar czf "../../../${ARTIFACT_NAME}" *prqlc_lib* | ||
|
||
- name: Create artifact for Windows | ||
shell: bash | ||
if: runner.os == 'Windows' | ||
run: | | ||
export ARTIFACT_NAME="prqlc_lib-v${{ github.ref_type == 'tag' && github.ref_name || 0 }}-${{ matrix.target }}.zip" | ||
echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >>"$GITHUB_ENV" | ||
cd target/${{ matrix.target }}/${{ inputs.profile == 'release' && 'release' || 'debug' }} | ||
ls -al | ||
7z a "../../../${ARTIFACT_NAME}" *prqlc_lib* | ||
|
||
- name: Upload prqlc-clib | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: prqlc_lib-${{ inputs.target }} | ||
path: ${{ env.ARTIFACT_NAME }} | ||
|
||
- id: echo-artifact-name | ||
shell: bash | ||
run: echo "artifact-name=${{ env.ARTIFACT_NAME }}" >>"$GITHUB_OUTPUT" |
This file contains 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 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 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
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.
@eitsupi do you know what we should have here? We had had it just be
cdylib
, but then nothing is built undermusl
. Are we OK to have both?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.
I don't know but maybe rust-lang/cargo#8607, rust-lang/rust#59302?
Maybe it's better to just build gnu for now?
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.
OK, I'll leave them both in for the moment, no harm in producing too much, and we can refine later.
We only have targets for
musl
forprqlc
so I won't make newgnu
ones unless we know there'll be a problem. But can move tognu
if anyone raises an issue...