Simplify Gitea Actions workflow
This commit is contained in:
+14
-40
@@ -9,61 +9,39 @@ on:
|
|||||||
description: 'Run full E2E tests after deploy'
|
description: 'Run full E2E tests after deploy'
|
||||||
type: boolean
|
type: boolean
|
||||||
default: false
|
default: false
|
||||||
run_coverage:
|
|
||||||
description: 'Run coverage tests'
|
|
||||||
type: boolean
|
|
||||||
default: false
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ci-gate:
|
ci-gate:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
|
||||||
image: mcr.microsoft.com/playwright:v1.51.1-jammy
|
|
||||||
options: -v /var/run/docker.sock:/var/run/docker.sock --ipc=host
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Install Node
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: '20'
|
node-version: '20'
|
||||||
|
|
||||||
- name: Cache npm
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: ~/.npm
|
|
||||||
key: npm-${{ hashFiles('package-lock.json') }}
|
|
||||||
restore-keys: npm-
|
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: |
|
||||||
|
npm config set registry https://registry.npmmirror.com
|
||||||
- name: Generate Prisma client
|
npm ci
|
||||||
run: npx prisma generate
|
|
||||||
|
|
||||||
- name: Lint
|
- name: Lint
|
||||||
run: npm run lint
|
run: npm run lint
|
||||||
|
|
||||||
- name: Unit tests
|
- name: Unit tests
|
||||||
run: |
|
run: npm run test
|
||||||
if [ "${{ inputs.run_coverage }}" = "true" ]; then
|
|
||||||
npm run test:coverage
|
|
||||||
else
|
|
||||||
npm run test
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Smoke E2E tests
|
- name: Smoke E2E tests
|
||||||
run: |
|
run: |
|
||||||
npx playwright install chromium
|
npx playwright install chromium 2>/dev/null || true
|
||||||
npm run test:e2e:smoke
|
npm run test:e2e:smoke
|
||||||
|
|
||||||
build-and-deploy:
|
build-and-deploy:
|
||||||
needs: ci-gate
|
needs: ci-gate
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
|
||||||
options: -v /var/run/docker.sock:/var/run/docker.sock
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -73,16 +51,13 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
docker build \
|
docker build \
|
||||||
--build-arg NEXT_PUBLIC_AMAP_API_KEY="${{ secrets.AMAP_API_KEY }}" \
|
--build-arg NEXT_PUBLIC_AMAP_API_KEY="${{ secrets.AMAP_API_KEY }}" \
|
||||||
-t no-whatever:latest \
|
-t no-whatever:latest .
|
||||||
-t no-whatever:${{ github.sha }} \
|
|
||||||
.
|
|
||||||
|
|
||||||
- name: Deploy
|
- name: Deploy
|
||||||
run: |
|
run: |
|
||||||
docker stop no-whatever || true
|
docker stop no-whatever || true
|
||||||
docker rm no-whatever || true
|
docker rm no-whatever || true
|
||||||
mkdir -p /data/no-whatever
|
mkdir -p /data/no-whatever && chown 1001:1001 /data/no-whatever
|
||||||
chown 1001:1001 /data/no-whatever
|
|
||||||
docker run -d \
|
docker run -d \
|
||||||
--name no-whatever \
|
--name no-whatever \
|
||||||
--network nginx \
|
--network nginx \
|
||||||
@@ -98,24 +73,23 @@ jobs:
|
|||||||
needs: build-and-deploy
|
needs: build-and-deploy
|
||||||
if: ${{ inputs.run_full_e2e }}
|
if: ${{ inputs.run_full_e2e }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
|
||||||
image: mcr.microsoft.com/playwright:v1.51.1-jammy
|
|
||||||
options: --ipc=host
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Install Node
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: '20'
|
node-version: '20'
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: |
|
||||||
|
npm config set registry https://registry.npmmirror.com
|
||||||
|
npm ci
|
||||||
|
|
||||||
- name: Full E2E tests
|
- name: Full E2E
|
||||||
run: |
|
run: |
|
||||||
npx prisma generate
|
npx prisma generate
|
||||||
npx playwright install chromium
|
npx playwright install chromium 2>/dev/null || true
|
||||||
npm run test:e2e
|
npm run test:e2e
|
||||||
|
|||||||
Reference in New Issue
Block a user