Add Gitea build, container tests and registry publication
All checks were successful
Build, test and publish / verify (push) Successful in 1m41s
All checks were successful
Build, test and publish / verify (push) Successful in 1m41s
This commit is contained in:
7
agiledancers-fe/.dockerignore
Normal file
7
agiledancers-fe/.dockerignore
Normal file
@@ -0,0 +1,7 @@
|
||||
node_modules
|
||||
.angular
|
||||
.git
|
||||
test-results
|
||||
playwright-report
|
||||
|
||||
unit-results
|
||||
18
agiledancers-fe/Dockerfile
Normal file
18
agiledancers-fe/Dockerfile
Normal file
@@ -0,0 +1,18 @@
|
||||
FROM node:24.15.0-bookworm AS build
|
||||
WORKDIR /workspace
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci
|
||||
COPY . .
|
||||
RUN npm test && npm run build
|
||||
|
||||
FROM nginx:1.28-alpine AS runtime
|
||||
ENV BACKEND_UPSTREAM=backend:8080
|
||||
COPY nginx/default.conf.template /etc/nginx/templates/default.conf.template
|
||||
EXPOSE 8080
|
||||
|
||||
# CI supplies the production output it has already built and tested.
|
||||
FROM runtime AS prebuilt
|
||||
COPY dist/agiledancers-fe/browser/ /usr/share/nginx/html/
|
||||
|
||||
FROM runtime AS standalone
|
||||
COPY --from=build /workspace/dist/agiledancers-fe/browser/ /usr/share/nginx/html/
|
||||
@@ -1,6 +1,6 @@
|
||||
import { test, expect, Page } from '@playwright/test';
|
||||
|
||||
const backend = 'http://127.0.0.1:8080';
|
||||
const backend = process.env['PLAYWRIGHT_BASE_URL'] || 'http://127.0.0.1:8080';
|
||||
let schoolToDelete: number | undefined;
|
||||
|
||||
test.afterEach(async ({ request }) => {
|
||||
|
||||
18
agiledancers-fe/nginx/default.conf.template
Normal file
18
agiledancers-fe/nginx/default.conf.template
Normal file
@@ -0,0 +1,18 @@
|
||||
server {
|
||||
listen 8080;
|
||||
server_name _;
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://${BACKEND_UPSTREAM};
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,23 @@
|
||||
import { defineConfig, devices } from '@playwright/test';
|
||||
|
||||
const externalURL = process.env['PLAYWRIGHT_BASE_URL'];
|
||||
|
||||
export default defineConfig({
|
||||
testDir: './e2e',
|
||||
fullyParallel: false,
|
||||
workers: 1,
|
||||
retries: 0,
|
||||
timeout: 60_000,
|
||||
reporter: 'list',
|
||||
reporter: process.env['CI']
|
||||
? [
|
||||
['list'],
|
||||
['junit', { outputFile: 'test-results/playwright.xml' }],
|
||||
['html', { open: 'never' }],
|
||||
]
|
||||
: 'list',
|
||||
use: {
|
||||
...devices['Desktop Chrome'],
|
||||
baseURL: 'http://127.0.0.1:4200',
|
||||
baseURL: externalURL || 'http://127.0.0.1:4200',
|
||||
trace: 'retain-on-failure',
|
||||
actionTimeout: 15_000,
|
||||
screenshot: 'only-on-failure',
|
||||
@@ -17,10 +25,12 @@ export default defineConfig({
|
||||
? { executablePath: process.env['PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH'] }
|
||||
: {},
|
||||
},
|
||||
webServer: {
|
||||
command: 'npm start -- --host 127.0.0.1 --port 4200',
|
||||
url: 'http://127.0.0.1:4200',
|
||||
reuseExistingServer: !process.env['CI'],
|
||||
timeout: 60_000,
|
||||
},
|
||||
webServer: externalURL
|
||||
? undefined
|
||||
: {
|
||||
command: 'npm start -- --host 127.0.0.1 --port 4200',
|
||||
url: 'http://127.0.0.1:4200',
|
||||
reuseExistingServer: !process.env['CI'],
|
||||
timeout: 60_000,
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user