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: build prqlc on PRs #2568

Merged
merged 14 commits into from
May 15, 2023
51 changes: 51 additions & 0 deletions .github/actions/build-prqlc/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: build-prqlc
description: >
Build prqlc
inputs:
target:
description: Build target
required: true
cross:
description: Use cross?
required: false
default: "false"

runs:
using: composite
steps:
- run: rustup target add ${{ inputs.target }}
shell: bash

- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
prefix-key: 0.8.1
eitsupi marked this conversation as resolved.
Show resolved Hide resolved

- if: runner.os == 'Linux'
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y musl-tools

- name: cargo build
uses: richb-hanover/cargo@v1.1.0
with:
command: build
use-cross: inputs.cross == 'true'
args: --package prqlc --release --locked --target=${{ inputs.target }}

- if: runner.os == 'Windows'
shell: powershell
run: echo "BIN_NAME=prqlc.exe" >>"$env:GITHUB_ENV"

- if: runner.os != 'Windows'
shell: bash
run: |
echo "BIN_NAME=prqlc" >>"$GITHUB_ENV"
chmod +x target/${{ inputs.target }}/release/prqlc
eitsupi marked this conversation as resolved.
Show resolved Hide resolved

- name: Upload prqlc
uses: actions/upload-artifact@v3
with:
name: prqlc-${{ inputs.target }}
path: target/${{ inputs.target }}/release/${{ env.BIN_NAME }}
eitsupi marked this conversation as resolved.
Show resolved Hide resolved
20 changes: 20 additions & 0 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,23 @@ jobs:
allowed-failures: check-links
allowed-skips: test-all, publish-web, nightly
jobs: ${{ toJSON(needs) }}

build-prqlc:
Copy link
Member

Choose a reason for hiding this comment

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

Before merging, I think probably we have this in test-all rather than pull-request — or are there times it would fail on new code that we'd want to know about?

Copy link
Member Author

Choose a reason for hiding this comment

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

My idea was to provide an easy way to try out features added by pull requests.
For example, I believe duckdb builds and uploads duckdb CLI executables with every pull request.

Copy link
Member

Choose a reason for hiding this comment

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

OK great, we can try it.

I do notice our CI queue filling up occasionally, and this would almost double the number of jobs. So if it becomes an issue we could always add a pr-build-artifacts label and run it based on that.

Definitely fine to try, I agree that would be a nice thing to have access to.

runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
- os: macos-latest
target: x86_64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc
steps:
- name: 📂 Checkout code
uses: actions/checkout@v3
- uses: ./.github/actions/build-prqlc
with:
target: ${{ matrix.target }}
cross: ${{ matrix.cross || '' }}