From a5cb3fc9a2eedbafdd80ba27f85c69ab9a1172f1 Mon Sep 17 00:00:00 2001 From: Yijie Shen Date: Thu, 13 Apr 2023 18:39:08 +0800 Subject: [PATCH 1/3] minor: fix doctest that runs accidentally --- docs/source/user-guide/example-usage.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/source/user-guide/example-usage.md b/docs/source/user-guide/example-usage.md index fd3c4cf1833c..d8e7e3c882fa 100644 --- a/docs/source/user-guide/example-usage.md +++ b/docs/source/user-guide/example-usage.md @@ -175,12 +175,13 @@ codegen-units = 1 Then, in `main.rs.` update the memory allocator with the below after your imports: -```rust +```rust,ignore use datafusion::prelude::*; #[global_allocator] static ALLOC: snmalloc_rs::SnMalloc = snmalloc_rs::SnMalloc; +#[tokio::main] async fn main() -> datafusion::error::Result<()> { Ok(()) } @@ -195,6 +196,6 @@ rustup toolchain install nightly Based on the instruction set architecture you are building on you will want to configure the `target-cpu` as well, ideally with `native` or at least `avx2`. -``` +```shell RUSTFLAGS='-C target-cpu=native' cargo +nightly run --release ``` From f252af1e2c8ea8d18eb5861102b5e6572f469ae7 Mon Sep 17 00:00:00 2001 From: Yijie Shen Date: Thu, 13 Apr 2023 18:55:50 +0800 Subject: [PATCH 2/3] enable doctest in ci for docs/** --- .github/workflows/docs.yaml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 998c62034804..7c122048f976 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -62,3 +62,24 @@ jobs: git commit -m 'Publish built docs triggered by ${{ github.sha }}' git push || git push --force fi + + # Run doc tests + linux-test-doc: + name: cargo doctest (amd64) + needs: [ linux-build-lib ] + runs-on: ubuntu-latest + container: + image: amd64/rust + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - name: Setup Rust toolchain + uses: ./.github/actions/setup-builder + with: + rust-version: stable + # Note: this does not include dictionary_expressions to reduce codegen + - name: Run doctests + run: cargo test --doc --features avro,jit,scheduler,json + - name: Verify Working Directory Clean + run: git diff --exit-code From 7a77b13bb77f164be97c35b82302579e906723b8 Mon Sep 17 00:00:00 2001 From: Yijie Shen Date: Thu, 13 Apr 2023 19:09:26 +0800 Subject: [PATCH 3/3] separate yaml for doctest --- .github/workflows/docs.yaml | 21 ------------- .github/workflows/docs_pr.yaml | 54 ++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/docs_pr.yaml diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 7c122048f976..998c62034804 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -62,24 +62,3 @@ jobs: git commit -m 'Publish built docs triggered by ${{ github.sha }}' git push || git push --force fi - - # Run doc tests - linux-test-doc: - name: cargo doctest (amd64) - needs: [ linux-build-lib ] - runs-on: ubuntu-latest - container: - image: amd64/rust - steps: - - uses: actions/checkout@v3 - with: - submodules: true - - name: Setup Rust toolchain - uses: ./.github/actions/setup-builder - with: - rust-version: stable - # Note: this does not include dictionary_expressions to reduce codegen - - name: Run doctests - run: cargo test --doc --features avro,jit,scheduler,json - - name: Verify Working Directory Clean - run: git diff --exit-code diff --git a/.github/workflows/docs_pr.yaml b/.github/workflows/docs_pr.yaml new file mode 100644 index 000000000000..435006ed93bb --- /dev/null +++ b/.github/workflows/docs_pr.yaml @@ -0,0 +1,54 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +name: Docs + +concurrency: + group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }} + cancel-in-progress: true + +on: + push: + paths: + - "docs/**" + pull_request: + paths: + - "docs/**" + # manual trigger + # https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow + workflow_dispatch: + +jobs: + # Run doc tests + linux-test-doc: + name: cargo doctest (amd64) + runs-on: ubuntu-latest + container: + image: amd64/rust + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - name: Setup Rust toolchain + uses: ./.github/actions/setup-builder + with: + rust-version: stable + # Note: this does not include dictionary_expressions to reduce codegen + - name: Run doctests + run: cargo test --doc --features avro,jit,scheduler,json + - name: Verify Working Directory Clean + run: git diff --exit-code