Skip to content

追加: ShellCheck CI #3337

追加: ShellCheck CI

追加: ShellCheck CI #3337

Workflow file for this run

name: test
on:
push:
pull_request:
branches:
- "**"
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, macos-latest, windows-latest]
python: ["3.11.3"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: pip
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install -r requirements-test.txt
- name: Validate poetry.lock
run: |
poetry lock --no-update
git diff --exit-code
- name: Run poetry and check
run: |
poetry export --without-hashes -o requirements.txt.check
poetry export --without-hashes --with dev -o requirements-dev.txt.check
poetry export --without-hashes --with test -o requirements-test.txt.check
poetry export --without-hashes --with license -o requirements-license.txt.check
diff -q requirements.txt requirements.txt.check || \
diff -q requirements-dev.txt requirements-dev.txt.check || \
diff -q requirements-test.txt requirements-test.txt.check || \
diff -q requirements-license.txt requirements-license.txt.check > /dev/null
if [ $? = 1 ]; then
echo "poetry export has some diff"
exit 1
fi
- run: pysen run lint
- name: Run pytest and get coverage
run: |
coverage run --omit=test/* -m pytest
- name: Submit coverage to Coveralls
if: matrix.os == 'ubuntu-20.04'
run: coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create coverage result
if: github.event_name == 'pull_request' && matrix.os == 'ubuntu-20.04'
run: |
mkdir report
coverage report > report/report.txt
echo ${{ github.event.number }} > report/pr_num.txt
- name: Upload coverage result
if: github.event_name == 'pull_request' && matrix.os == 'ubuntu-20.04'
uses: actions/upload-artifact@v3
with:
name: report
path: report/
- name: Check licenses
shell: bash
run: |
OUTPUT_LICENSE_JSON_PATH=/dev/null \
bash build_util/create_venv_and_generate_licenses.bash
- name: Test names by checking typo
if: ${{ startsWith(matrix.os, 'ubuntu-') }}
uses: crate-ci/[email protected]
lint:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Install ShellCheck
run: |
sudo apt-get update
sudo apt-get install -y shellcheck
- name: Check shell files
run: git ls-files | grep -E '\.(ba)?sh' | xargs shellcheck