Add Gitea workflow for testing and E2E integration
Some checks failed
RenovateBot / renovate (push) Successful in 25s
Test / Basic (push) Successful in 3m26s
Test / E2E (push) Has been cancelled

- Introduced a new workflow file (.gitea/workflows/test.yml) to automate testing processes.
- Configured jobs for basic testing and end-to-end (E2E) testing using Jest, Supertest, and Playwright.
- Included steps for dependency installation, plugin building, and Strapi server management during E2E tests.
- Set up environment variables for E2E tests and ensured proper handling of the Strapi server lifecycle.
This commit is contained in:
2026-02-05 21:39:52 +00:00
parent 9012c5cb1f
commit 7a0e6615d0

View File

@@ -1,103 +0,0 @@
name: Test
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
jobs:
test:
name: Basic
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 22
cache: "npm"
cache-dependency-path: |
package-lock.json
playground/package-lock.json
- name: Install root deps
run: npm ci
- name: Build plugin
run: npm run build
- name: Verify plugin
run: npm run verify
- name: Pack plugin into playground .yalc
run: |
TARBALL=$(npm pack --silent)
mkdir -p playground/.yalc/strapi-plugin-checkbox-list
tar -xzf "$TARBALL" -C playground/.yalc/strapi-plugin-checkbox-list --strip-components=1
- name: Install playground deps
working-directory: playground
run: npm install
- name: Build playground
working-directory: playground
run: npm run build
- name: Integration tests (Jest + Supertest)
working-directory: playground
run: npm run test:integration
e2e:
name: E2E
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
env:
STRAPI_ADMIN_EMAIL: admin@example.com
STRAPI_ADMIN_PASSWORD: Admin12345
STRAPI_ADMIN_FIRSTNAME: Admin
STRAPI_ADMIN_LASTNAME: User
DATABASE_FILENAME: .tmp/e2e.db
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 22
cache: "npm"
cache-dependency-path: |
package-lock.json
playground/package-lock.json
- name: Install root deps
run: npm ci
- name: Build plugin
run: npm run build
- name: Pack plugin into playground .yalc
run: |
TARBALL=$(npm pack --silent)
mkdir -p playground/.yalc/strapi-plugin-checkbox-list
tar -xzf "$TARBALL" -C playground/.yalc/strapi-plugin-checkbox-list --strip-components=1
- name: Install playground deps
working-directory: playground
run: npm install
- name: Install Playwright browsers
working-directory: playground
run: npx playwright install --with-deps chromium
- name: Create admin user
working-directory: playground
run: |
npx strapi admin:create-user \
--email "$STRAPI_ADMIN_EMAIL" \
--password "$STRAPI_ADMIN_PASSWORD" \
--firstname "$STRAPI_ADMIN_FIRSTNAME" \
--lastname "$STRAPI_ADMIN_LASTNAME"
- name: Start Strapi
env:
DATABASE_FILENAME: .tmp/e2e.db
run: |
rm -f playground/.tmp/e2e.db
npm run develop --prefix playground -- --host 0.0.0.0 --port 1337 &
echo $! > /tmp/strapi.pid
until curl -sSf http://127.0.0.1:1337/admin >/dev/null; do sleep 2; done
- name: E2E tests (Playwright/Cypress)
working-directory: playground
run: npm run e2e
- name: Stop Strapi
if: always()
run: |
if [ -f /tmp/strapi.pid ]; then
kill "$(cat /tmp/strapi.pid)" || true
fi