🤦 #2945
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check | |
on: [ push, pull_request ] | |
env: | |
PIP_DISABLE_PIP_VERSION_CHECK: yes | |
jobs: | |
fix_stupid_mistakes: | |
name: Fix stupid mistakes | |
runs-on: ubuntu-24.04 | |
if: github.ref_type == 'branch' | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
fetch-depth: 0 | |
token: ${{ secrets.GH_PUSH_TOKEN }} | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
cache: pip | |
cache-dependency-path: Pipfile.lock | |
- name: Setup Deno | |
uses: denoland/setup-deno@v1 | |
with: | |
deno-version: 1.40.5 | |
- name: Install required stuff | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libcurl4-openssl-dev | |
pip install -r pip-requirements.txt | |
pip install -c pip-constraints.txt autoflake black isort | |
- name: Run autoflake | |
run: autoflake --recursive --in-place --remove-all-unused-imports --remove-unused-variables --remove-duplicate-keys . | |
- name: Run isort | |
run: isort . | |
- name: Run Black | |
run: black . | |
- name: Install dprint | |
run: curl -sSf https://dprint.dev/install.sh | sh -s 0.47.2 | |
- name: Run dprint | |
run: ~/.dprint/bin/dprint fmt --diff | |
- name: Install dart-sass | |
uses: ./.github/actions/install_dart_sass | |
- name: Generate snow | |
run: sass -s compressed --random-seed 0 style/snow.scss style/snow.css | |
- name: Build JS & CSS | |
run: deno task clean && deno task build | |
- name: Generate humans.txt | |
run: ./scripts/humans.py | |
- name: Sort methods | |
run: ./scripts/sort_python_code.py | |
- name: Generate config.ini.default | |
run: python3 -m an_website --save-config-to example-configurations/config.ini.default -c | |
- name: Update env | |
run: | | |
D=$(python -c "print((_:=__import__('datetime')).datetime.now(tz=_.timezone.utc).replace(minute=0, second=0, microsecond=0).isoformat())") | |
echo "GIT_AUTHOR_DATE=${D}" >> "${GITHUB_ENV}" | |
echo "GIT_COMMITTER_DATE=${D}" >> "${GITHUB_ENV}" | |
- name: Push changes | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_author: Bot <> | |
commit_message: "🤦" | |
commit_user_name: Bot | |
commit_user_email: | |
mypy: | |
name: mypy | |
runs-on: ubuntu-24.04 | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
cache: pip | |
cache-dependency-path: Pipfile.lock | |
- name: Cache | |
uses: pat-s/always-upload-cache@v3 | |
with: | |
path: .mypy_cache | |
key: mypy-${{ github.repository }}-${{ github.ref }}-${{ github.sha }} | |
restore-keys: mypy-${{ github.repository }}-${{ github.ref }}- | |
- name: Install libcurl4-openssl-dev for compiling PycURL | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libcurl4-openssl-dev | |
- name: Install requirements | |
run: pip install -r pip-requirements.txt | |
- name: Install mypy + stuff required for checking the tests and setup.py | |
run: | | |
pip install -c pip-constraints.txt dulwich html5lib mypy numpy pytest pytest-is-running time-machine trove-classifiers | |
grep "^types-" pip-constraints.txt | xargs pip install | |
- name: Run mypy | |
run: mypy | |
flake8: | |
name: Flake8 | |
runs-on: ubuntu-24.04 | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
cache: pip | |
cache-dependency-path: Pipfile.lock | |
- name: Install Flake8 | |
run: grep "^flake8-" pip-constraints.txt | xargs pip install -c pip-constraints.txt flake8 pep8-naming | |
- name: Run Flake8 | |
run: flake8 --extend-ignore=SIM9 | |
pylint: | |
name: Pylint | |
runs-on: ubuntu-24.04 | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
cache: pip | |
cache-dependency-path: Pipfile.lock | |
- name: Cache | |
uses: pat-s/always-upload-cache@v3 | |
with: | |
path: ~/.cache/pylint | |
key: pylint-${{ github.repository }}-${{ github.ref }}-${{ github.sha }} | |
restore-keys: pylint-${{ github.repository }}-${{ github.ref }}- | |
- name: Install libcurl4-openssl-dev for compiling PycURL | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libcurl4-openssl-dev | |
- name: Install requirements | |
run: pip install -r pip-requirements.txt | |
- name: Install Pylint + stuff required for checking the tests and setup.py | |
run: pip install -c pip-constraints.txt html5lib pylint pylint-pytest pytest setuptools time-machine trove-classifiers | |
- name: Run Pylint | |
run: pylint -r y -d fixme . | |
env: | |
DISABLE_PYSTON: 1 | |
bandit: | |
name: Bandit | |
runs-on: ubuntu-24.04 | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
cache: pip | |
cache-dependency-path: Pipfile.lock | |
- name: Install Bandit | |
run: pip install -c pip-constraints.txt bandit[toml] | |
- name: Run Bandit | |
run: bandit -rc pyproject.toml . | |
eslint: | |
name: ESLint | |
runs-on: ubuntu-24.04 | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "18.20" | |
cache: pnpm | |
- name: Cache | |
uses: pat-s/always-upload-cache@v3 | |
with: | |
path: .eslintcache | |
key: eslint-${{ github.repository }}-${{ github.ref }}-${{ github.sha }} | |
restore-keys: eslint-${{ github.repository }}-${{ github.ref }}- | |
- name: Install ESLint | |
run: pnpm install | |
- name: Run ESLint | |
run: pnpm eslint --cache . | |
tsc: | |
name: tsc | |
runs-on: ubuntu-24.04 | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "18.20" | |
cache: pnpm | |
- name: Install tsc | |
run: pnpm install | |
- name: Run tsc | |
run: | | |
pnpm tsc | |
pnpm tsc -p an_website | |
shellcheck: | |
name: ShellCheck | |
runs-on: ubuntu-24.04 | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Run ShellCheck | |
uses: ludeeus/action-shellcheck@2.0.0 | |
env: | |
SHELLCHECK_OPTS: -x -o all | |
with: | |
version: v0.10.0 | |
check_together: yes | |
ignore_names: screenfetch |