Unverified Commit 56616fba authored by James Lamb's avatar James Lamb Committed by GitHub
Browse files

[ci] separate configs and scripts for linting and docs CI (#7003)



* [ci] separate configs and scripts for linting and docs CI

* update name

* remove lint-cpp reference

* Update .ci/lint-all.sh

* Update .ci/lint-all.sh
Co-authored-by: default avatarNikita Titov <nekit94-08@mail.ru>

* revert env: blocks

---------
Co-authored-by: default avatarNikita Titov <nekit94-08@mail.ru>
parent 0ffd2a3a
#!/bin/bash
set -e -E -u -o pipefail
pwsh -command "Install-Module -Name PSScriptAnalyzer -Scope CurrentUser -SkipPublisherCheck"
echo "Linting PowerShell code"
pwsh -file ./.ci/lint-powershell.ps1 || exit 1
conda create -q -y -n test-env \
"python=3.13[build=*_cp*]" \
'biome>=1.9.3' \
'matplotlib-base>=3.9.1' \
'mypy>=1.11.1' \
'pre-commit>=3.8.0' \
'pyarrow-core>=17.0' \
'scikit-learn>=1.5.2' \
'r-lintr>=3.1.2'
# shellcheck disable=SC1091
source activate test-env
bash ./.ci/run-pre-commit-mypy.sh || exit 1
echo "Linting R code"
Rscript ./.ci/lint-r-code.R "$(pwd)" || exit 1
echo "Linting JavaScript code"
bash ./.ci/lint-js.sh || exit 1
#!/bin/bash
set -e -E -u -o pipefail
conda env create \
--name test-env \
--file ./docs/env.yml \
|| exit 1
# shellcheck disable=SC1091
source activate test-env
# build docs
make -C docs html || exit 1
if [[ $TASK == "check-links" ]]; then
# check docs for broken links
pip install 'linkchecker>=10.5.0'
linkchecker --config=./docs/.linkcheckerrc ./docs/_build/html/*.html || exit 1
fi
......@@ -98,47 +98,6 @@ if [[ $TASK == "swig" ]]; then
exit 0
fi
if [[ $TASK == "lint" ]]; then
pwsh -command "Install-Module -Name PSScriptAnalyzer -Scope CurrentUser -SkipPublisherCheck"
echo "Linting PowerShell code"
pwsh -file ./.ci/lint-powershell.ps1 || exit 1
conda create -q -y -n "${CONDA_ENV}" \
"${CONDA_PYTHON_REQUIREMENT}" \
'biome>=1.9.3' \
'matplotlib-base>=3.9.1' \
'mypy>=1.11.1' \
'pre-commit>=3.8.0' \
'pyarrow-core>=17.0' \
'scikit-learn>=1.5.2' \
'r-lintr>=3.1.2'
# shellcheck disable=SC1091
source activate "${CONDA_ENV}"
echo "Linting Python and bash code"
bash ./.ci/run-pre-commit-mypy.sh || exit 1
echo "Linting R code"
Rscript ./.ci/lint-r-code.R "${BUILD_DIRECTORY}" || exit 1
echo "Linting JavaScript code"
bash ./.ci/lint-js.sh || exit 1
exit 0
fi
if [[ $TASK == "check-docs" ]] || [[ $TASK == "check-links" ]]; then
conda env create \
-n "${CONDA_ENV}" \
--file ./docs/env.yml || exit 1
# shellcheck disable=SC1091
source activate "${CONDA_ENV}"
# build docs
make -C docs html || exit 1
if [[ $TASK == "check-links" ]]; then
# check docs for broken links
pip install 'linkchecker>=10.5.0'
linkchecker --config=./docs/.linkcheckerrc ./docs/_build/html/*.html || exit 1
exit 0
fi
exit 0
fi
if [[ $PYTHON_VERSION == "3.9" ]]; then
CONDA_REQUIREMENT_FILE="${BUILD_DIRECTORY}/.ci/conda-envs/ci-core-py39.txt"
else
......
......@@ -10,7 +10,6 @@ on:
env:
COMPILER: gcc
OS_NAME: 'linux'
PYTHON_VERSION: '3.13'
TASK: 'check-links'
jobs:
......@@ -25,8 +24,7 @@ jobs:
submodules: false
- name: Setup and run tests
run: |
export BUILD_DIRECTORY="$GITHUB_WORKSPACE"
export CONDA=${HOME}/miniforge
export PATH=${CONDA}/bin:${HOME}/.local/bin:${PATH}
$GITHUB_WORKSPACE/.ci/setup.sh || exit 1
$GITHUB_WORKSPACE/.ci/test.sh || exit 1
$GITHUB_WORKSPACE/.ci/test-docs.sh || exit 1
......@@ -19,19 +19,12 @@ env:
COMPILER: 'gcc'
MAKEFLAGS: '-j4'
OS_NAME: 'linux'
PYTHON_VERSION: '3.13'
jobs:
test:
name: ${{ matrix.task }}
lint:
name: lint
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- task: lint
- task: check-docs
steps:
- name: Checkout repository
uses: actions/checkout@v4
......@@ -41,12 +34,29 @@ jobs:
- name: Setup and run tests
shell: bash
run: |
export TASK="${{ matrix.task }}"
export BUILD_DIRECTORY="$GITHUB_WORKSPACE"
export TASK=lint
export CONDA=${HOME}/miniforge
export PATH=${CONDA}/bin:$HOME/.local/bin:${PATH}
$GITHUB_WORKSPACE/.ci/setup.sh || exit 1
$GITHUB_WORKSPACE/.ci/test.sh || exit 1
$GITHUB_WORKSPACE/.ci/lint-all.sh || exit 1
check-docs:
name: check-docs
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 5
submodules: false
- name: Setup and run tests
shell: bash
run: |
export TASK=check-docs
export CONDA=${HOME}/miniforge
export PATH=${CONDA}/bin:$HOME/.local/bin:${PATH}
$GITHUB_WORKSPACE/.ci/setup.sh || exit 1
$GITHUB_WORKSPACE/.ci/test-docs.sh || exit 1
r-check-docs:
name: r-package-check-docs
timeout-minutes: 60
......@@ -86,7 +96,7 @@ jobs:
all-static-analysis-jobs-successful:
if: always()
runs-on: ubuntu-latest
needs: [test, r-check-docs]
needs: [lint, check-docs, r-check-docs]
steps:
- name: Note that all tests succeeded
uses: re-actors/alls-green@v1.2.2
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment