55 lines
1.4 KiB
YAML
55 lines
1.4 KiB
YAML
name: Node.js CI
|
||
|
||
on:
|
||
push:
|
||
branches: [main]
|
||
|
||
jobs:
|
||
lint:
|
||
runs-on: ubuntu-latest
|
||
container: node:18-alpine
|
||
steps:
|
||
# Устанавливаем git прямо внутрь контейнера alpine
|
||
- name: Install Git
|
||
run: apk add --no-cache git
|
||
|
||
- name: Clone repository
|
||
run: git clone https://iux-gitea.myddns.me/24_LitvintsevaVD/docker_lab.git .
|
||
|
||
- name: Install dependencies
|
||
run: npm ci
|
||
|
||
- name: Run ESLint
|
||
run: npm run lint
|
||
|
||
test:
|
||
runs-on: ubuntu-latest
|
||
needs: lint
|
||
container: node:18-alpine
|
||
steps:
|
||
- name: Install Git
|
||
run: apk add --no-cache git
|
||
|
||
- name: Clone repository
|
||
run: git clone https://iux-gitea.myddns.me/24_LitvintsevaVD/docker_lab.git .
|
||
|
||
- name: Install dependencies
|
||
run: npm ci
|
||
|
||
- name: Run Tests
|
||
run: npm run test
|
||
|
||
build:
|
||
runs-on: ubuntu-latest
|
||
needs: test
|
||
steps:
|
||
# На этапе сборки докера контейнер node не используется, git ставим стандартным apt, если нужен
|
||
- name: Install Git on Host
|
||
run: sudo apt-get update && sudo apt-get install -y git
|
||
|
||
- name: Clone repository
|
||
run: git clone https://iux-gitea.myddns.me/24_LitvintsevaVD/docker_lab.git .
|
||
|
||
- name: Build Docker Image
|
||
run: docker build -t docker_lab:latest .
|