mirror of
https://github.com/morpheus65535/bazarr
synced 2024-12-23 00:03:33 +00:00
127 lines
3.1 KiB
YAML
127 lines
3.1 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [development]
|
|
paths:
|
|
- frontend/**
|
|
- bazarr/**
|
|
- libs/**
|
|
- migrations/**
|
|
- bazarr.py
|
|
- requirements.txt
|
|
- dev-requirements.txt
|
|
- .github/workflows/ci.yml
|
|
pull_request:
|
|
branches: [development]
|
|
|
|
env:
|
|
UI_DIRECTORY: ./frontend
|
|
UI_ARTIFACT_NAME: ui
|
|
|
|
jobs:
|
|
Frontend:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Get source branch name
|
|
uses: haya14busa/action-cond@v1
|
|
id: branch_ref
|
|
with:
|
|
cond: ${{ github.event_name == 'pull_request' }}
|
|
if_true: ${{ github.head_ref }}
|
|
if_false: ${{ github.ref }}
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3
|
|
with:
|
|
ref: ${{ steps.branch_ref.outputs.value }}
|
|
fetch-depth: 1
|
|
|
|
- name: Cache node_modules
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: "${{ env.UI_DIRECTORY }}/node_modules"
|
|
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
|
|
restore-keys: ${{ runner.os }}-modules-
|
|
|
|
- name: Setup NodeJS
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: "lts/*"
|
|
|
|
- name: Install dependencies
|
|
run: npm install
|
|
working-directory: ${{ env.UI_DIRECTORY }}
|
|
|
|
- name: Check Types
|
|
run: npm run check:ts
|
|
working-directory: ${{ env.UI_DIRECTORY }}
|
|
|
|
- name: Check Styles
|
|
run: npm run check
|
|
working-directory: ${{ env.UI_DIRECTORY }}
|
|
|
|
- name: Check Format
|
|
run: npm run check:fmt
|
|
working-directory: ${{ env.UI_DIRECTORY }}
|
|
|
|
- name: Unit Test
|
|
run: npm test
|
|
working-directory: ${{ env.UI_DIRECTORY }}
|
|
|
|
- name: Build
|
|
run: npm run build:ci
|
|
working-directory: ${{ env.UI_DIRECTORY }}
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: ${{ env.UI_ARTIFACT_NAME }}
|
|
path: "${{ env.UI_DIRECTORY }}/build"
|
|
|
|
Backend:
|
|
runs-on: ubuntu-latest
|
|
needs: Frontend
|
|
|
|
steps:
|
|
- name: Get source branch name
|
|
uses: haya14busa/action-cond@v1
|
|
id: branch_ref
|
|
with:
|
|
cond: ${{ github.event_name == 'pull_request' }}
|
|
if_true: ${{ github.head_ref }}
|
|
if_false: ${{ github.ref }}
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3
|
|
with:
|
|
ref: ${{ steps.branch_ref.outputs.value }}
|
|
fetch-depth: 1
|
|
|
|
- name: Set up Python 3.8
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: "3.8"
|
|
|
|
- name: Install UI
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: ${{ env.UI_ARTIFACT_NAME }}
|
|
path: "${{ env.UI_DIRECTORY }}/build"
|
|
|
|
- name: Install Python dependencies
|
|
run: pip install -r requirements.txt
|
|
|
|
- name: Unit Tests
|
|
run: |
|
|
python3 bazarr.py &
|
|
PID=$!
|
|
sleep 15
|
|
if kill -s 0 $PID
|
|
then
|
|
echo "**** Bazarr launch successful ****"
|
|
kill $PID
|
|
exit 0
|
|
else
|
|
echo "**** Bazarr launch failed ****"
|
|
exit 1
|
|
fi
|