Files
project-template/.gitea/workflows/ci.yml
supeisen eb7a949eac
All checks were successful
CI / smoke (push) Successful in 33s
Generalize template CI for standard actions
2026-04-06 15:59:09 +08:00

79 lines
1.9 KiB
YAML

name: CI
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
smoke:
runs-on: linux-amd64
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Detect project files
id: detect
run: |
if [ -f package.json ]; then
echo "node=true" >> "$GITHUB_OUTPUT"
else
echo "node=false" >> "$GITHUB_OUTPUT"
fi
if [ -f pyproject.toml ] || [ -f requirements.txt ]; then
echo "python=true" >> "$GITHUB_OUTPUT"
else
echo "python=false" >> "$GITHUB_OUTPUT"
fi
- name: Setup Node.js
if: steps.detect.outputs.node == 'true'
uses: actions/setup-node@v4
with:
node-version: 24
- name: Install Node.js dependencies
if: steps.detect.outputs.node == 'true'
run: |
if [ -f package-lock.json ]; then
npm ci --ignore-scripts
else
npm install --ignore-scripts
fi
- name: Lint Node.js project
if: steps.detect.outputs.node == 'true'
run: npm run lint --if-present
- name: Build Node.js project
if: steps.detect.outputs.node == 'true'
run: npm run build --if-present
- name: Setup Python
if: steps.detect.outputs.python == 'true'
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Show Python environment
if: steps.detect.outputs.python == 'true'
run: |
python --version
python -m pip --version
- name: Show workspace
run: |
echo "repo: ${GITHUB_REPOSITORY}"
echo "sha: ${GITHUB_SHA}"
pwd
git status --short
find . -maxdepth 2 -type f | sort
- name: Validate template files
run: |
test -f .editorconfig
test -f .gitea/workflows/ci.yml