docs: 撰寫主題說明文件雛型 #1
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
# GitHub Actions workflow for checking potential problems in the project | |
# | |
# References: | |
# | |
# * Workflow syntax for GitHub Actions - GitHub Docs | |
# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions | |
# | |
# Copyright 2024 林博仁(Buo-ren Lin) <buo.ren.lin@gmail.com> | |
# SPDX-License-Identifier: CC-BY-SA-4.0 | |
name: Check potential problems in the project | |
on: | |
push: | |
branches: | |
- '**' | |
jobs: | |
check-using-precommit: | |
name: Check potential problems using pre-commit | |
runs-on: ubuntu-22.04 | |
env: | |
PIP_CACHE_DIR: ${{ github.workspace }}/.cache/pip | |
PRE_COMMIT_HOME: ${{ github.workspace }}/.cache/pre-commit | |
SHELLCHECK_DIR: ${{ github.workspace }}/.cache/shellcheck-stable | |
steps: | |
- name: Check out content from the Git repository | |
uses: actions/checkout@v4 | |
- name: Configure PyPI data cache to speed up continuous integration | |
uses: actions/cache@v4 | |
with: | |
key: ${{ runner.os }}-pip | |
path: ${{ env.PIP_CACHE_DIR }} | |
- name: >- | |
Configure pre-commit data cache to speed up continuous integration | |
uses: actions/cache@v4 | |
with: | |
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} | |
path: ${{ env.PRE_COMMIT_HOME }} | |
- name: >- | |
Configure pre-built ShellCheck cache to speed up continuous integration | |
uses: actions/cache@v4 | |
with: | |
key: ${{ runner.os }}-${{ runner.arch }}-shellcheck | |
path: ${{ env.SHELLCHECK_DIR }} | |
- name: >- | |
Patch the sudo security policy so that programs run via sudo | |
will recognize environment variables predefined by GitHub | |
run: sudo ./continuous-integration/patch-github-actions-sudo-security-policy.sh | |
- name: Run the static analysis programs | |
run: | | |
sudo ./continuous-integration/do-static-analysis.install-system-deps.sh | |
./continuous-integration/do-static-analysis.sh | |
- name: Send CI result notification to the Telegram channel | |
uses: yanzay/notify-telegram@v0.1.0 | |
if: always() | |
with: | |
chat: '@libre_knowledge_ci' | |
token: ${{ secrets.telegram_bot_api_token_ci }} | |
status: ${{ job.status }} |