Skip to content

Commit

Permalink
Merge commit 'ef064e1a8c2de7e8340f7080169367f539e62a8c' into support-…
Browse files Browse the repository at this point in the history
…old-rust
  • Loading branch information
eitsupi committed Mar 15, 2023
2 parents 771004e + ef064e1 commit b9daa54
Show file tree
Hide file tree
Showing 771 changed files with 11,652 additions and 7,955 deletions.
7 changes: 0 additions & 7 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,2 @@
[target.wasm32-unknown-unknown]
runner = 'wasm-bindgen-test-runner'

[target.'cfg(target_os = "macos")']
# Required for prql-elixir on Mac
rustflags = [
"-C", "link-arg=-undefined",
"-C", "link-arg=dynamic_lookup",
]
15 changes: 15 additions & 0 deletions .devcontainer/base-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM mcr.microsoft.com/devcontainers/rust:0.203.8-1-bullseye

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
cmake \
&& rm -rf /var/lib/apt/lists/* \
&& sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin

# ========= Install cargo-tools for non-root user (vscode) =========
COPY Taskfile.cargo-tools.yml /tmp/Taskfile.cargo-tools.yml
WORKDIR /tmp
USER vscode
RUN task -t Taskfile.cargo-tools.yml install

USER root
33 changes: 33 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Dev Container for Rust, website, prql-js and prql-python
{
"image": "ghcr.io/prql/prql-devcontainer-base:latest",
"features": {
"ghcr.io/devcontainers/features/hugo:1": {},
"ghcr.io/devcontainers/features/python:1": {},
"ghcr.io/devcontainers/features/node:1": {},
"ghcr.io/eitsupi/devcontainer-features/go-task:1": {}
},
"customizations": {
"vscode": {
"extensions": [
// Keep in sync with Taskfile.yml
"prql-lang.prql-vscode",
"rust-lang.rust-analyzer",
"mitsuhiko.insta",
"esbenp.prettier-vscode",
"budparr.language-hugo-vscode"
]
}
},
"mounts": [
{
"source": "devcontainer-cargo-cache",
"target": "/usr/local/cargo",
"type": "volume"
}
],
"postCreateCommand": {
"install-maturin": "task install-maturin",
"install-npm-dependencies": "task install-npm-dependencies"
}
}
62 changes: 62 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: 🐛 Bug report
description: File a bug report to help us improve
labels: [bug]
body:
- type: textarea
id: what-happened
attributes:
label: What happened?
description: |
Thanks for reporting a bug! Feel free to add any initial context here.
- type: textarea
id: prql-input
attributes:
label: PRQL input
description: |
A minimal, self-contained example that demonstrates the issue.
This will be automatically formatted into code, so no need for markdown backticks.
render: elm
validations:
required: true

- type: textarea
id: output
attributes:
label: SQL output
description: |
The SQL that PRQL currently compiles to. Feel free to use the [playground](https://prql-lang.org/playground/) to generate the SQL.
This will be automatically formatted into code, so no need for markdown backticks.
render: SQL
validations:
required: true

- type: textarea
id: expected-output
attributes:
label: Expected SQL output

description:
Optional; no need to write out if it's obvious from the context
render: SQL

- type: checkboxes
id: mvce-checkboxes
attributes:
label: MVCE confirmation
description: |
Please confirm that the bug report is minimal and doesn't exist already:
- **Minimal example** — the example is as focused as reasonably possible to demonstrate the underlying issue in PRQL. For example, it's not possible to exclude any line and still observe the bug.
- **New issue** — a search of GitHub Issues suggests this is not a duplicate.
options:
- label: Minimal example
- label: New issue

- type: textarea
id: extra
attributes:
label: Anything else?
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: true
7 changes: 7 additions & 0 deletions .github/ISSUE_TEMPLATE/something_else.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: Something else
description: Anything that's not a bug report
body:
- type: textarea
id: what-happened
attributes:
label: What's up?
7 changes: 3 additions & 4 deletions .github/actions/build-prql-js/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ description: ""
runs:
using: composite
steps:
- name: Install wasm-pack
uses: jetli/wasm-pack-action@v0.4.0
- uses: baptiste0928/cargo-install@next
with:
version: "latest"
crate: wasm-pack

- name: Setup Node
uses: actions/setup-node@v3
Expand All @@ -20,4 +19,4 @@ runs:
- name: Run wasm-pack for node, bundler, & web
run: npm run build
shell: bash
working-directory: prql-js/
working-directory: bindings/prql-js/
7 changes: 4 additions & 3 deletions .github/actions/build-prql-python/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,23 @@ runs:
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
key: python
- uses: messense/maturin-action@v1
if: runner.os == 'Linux'
with:
manylinux: auto
command: build
args: --release -o dist -m prql-python/Cargo.toml
args: --release -o dist -m bindings/prql-python/Cargo.toml
- uses: messense/maturin-action@v1
if: runner.os == 'Windows'
with:
command: build
args: --release -o dist -m prql-python/Cargo.toml
args: --release -o dist -m bindings/prql-python/Cargo.toml
- uses: messense/maturin-action@v1
if: runner.os == 'macOS'
with:
command: build
args: --release -o dist --universal2 -m prql-python/Cargo.toml
args: --release -o dist --universal2 -m bindings/prql-python/Cargo.toml
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
Expand Down
20 changes: 19 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ updates:
prefix: "chore: "

- package-ecosystem: "npm"
directory: "/playground"
directory: "/bindings/prql-js"
schedule:
interval: daily
ignore:
Expand All @@ -29,6 +29,24 @@ updates:
commit-message:
prefix: "chore: "

- package-ecosystem: "npm"
directory: "/web/playground"
schedule:
interval: daily
ignore:
- dependency-name: "*"
update-types:
- version-update:semver-patch
commit-message:
prefix: "chore: "

- package-ecosystem: docker
directory: .devcontainer/base-image
schedule:
interval: daily
commit-message:
prefix: "chore: "

# For actions (rather than workflows), we need to list each directory, ref
# https://github.com/dependabot/dependabot-core/issues/5137, from https://github.com/dependabot/dependabot-core/issues/4178#issuecomment-1118492006
- directory: ".github/actions/build-prql-js"
Expand Down
67 changes: 67 additions & 0 deletions .github/workflows/devcontainer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: devcontainer

on:
# TODO: adopt our standard hierarchy for these, as per
# https://github.com/PRQL/prql/pull/1893#discussion_r1125736478, possibly only
# publishing on releases or on the `web` branch (which possibly should be
# renamed back to `stable` if we use it more for this)
push:
paths:
- .devcontainer/base-image/Dockerfile
- Taskfile.cargo-tools.yml
pull_request:
paths:
- .devcontainer/base-image/Dockerfile
- Taskfile.cargo-tools.yml
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: docker/metadata-action@v4
id: meta
with:
images: ghcr.io/${{ github.repository_owner }}/prql-devcontainer-base
tags: |
type=raw,latest
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- id: set-options
run: |
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
echo "push=true" >>$GITHUB_OUTPUT
else
echo "push=false" >>$GITHUB_OUTPUT
fi
- name: Build
uses: docker/build-push-action@v4
with:
file: "./.devcontainer/base-image/Dockerfile"
tags: ${{ steps.meta.outputs.tags }}
# TODO: add linux/arm64
platforms: linux/amd64
push: ${{ steps.set-options.outputs.push }}
cache-from: |
${{ env.IMAGE_NAME }}
type=gha
cache-to: |
type=inline
type=gha,mode=max
105 changes: 105 additions & 0 deletions .github/workflows/mega-linter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# This MegaLinter workflow is very experimental stage. Open to changes and updates.
# https://github.com/PRQL/prql/pull/1974

# MegaLinter GitHub Action configuration file
# More info at https://megalinter.io
name: MegaLinter

on:
push:
branches:
- main
pull_request:
branches:
- main

env: # Comment env block if you do not want to apply fixes
# Apply linter fixes configuration
# APPLY_FIXES: all # When active, APPLY_FIXES must also be defined as environment variable (in github/workflows/mega-linter.yml or other CI tool)
APPLY_FIXES_EVENT: pull_request # Decide which event triggers application of fixes in a commit or a PR (pull_request, push, all)
APPLY_FIXES_MODE: commit # If APPLY_FIXES is used, defines if the fixes are directly committed (commit) or posted in a PR (pull_request)

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

jobs:
build:
name: MegaLinter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # If you use VALIDATE_ALL_CODEBASE = true, you can remove this line to improve performances

# MegaLinter
- name: MegaLinter
id: ml
# You can override MegaLinter flavor used to have faster performances
# More info at https://megalinter.io/flavors/
uses: oxsecurity/megalinter@v6
env:
# All available variables are described in documentation
# https://megalinter.io/configuration/
VALIDATE_ALL_CODEBASE: ${{ github.event_name == 'push' && github.ref
== 'refs/heads/main' }} # Validates all source when push on main, else just the git diff with main. Override with true if you always want to lint all sources
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ADD YOUR CUSTOM ENV VARIABLES HERE OR DEFINE THEM IN A FILE .mega-linter.yml AT THE ROOT OF YOUR REPOSITORY
# DISABLE: COPYPASTE,SPELL # Uncomment to disable copy-paste and spell checks

# Upload MegaLinter artifacts
- name: Archive production artifacts
if: ${{ success() }} || ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: MegaLinter reports
path: |
megalinter-reports
mega-linter.log
# Create pull request if applicable (for now works only on PR from same repository, not from forks)
- name: Create Pull Request with applied fixes
id: cpr
if:
steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT ==
'all' || env.APPLY_FIXES_EVENT == github.event_name) &&
env.APPLY_FIXES_MODE == 'pull_request' && (github.event_name == 'push'
|| github.event.pull_request.head.repo.full_name == github.repository)
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
commit-message: "[MegaLinter] Apply linters automatic fixes"
title: "[MegaLinter] Apply linters automatic fixes"
labels: bot
- name: Create PR output
if:
steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT ==
'all' || env.APPLY_FIXES_EVENT == github.event_name) &&
env.APPLY_FIXES_MODE == 'pull_request' && (github.event_name == 'push'
|| github.event.pull_request.head.repo.full_name == github.repository)
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
# Push new commit if applicable (for now works only on PR from same repository, not from forks)
- name: Prepare commit
if:
steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT ==
'all' || env.APPLY_FIXES_EVENT == github.event_name) &&
env.APPLY_FIXES_MODE == 'commit' && github.ref != 'refs/heads/main' &&
(github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name == github.repository)
run: sudo chown -Rc $UID .git/
- name: Commit and push applied linter fixes
if:
steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT ==
'all' || env.APPLY_FIXES_EVENT == github.event_name) &&
env.APPLY_FIXES_MODE == 'commit' && github.ref != 'refs/heads/main' &&
(github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name == github.repository)
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch:
${{ github.event.pull_request.head.ref || github.head_ref ||
github.ref }}
commit_message: "[MegaLinter] Apply linters fixes"
Loading

0 comments on commit b9daa54

Please sign in to comment.