mirror of
https://github.com/PRQL/prql.git
synced 2026-03-29 09:07:06 +00:00
418 lines
13 KiB
YAML
418 lines
13 KiB
YAML
# This workflow runs on tags / releases. It also runs on nightly builds without
|
|
# publishing anything, in order to test as much of the build works as possible.
|
|
#
|
|
# We indicate whether it should publish, vs. just build, by checking whether
|
|
# `github.event_name == 'release'` . (An alternative would be to have an input
|
|
# which is passed in by the calling workflow.)
|
|
|
|
name: release
|
|
on:
|
|
release:
|
|
types: [released]
|
|
workflow_call:
|
|
workflow_dispatch:
|
|
|
|
# We need consistent env vars across all workflows for the cache to work
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
CLICOLOR_FORCE: 1
|
|
RUSTFLAGS: "-C debuginfo=0"
|
|
RUSTDOCFLAGS: "-Dwarnings"
|
|
|
|
jobs:
|
|
brew-dispatcher:
|
|
name: Release on homebrew-prql
|
|
runs-on: ubuntu-24.04
|
|
if: github.event_name == 'release'
|
|
steps:
|
|
- uses: actions/github-script@v8
|
|
with:
|
|
github-token: ${{ secrets.PRQL_BOT_GITHUB_TOKEN }}
|
|
script: |
|
|
await github.rest.actions.createWorkflowDispatch({
|
|
owner: 'prql',
|
|
repo: 'homebrew-prql',
|
|
workflow_id: 'update.yaml',
|
|
ref: 'main',
|
|
inputs: {
|
|
version: '${{ github.ref }}',
|
|
URL: 'https://github.com/PRQL/prql/archive/${{ github.ref }}.tar.gz'
|
|
}
|
|
})
|
|
|
|
build-prqlc:
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-24.04
|
|
target: x86_64-unknown-linux-musl
|
|
- os: ubuntu-24.04
|
|
target: aarch64-unknown-linux-musl
|
|
- os: macos-15
|
|
target: aarch64-apple-darwin
|
|
- os: windows-latest
|
|
target: x86_64-pc-windows-msvc
|
|
# Intel macOS build
|
|
- os: macos-15-intel
|
|
target: x86_64-apple-darwin
|
|
features: default,test-dbs
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: 📂 Checkout code
|
|
uses: actions/checkout@v5
|
|
- uses: ./.github/actions/build-prqlc
|
|
id: build-artifact
|
|
with:
|
|
target: ${{ matrix.target }}
|
|
profile: release
|
|
features: cli
|
|
- name: Upload release artifact
|
|
if: github.event_name == 'release'
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
append_body: true
|
|
files: ${{ steps.build-artifact.outputs.artifact-name }}
|
|
- name: test the CLI works
|
|
# TODO: Add for Windows too (but will require unzipping rather than
|
|
# un-taring)
|
|
#
|
|
# Currently filtering by x86, since that's the same as those not
|
|
# cross-compiled. But we'll have to refine this in the future.
|
|
if:
|
|
${{ contains(matrix.target, 'x86') && matrix.target !=
|
|
'x86_64-pc-windows-msvc' }}
|
|
run: |
|
|
# `prqlc` is an existing path at the root
|
|
mkdir -p temp_path
|
|
tar xzf ${{ steps.build-artifact.outputs.artifact-name }} -C temp_path
|
|
./temp_path/prqlc --help
|
|
|
|
build-prqlc-c:
|
|
# Mostly a copy/paste of `build-prqlc`.
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-24.04
|
|
target: x86_64-unknown-linux-musl
|
|
- os: ubuntu-24.04
|
|
target: aarch64-unknown-linux-musl
|
|
- os: macos-15
|
|
target: aarch64-apple-darwin
|
|
- os: windows-latest
|
|
target: x86_64-pc-windows-msvc
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: 📂 Checkout code
|
|
uses: actions/checkout@v5
|
|
- uses: ./.github/actions/build-prqlc-c
|
|
id: build-artifact
|
|
with:
|
|
target: ${{ matrix.target }}
|
|
profile: release
|
|
- name: Upload release artifact
|
|
if: github.event_name == 'release'
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
append_body: true
|
|
files: ${{ steps.build-artifact.outputs.artifact-name }}
|
|
|
|
publish-winget:
|
|
runs-on: ubuntu-24.04
|
|
needs: build-prqlc
|
|
if: github.event_name == 'release'
|
|
steps:
|
|
- name: publish
|
|
uses: vedantmgoyal2009/winget-releaser@v2
|
|
with:
|
|
identifier: PRQL.prqlc
|
|
version: ${{ github.ref_name }}
|
|
installers-regex: '^prqlc-.*-windows-.*\.zip$'
|
|
token: ${{ secrets.PRQL_BOT_GITHUB_TOKEN }}
|
|
fork-user: prql-bot
|
|
|
|
build-deb-package:
|
|
runs-on: ubuntu-24.04
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
target:
|
|
- x86_64-unknown-linux-musl
|
|
- aarch64-unknown-linux-musl
|
|
needs: build-prqlc
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- uses: actions/download-artifact@v6
|
|
with:
|
|
name: prqlc-${{ matrix.target }}-release
|
|
- name: Copy files into .deb package
|
|
run: |
|
|
tar -xf prqlc-*.tar.gz
|
|
mkdir -p .debpkg/usr/bin
|
|
mv prqlc .debpkg/usr/bin/prqlc
|
|
chmod +x .debpkg/usr/bin/prqlc
|
|
- name: Set arch variable
|
|
run: |
|
|
if [ "${{ matrix.target }}" == "aarch64-unknown-linux-musl" ]; then
|
|
echo "package_arch=arm64" >> "$GITHUB_ENV"
|
|
elif [ "${{ matrix.target }}" == "x86_64-unknown-linux-musl" ]; then
|
|
echo "package_arch=amd64" >> "$GITHUB_ENV"
|
|
else
|
|
echo "::error::Unknown architecture: ${{ matrix.target }}"
|
|
exit 1
|
|
fi
|
|
- name: 📦 Build .deb package
|
|
uses: jiro4989/build-deb-action@v4
|
|
with:
|
|
package: prqlc
|
|
package_root: .debpkg
|
|
maintainer: The PRQL Project
|
|
version: ${{ github.event_name == 'release' && github.ref_name || 0 }}
|
|
arch: ${{ env.package_arch }}
|
|
desc: >
|
|
prqlc is the CLI for the PRQL compiler. It compiles PRQL to SQL, and
|
|
offers various diagnostics.
|
|
|
|
PRQL is a modern language for transforming data — a simple,
|
|
powerful, pipelined SQL replacement.
|
|
- uses: actions/upload-artifact@v5
|
|
with:
|
|
name: deb-${{ matrix.target }}
|
|
path: ./*.deb
|
|
- name: Release
|
|
if: github.event_name == 'release'
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
files: prqlc_*.deb
|
|
|
|
build-rpm-package:
|
|
runs-on: ubuntu-24.04
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
target:
|
|
- x86_64-unknown-linux-musl
|
|
#- aarch64-unknown-linux-musl # https://github.com/jiro4989/build-rpm-action/issues/6
|
|
needs: build-prqlc
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- uses: actions/download-artifact@v6
|
|
with:
|
|
name: prqlc-${{ matrix.target }}-release
|
|
- name: Copy files into .rpm package
|
|
run: |
|
|
tar -xf prqlc-*.tar.gz
|
|
mkdir -p .rpmpkg/usr/bin
|
|
mv prqlc .rpmpkg/usr/bin/prqlc
|
|
chmod +x .rpmpkg/usr/bin/prqlc
|
|
- name: Set variables
|
|
run: |
|
|
if [ "${{ matrix.target }}" == "aarch64-unknown-linux-musl" ]; then
|
|
echo "package_arch=aarch64" >> "$GITHUB_ENV"
|
|
elif [ "${{ matrix.target }}" == "x86_64-unknown-linux-musl" ]; then
|
|
echo "package_arch=x86_64" >> "$GITHUB_ENV"
|
|
else
|
|
echo "::error::Unknown architecture: ${{ matrix.target }}"
|
|
fi
|
|
- name: 📦 Build .rpm package
|
|
uses: jiro4989/build-rpm-action@v2
|
|
with:
|
|
summary: CLI for PRQL, a modern language for transforming data
|
|
package: prqlc
|
|
package_root: .rpmpkg
|
|
maintainer: The PRQL Project
|
|
vendor: The PRQL Project
|
|
version: ${{ github.event_name == 'release' && github.ref_name || 0 }}
|
|
arch: ${{ env.package_arch }}
|
|
desc: >
|
|
prqlc is the CLI for the PRQL compiler. It compiles PRQL to SQL, and
|
|
offers various diagnostics.
|
|
|
|
PRQL is a modern language for transforming data — a simple,
|
|
powerful, pipelined SQL replacement.
|
|
license: Apache-2.0
|
|
- uses: actions/upload-artifact@v5
|
|
with:
|
|
name: artifact-rpm
|
|
path: |
|
|
./*.rpm
|
|
!./*-debuginfo-*.rpm
|
|
- run: rm prqlc-debuginfo-*.rpm
|
|
- name: Release
|
|
if: github.event_name == 'release'
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
files: prqlc-*.rpm
|
|
|
|
build-and-publish-snap:
|
|
runs-on: ubuntu-24.04
|
|
if: ${{ github.event_name == 'release' }}
|
|
steps:
|
|
- name: 📂 Checkout code
|
|
uses: actions/checkout@v5
|
|
- name: Move Snap to project root directory
|
|
run: cp -r prqlc/packages/snap/ .
|
|
- name: 📦 Build Snap
|
|
id: build
|
|
uses: snapcore/action-build@v1
|
|
- name: 🆙 Publish Snap
|
|
if: github.event_name == 'release'
|
|
uses: snapcore/action-publish@v1
|
|
env:
|
|
SNAPCRAFT_STORE_CREDENTIALS:
|
|
${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }}
|
|
with:
|
|
snap: ${{ steps.build.outputs.snap }}
|
|
release: stable
|
|
|
|
build-python-wheels:
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: true
|
|
matrix:
|
|
os: [ubuntu-24.04, windows-latest]
|
|
package:
|
|
- prqlc-python
|
|
target: [x86_64]
|
|
include:
|
|
# MacOS with universal builds
|
|
- os: macos-15
|
|
package: prqlc-python
|
|
target: universal2-apple-darwin
|
|
# Also produce more targets for ubuntu:
|
|
- os: ubuntu-24.04
|
|
package: prqlc-python
|
|
target: aarch64
|
|
- os: ubuntu-24.04
|
|
package: prqlc-python
|
|
target: source
|
|
steps:
|
|
- name: 📂 Checkout code
|
|
uses: actions/checkout@v5
|
|
- uses: ./.github/actions/build-python
|
|
with:
|
|
target: ${{ matrix.target }}
|
|
package: ${{ matrix.package }}
|
|
profile: release
|
|
|
|
publish-python:
|
|
runs-on: ubuntu-24.04
|
|
needs: [build-python-wheels]
|
|
if: github.event_name == 'release'
|
|
permissions:
|
|
id-token: write
|
|
strategy:
|
|
matrix:
|
|
package:
|
|
- prqlc-python
|
|
steps:
|
|
- uses: actions/download-artifact@v6
|
|
with:
|
|
# `*` covers target & OS
|
|
pattern: ${{ matrix.package }}-*-release
|
|
merge-multiple: true
|
|
- name: Publish to PyPI
|
|
uses: PyO3/maturin-action@v1
|
|
with:
|
|
command: upload
|
|
args: --skip-existing *
|
|
|
|
publish-js:
|
|
runs-on: ubuntu-24.04
|
|
permissions:
|
|
contents: read
|
|
id-token: write
|
|
steps:
|
|
- name: 📂 Checkout code
|
|
uses: actions/checkout@v5
|
|
- uses: baptiste0928/cargo-install@v3
|
|
with:
|
|
crate: wasm-pack
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
# Node 24+ includes npm 11.5.1+ required for OIDC trusted publishing
|
|
node-version: "24.x"
|
|
registry-url: "https://registry.npmjs.org"
|
|
|
|
- run: ./.github/workflows/scripts/set_version.sh
|
|
- name: 💰 Cache
|
|
uses: Swatinem/rust-cache@v2
|
|
with:
|
|
prefix-key: ${{ env.version }}-${{ hashFiles('./Cargo.lock') }}
|
|
# Share key with the `build-web` job
|
|
shared-key: web
|
|
save-if: false
|
|
|
|
# This is only required in order to have `cross-env` installed, since `npx
|
|
# cross-env` doesn't seem to work in CI (https://github.com/PRQL/prql/pull/3728)
|
|
- run: npm install
|
|
working-directory: prqlc/bindings/js/
|
|
|
|
- name: Publish to npm
|
|
run:
|
|
npm publish --provenance --access public ${{ (github.event_name !=
|
|
'release') && '--dry-run' || '' }}
|
|
working-directory: prqlc/bindings/js/
|
|
|
|
publish-to-cargo:
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- name: 📂 Checkout code
|
|
uses: actions/checkout@v5
|
|
- uses: baptiste0928/cargo-install@v3
|
|
with:
|
|
crate: cargo-release
|
|
# Currently, we can only check prqlc-parser which is not dependent other local crates with --dry-run.
|
|
# https://github.com/crate-ci/cargo-release/issues/691
|
|
# --no-verify is required to prevent build.
|
|
- run:
|
|
cargo release publish --no-confirm ${{ github.event_name == 'release'
|
|
&& '--execute' || '--no-verify --package prqlc-parser'}}
|
|
env:
|
|
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
|
|
|
# Requires another pass: https://github.com/PRQL/prql/issues/850
|
|
# publish-prql-java:
|
|
# runs-on: ubuntu-24.04
|
|
# steps:
|
|
# - name: Checkout code
|
|
# uses: actions/checkout@v5
|
|
# - name: Install Java and Maven
|
|
# uses: actions/setup-java@v3
|
|
# with:
|
|
# java-version: 8
|
|
# - name: Release Maven package
|
|
# uses: samuelmeuli/action-maven-publish@v1
|
|
# with:
|
|
# gpg_private_key: ${{ secrets.gpg_private_key }}
|
|
# gpg_passphrase: ${{ secrets.gpg_passphrase }}
|
|
# nexus_username: ${{ secrets.nexus_username }}
|
|
# nexus_password: ${{ secrets.nexus_password }}
|
|
# directory: prql-java/java/
|
|
|
|
push-web-branch:
|
|
runs-on: ubuntu-24.04
|
|
if: github.event_name == 'release'
|
|
steps:
|
|
- name: 📂 Checkout code
|
|
uses: actions/checkout@v5
|
|
with:
|
|
token: ${{ secrets.PRQL_BOT_GITHUB_TOKEN }}
|
|
- run: git push origin HEAD:web --force
|
|
|
|
push-devcontainer:
|
|
if: github.event_name == 'release'
|
|
uses: ./.github/workflows/build-devcontainer.yaml
|
|
secrets: inherit
|
|
with:
|
|
push: true
|