Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build-and-lint:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install dependencies
run: npm ci

- name: Build project
run: npm run build

- name: Build Docker images
run: docker compose build

- name: Run tests with Docker Compose
run: docker compose run --rm templateangular-tests

12 changes: 12 additions & 0 deletions Dockerfile
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
# Build stage
FROM node:lts-alpine AS build

# Install chromium for testing
RUN apk add --no-cache chromium nss

WORKDIR /app
COPY package*.json ./
RUN npm install --silent
COPY . .

# Set environment variable for Karma to find Chrome
ENV CHROME_BIN=/usr/bin/chromium-browser

# Run tests (optional - remove if you want to run tests separately)
RUN npm test -- --watch=false --browsers=ChromeHeadlessNoSandbox

# Build the Angular app
RUN npm run build -- --output-path=dist

# Production stage (NGINX)
Expand Down
Empty file modified README.md
100644 → 100755
Empty file.
3 changes: 2 additions & 1 deletion angular.json
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@
"styles": [
"src/styles.css"
],
"scripts": []
"scripts": [],
"karmaConfig": "karma.conf.js"
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions docker-compose.yml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,13 @@ services:
NODE_ENV: production
ports:
- 3000:80

templateangular-tests:
container_name: angular-test
image: cypress/browsers:node-22.17.0-chrome-138.0.7204.92-1-ff-140.0.2-edge-138.0.3351.65-1
working_dir: /app
volumes:
- .:/app
environment:
CHROME_BIN: /usr/bin/google-chrome
entrypoint: ["npm", "run", "test", "--"]
39 changes: 39 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html

module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
jasmine: {},
},
jasmineHtmlReporter: {
suppressAll: true
},
coverageReporter: {
dir: require('path').join(__dirname, './coverage/template-angular'),
subdir: '.',
reporters: [
{ type: 'html' },
{ type: 'text-summary' }
]
},
reporters: ['progress', 'kjhtml'],
browsers: ['ChromeHeadlessNoSandbox'],
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
flags: ['--no-sandbox', `--disable-setuid-sandbox`]
}
},
restartOnFileChange: true
});
};
Loading