Skip to content

Commit

Permalink
Merge branch 'main' into rfc-types
Browse files Browse the repository at this point in the history
  • Loading branch information
max-sixty authored Mar 11, 2023
2 parents b97af84 + ed1e896 commit a414c15
Show file tree
Hide file tree
Showing 321 changed files with 3,636 additions and 2,977 deletions.
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
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: Something else
description: Anything that's not a bug report
labels: [bug]
body:
- type: textarea
id: what-happened
attributes:
label: What's up?
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ updates:
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"
9 changes: 7 additions & 2 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ on:
jobs:
cargo-audit:
runs-on: ubuntu-latest
# We can't read PRQL repo security events on forks, which causes this to
# incorrectly fail. So we disable. If we wanted to run checks on PRs, we
# could move this to `pull-request-target`.
if: "!github.event.pull_request.head.repo.fork"
permissions:
actions: read
contents: read
Expand Down Expand Up @@ -48,14 +52,15 @@ jobs:

update-rust-toolchain:
runs-on: ubuntu-latest
# Don't run on forks; will attempt to create a PR into the fork...
if: "!github.event.pull_request.head.repo.fork"
steps:
- name: 📂 Checkout code
uses: actions/checkout@v3
- uses: a-kenji/update-rust-toolchain@main
with:
# Discussion in #1561
# Move this up until 3, so the next upgrade is at 1.66 once 1.69 is released.
minor-version-delta: 2
minor-version-delta: 3
toolchain-path: "./rust-toolchain.toml"
pr-title: "build: Update rust toolchain version"

Expand Down
Loading

0 comments on commit a414c15

Please sign in to comment.