From bd5886c390c9a3fcbae83ff65b925d35bd634412 Mon Sep 17 00:00:00 2001 From: Yu Ishikawa Date: Thu, 23 Dec 2021 09:22:59 +0900 Subject: [PATCH] Extract `actions/setup-python@v2` (#3) * Extract `actions/setup-python@v2` * Fix --- .github/workflows/test.yml | 18 ++++++++++++++++++ README.md | 8 ++++++++ action.yml | 11 ++++------- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 47651d7..35fabf5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,8 +9,14 @@ jobs: test-check: name: runner / sqlfluff (github-check) runs-on: ubuntu-latest + strategy: + matrix: + python: ["3.8", "3.9", "3.10"] steps: - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python }} - uses: ./ id: list-sql with: @@ -31,8 +37,14 @@ jobs: if: github.event_name == 'pull_request' name: runner / sqlfluff (github-pr-check) runs-on: ubuntu-latest + strategy: + matrix: + python: ["3.8", "3.9", "3.10"] steps: - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python }} - uses: ./ id: list-sql with: @@ -53,8 +65,14 @@ jobs: if: github.event_name == 'pull_request' name: runner / sqlfluff (github-pr-review) runs-on: ubuntu-latest + strategy: + matrix: + python: ["3.8", "3.9", "3.10"] steps: - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python }} - uses: ./ id: list-sql continue-on-error: true diff --git a/README.md b/README.md index fd91b3c..60b309d 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,11 @@ This is a github action to lint SQL with [sqlfluff](https://github.com/sqlfluff/sqlfluff). The action automatically leaves comments about SQL violation using [reviewdog](https://github.com/reviewdog/reviewdog) +## Requirements +We have to set up a python environment in our workflow, because `action-sqlfluff` is a composite action. +In order not to interfere our python environment, it would be nicer to set up python separattely. +I made sure the action works on python 3.8, 3.9 and 3.10. + ## Input ```yaml @@ -144,6 +149,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: 3.9 - uses: yu-iskw/action-sqlfluff@v1 id: lint-sql with: diff --git a/action.yml b/action.yml index b5ae587..3b51d51 100644 --- a/action.yml +++ b/action.yml @@ -31,10 +31,10 @@ inputs: Default is `false`. required: false default: 'false' - reviewdog_flags: - description: 'Additional reviewdog flags' + reviewdog_version: + description: 'reviewdog version' required: false - default: '' + default: 'v0.13.0' ### Flags for sqlfluff ### sqlfluff_version: description: 'sqlfluff version. Use the latest version if not set.' @@ -125,10 +125,7 @@ runs: steps: - uses: reviewdog/action-setup@v1 with: - reviewdog_version: v0.13.0 - - uses: actions/setup-python@v2 - with: - python-version: 3.9 + reviewdog_version: ${{ inputs.reviewdog_version }} - run: $GITHUB_ACTION_PATH/script.sh id: sqlfluff-with-reviewdog-in-composite shell: bash