ci: update workflow to use checkout action
This commit is contained in:
1 parent
41e41f0d22
commit
5140784dc7
1 file changed
+23
-41
+23
-41
@@ -6,52 +6,34 @@ on:
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: shell
|
||||
runs-on: ubuntu-latest # Of 'shell' als je expliciet een lokale host-runner gebruikt
|
||||
steps:
|
||||
# Stap 1: Laat Gitea Actions automatisch de juiste PR-code ophalen
|
||||
# Dit vervangt de hele handmatige 'git clone / git fetch' bash-code
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Stap 2: Installeer Node.js en pnpm
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20 # Pas aan naar jouw Node-versie indien nodig
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v3
|
||||
with:
|
||||
version: 9 # Pas aan naar jouw pnpm-versie indien nodig
|
||||
|
||||
# Stap 3: Voer je checks uit
|
||||
- name: Typecheck, lint, and test
|
||||
env:
|
||||
SKIP_ENV_VALIDATION: 1
|
||||
ARGON2_MEMORY_SIZE: 1024
|
||||
ARGON2_ITERATIONS: 1
|
||||
BCRYPT_ROUNDS: 4
|
||||
run: |
|
||||
set -e
|
||||
exec 2>&1
|
||||
|
||||
BARE="/docker/gitea/gitea/git/repositories/remco/epicnext-cms.git"
|
||||
REF="${{ gitea.sha }}"
|
||||
HEAD_REF="${{ gitea.head_ref }}"
|
||||
if [ -z "${REF}" ]; then
|
||||
echo "ERROR: missing gitea.sha" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
WORK="$(mktemp -d /var/tmp/epicnext-ci.XXXXXX)"
|
||||
cleanup() { rm -rf "${WORK}"; }
|
||||
trap cleanup EXIT
|
||||
|
||||
echo "--- CI checks ---"
|
||||
echo "REF=${REF}"
|
||||
echo "HEAD_REF=${HEAD_REF}"
|
||||
echo "WORK=${WORK}"
|
||||
|
||||
git clone --no-checkout "${BARE}" "${WORK}"
|
||||
cd "${WORK}"
|
||||
|
||||
# Prefer the PR branch tip (reliable on Gitea); fall back to exact SHA.
|
||||
if [ -n "${HEAD_REF}" ] && git fetch --depth 1 origin "${HEAD_REF}"; then
|
||||
git checkout -f FETCH_HEAD
|
||||
else
|
||||
echo "Branch fetch failed; trying SHA ${REF}"
|
||||
git fetch --depth 1 origin "${REF}"
|
||||
git checkout -f FETCH_HEAD
|
||||
fi
|
||||
|
||||
echo "Checked out $(git rev-parse --short HEAD)"
|
||||
git log -1 --oneline
|
||||
|
||||
export SKIP_ENV_VALIDATION=1
|
||||
export ARGON2_MEMORY_SIZE=1024
|
||||
export ARGON2_ITERATIONS=1
|
||||
export BCRYPT_ROUNDS=4
|
||||
pnpm install --frozen-lockfile
|
||||
pnpm prisma:generate
|
||||
pnpm biome:lint
|
||||
pnpm typecheck
|
||||
pnpm test
|
||||
echo "--- CI checks passed ---"
|
||||
Reference in new issue
Block a user