refactor: auto_save_redis_to_database
等
#357
Workflow file for this run
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: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
pull_request: | |
paths-ignore: | |
- "**/*.md" | |
merge_group: | |
jobs: | |
check-dev: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# Setup python tools | |
- name: Get pipx environment | |
id: pipx-env | |
run: | | |
echo "VERSION=$(pipx --version)" >> $GITHUB_OUTPUT | |
echo "BIN_DIR=$(pipx environment -v PIPX_BIN_DIR)" >> $GITHUB_OUTPUT | |
echo "LOCAL_VENVS=$(pipx environment -v PIPX_LOCAL_VENVS)" >> $GITHUB_OUTPUT | |
- name: Cache poetry | |
uses: actions/cache@v4 | |
with: | |
key: ${{ runner.os }}-pipx@${{ steps.pipx-env.outputs.VERSION }}[email protected] | |
path: | | |
${{ steps.pipx-env.outputs.LOCAL_VENVS }}/poetry/ | |
${{ steps.pipx-env.outputs.BIN_DIR }}/poetry | |
- name: Install poetry | |
run: pipx install poetry==1.8.1 | |
- name: Configure poetry for in-project venv | |
run: | | |
poetry config virtualenvs.in-project true | |
echo 'PYTHON = "./.venv/bin/python"' > .env | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
cache: poetry | |
# Setup other tools | |
- name: Setup just | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: just | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 8 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
cache: pnpm | |
cache-dependency-path: | | |
contest/*/static_src/pnpm-lock.yaml | |
# Install and update | |
- run: just update-dependencies | |
# Build and check | |
- run: just build-theme | |
- run: just build-js | |
- name: Upload front-end artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: front-end | |
path: | | |
contest/js/static/js/dist/ | |
contest/theme/static/css/dist/ | |
# The root directory of the artifact is the least common ancestor, i.e. `contest/`. | |
if-no-files-found: error | |
retention-days: 7 | |
- name: Find recent commits | |
id: git-rev | |
run: | | |
echo "HEAD=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | |
echo "MERGE_BASE=$(git merge-base HEAD origin/main)" >> $GITHUB_OUTPUT | |
- name: Cache mypy | |
uses: actions/cache@v4 | |
with: | |
key: mypy-cache-${{ steps.git-rev.outputs.HEAD }} | |
restore-keys: | | |
mypy-cache-${{ steps.git-rev.outputs.MERGE_BASE }} | |
mypy-cache- | |
path: | | |
.mypy_cache/ | |
- run: just check-all | |
check-deploy: | |
runs-on: ubuntu-latest | |
needs: check-dev | |
env: | |
# 内容都不重要 | |
DJANGO_PRODUCTION: Israfel | |
SECRET_KEY: Israfel is the Seventh Angel, capable of splitting itself into two identical copies for simultaneous attacks. | |
steps: | |
- uses: actions/checkout@v4 | |
# Setup python tools | |
- name: Get pipx environment | |
id: pipx-env | |
run: | | |
echo "VERSION=$(pipx --version)" >> $GITHUB_OUTPUT | |
echo "BIN_DIR=$(pipx environment -v PIPX_BIN_DIR)" >> $GITHUB_OUTPUT | |
echo "LOCAL_VENVS=$(pipx environment -v PIPX_LOCAL_VENVS)" >> $GITHUB_OUTPUT | |
- name: Cache poetry | |
uses: actions/cache@v4 | |
with: | |
key: ${{ runner.os }}-pipx@${{ steps.pipx-env.outputs.VERSION }}[email protected] | |
path: | | |
${{ steps.pipx-env.outputs.LOCAL_VENVS }}/poetry/ | |
${{ steps.pipx-env.outputs.BIN_DIR }}/poetry | |
- name: Install poetry | |
run: pipx install poetry==1.8.1 | |
- name: Configure poetry for in-project venv | |
run: | | |
poetry config virtualenvs.in-project true | |
echo 'PYTHON = "./.venv/bin/python"' > .env | |
- name: Cache python dependencies | |
uses: actions/cache@v4 | |
with: | |
key: | | |
venv-without-dev-${{ runner.os }}[email protected]@1.8.1-${{ hashFiles('poetry.lock') }} | |
# 这里忽略了 python 小版本 | |
path: | | |
.venv/ | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
# Setup other tools | |
- name: Setup just | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: just | |
# Install and update | |
- run: just update-dependencies | |
- name: Download front-end artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: front-end | |
path: contest/ | |
# Check | |
- run: just check-deploy | |
# 会有警告,但正常退出 |