75 lines
2.2 KiB
YAML
75 lines
2.2 KiB
YAML
name: Frontend CI/CD
|
|
|
|
on:
|
|
push:
|
|
branches: [production]
|
|
paths:
|
|
- '**'
|
|
- '.gitea/workflows/frontend.yml'
|
|
|
|
pull_request:
|
|
branches: [production]
|
|
paths:
|
|
- '**'
|
|
- '.gitea/workflows/frontend.yml'
|
|
|
|
jobs:
|
|
build-and-test:
|
|
name: Build, Lint & Test
|
|
runs-on: self-hosted
|
|
container:
|
|
image: mirror2.chabokan.net/ubuntu:22.04
|
|
options: --add-host gitea:172.17.0.1
|
|
|
|
steps:
|
|
- name: Setup Ubuntu apt mirrors
|
|
run: |
|
|
tee /etc/apt/sources.list > /dev/null <<'EOF'
|
|
deb http://mirror.iranserver.com/ubuntu/ jammy main restricted universe multiverse
|
|
deb http://mirror.iranserver.com/ubuntu/ jammy-updates main restricted universe multiverse
|
|
deb http://mirror.iranserver.com/ubuntu/ jammy-security main restricted universe multiverse
|
|
deb http://mirror.iranserver.com/ubuntu/ jammy-backports main restricted universe multiverse
|
|
|
|
deb [trusted=yes] https://mirror2.chabokan.net/ubuntu focal main universe
|
|
deb [trusted=yes] https://mirror2.chabokan.net/ubuntu focal-updates main universe
|
|
deb [trusted=yes] https://mirror2.chabokan.net/ubuntu focal-security main universe
|
|
EOF
|
|
apt-get update
|
|
|
|
- name: Install system dependencies
|
|
run: |
|
|
apt-get install -y git nodejs npm build-essential
|
|
|
|
- name: Checkout repository
|
|
run: |
|
|
git clone http://gitea:3000/sajad-dev/Frontend.git .
|
|
|
|
- name: Configure NPM Mirrors
|
|
run: |
|
|
npm config set registry https://package-mirror.liara.ir/repository/npm/
|
|
|
|
npm config set @runflare:registry https://mirror-npm.runflare.com/
|
|
npm config set @chabokan:registry https://mirror2.chabokan.net/npm/
|
|
|
|
npm config set strict-ssl false
|
|
npm config set fetch-retries 5
|
|
npm config set fetch-retry-mintimeout 20000
|
|
|
|
- name: Test
|
|
run: |
|
|
ls
|
|
pwd
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
npm install --registry=https://package-mirror.liara.ir/repository/npm/
|
|
|
|
- name: Build project
|
|
run: |
|
|
npm run build --if-present
|
|
|
|
- name: Run Lint
|
|
run: |
|
|
npm run lint --if-present
|
|
|