mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-07-07 17:04:59 +00:00
Use the local GitHub Action to replace setup-rust-action (#1371)
This commit is contained in:
parent
1e209d8741
commit
ca5262c13f
2 changed files with 64 additions and 25 deletions
42
.github/actions/setup-builder/action.yaml
vendored
Normal file
42
.github/actions/setup-builder/action.yaml
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
# 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: Prepare Rust Builder
|
||||
description: 'Prepare Rust Build Environment'
|
||||
inputs:
|
||||
rust-version:
|
||||
description: 'version of rust to install (e.g. stable)'
|
||||
required: true
|
||||
default: 'stable'
|
||||
targets:
|
||||
description: 'The toolchain targets to add, comma-separated'
|
||||
default: ''
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Setup Rust Toolchain
|
||||
shell: bash
|
||||
run: |
|
||||
echo "Installing ${{ inputs.rust-version }}"
|
||||
if [ -n "${{ inputs.targets}}" ]; then
|
||||
rustup toolchain install ${{ inputs.rust-version }} -t ${{ inputs.targets }}
|
||||
else
|
||||
rustup toolchain install ${{ inputs.rust-version }}
|
||||
fi
|
||||
rustup default ${{ inputs.rust-version }}
|
||||
rustup component add rustfmt clippy
|
47
.github/workflows/rust.yml
vendored
47
.github/workflows/rust.yml
vendored
|
@ -7,32 +7,29 @@ jobs:
|
|||
codestyle:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set up Rust
|
||||
uses: hecrj/setup-rust-action@v2
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup Rust Toolchain
|
||||
uses: ./.github/actions/setup-builder
|
||||
with:
|
||||
components: rustfmt
|
||||
# Note that `nightly` is required for `license_template_path`, as
|
||||
# it's an unstable feature.
|
||||
rust-version: nightly
|
||||
- uses: actions/checkout@v4
|
||||
- run: cargo +nightly fmt -- --check --config-path <(echo 'license_template_path = "HEADER"')
|
||||
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set up Rust
|
||||
uses: hecrj/setup-rust-action@v2
|
||||
with:
|
||||
components: clippy
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup Rust Toolchain
|
||||
uses: ./.github/actions/setup-builder
|
||||
- run: cargo clippy --all-targets --all-features -- -D warnings
|
||||
|
||||
compile:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set up Rust
|
||||
uses: hecrj/setup-rust-action@v2
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup Rust Toolchain
|
||||
uses: ./.github/actions/setup-builder
|
||||
- run: cargo check --all-targets --all-features
|
||||
|
||||
docs:
|
||||
|
@ -40,19 +37,19 @@ jobs:
|
|||
env:
|
||||
RUSTDOCFLAGS: "-Dwarnings"
|
||||
steps:
|
||||
- name: Set up Rust
|
||||
uses: hecrj/setup-rust-action@v2
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup Rust Toolchain
|
||||
uses: ./.github/actions/setup-builder
|
||||
- run: cargo doc --document-private-items --no-deps --workspace --all-features
|
||||
|
||||
compile-no-std:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set up Rust
|
||||
uses: hecrj/setup-rust-action@v2
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup Rust Toolchain
|
||||
uses: ./.github/actions/setup-builder
|
||||
with:
|
||||
targets: 'thumbv6m-none-eabi'
|
||||
- uses: actions/checkout@v4
|
||||
- run: cargo check --no-default-features --target thumbv6m-none-eabi
|
||||
|
||||
test:
|
||||
|
@ -61,8 +58,10 @@ jobs:
|
|||
rust: [stable, beta, nightly]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Setup Rust
|
||||
uses: hecrj/setup-rust-action@v2
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Rust Toolchain
|
||||
uses: ./.github/actions/setup-builder
|
||||
with:
|
||||
rust-version: ${{ matrix.rust }}
|
||||
- name: Install Tarpaulin
|
||||
|
@ -71,16 +70,16 @@ jobs:
|
|||
crate: cargo-tarpaulin
|
||||
version: 0.14.2
|
||||
use-tool-cache: true
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Test
|
||||
run: cargo test --all-features
|
||||
|
||||
test-coverage:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Setup Rust
|
||||
uses: hecrj/setup-rust-action@v2
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Rust Toolchain
|
||||
uses: ./.github/actions/setup-builder
|
||||
with:
|
||||
rust-version: stable
|
||||
- name: Install Tarpaulin
|
||||
|
@ -89,8 +88,6 @@ jobs:
|
|||
crate: cargo-tarpaulin
|
||||
version: 0.14.2
|
||||
use-tool-cache: true
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Coverage
|
||||
run: cargo tarpaulin -o Lcov --output-dir ./coverage
|
||||
- name: Coveralls
|
||||
|
@ -103,9 +100,9 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
needs: [test]
|
||||
steps:
|
||||
- name: Set up Rust
|
||||
uses: hecrj/setup-rust-action@v2
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup Rust Toolchain
|
||||
uses: ./.github/actions/setup-builder
|
||||
- name: Publish
|
||||
shell: bash
|
||||
run: |
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue