2021-03-25 14:22:43 +00:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2021-03-27 05:48:12 +00:00
|
|
|
branches: [development]
|
2021-03-27 16:31:29 +00:00
|
|
|
paths:
|
|
|
|
- frontend/**
|
2021-06-20 14:49:29 +00:00
|
|
|
- bazarr/**
|
|
|
|
- libs/**
|
2023-08-04 14:27:36 +00:00
|
|
|
- migrations/**
|
2021-06-20 14:49:29 +00:00
|
|
|
- bazarr.py
|
|
|
|
- requirements.txt
|
|
|
|
- dev-requirements.txt
|
2021-03-27 16:31:29 +00:00
|
|
|
- .github/workflows/ci.yml
|
2021-03-25 14:22:43 +00:00
|
|
|
pull_request:
|
2021-03-27 05:48:12 +00:00
|
|
|
branches: [development]
|
2021-03-27 16:31:29 +00:00
|
|
|
|
2021-06-20 14:49:29 +00:00
|
|
|
env:
|
2022-03-16 06:26:15 +00:00
|
|
|
UI_DIRECTORY: ./frontend
|
|
|
|
UI_ARTIFACT_NAME: ui
|
2021-03-25 14:22:43 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
Frontend:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
2023-10-26 16:22:19 +00:00
|
|
|
uses: actions/checkout@v4
|
2021-03-25 14:22:43 +00:00
|
|
|
|
2021-03-27 05:48:12 +00:00
|
|
|
- name: Cache node_modules
|
2022-03-21 23:31:09 +00:00
|
|
|
uses: actions/cache@v3
|
2021-03-27 05:48:12 +00:00
|
|
|
with:
|
2022-03-16 06:26:15 +00:00
|
|
|
path: "${{ env.UI_DIRECTORY }}/node_modules"
|
2021-03-27 05:48:12 +00:00
|
|
|
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
restore-keys: ${{ runner.os }}-modules-
|
|
|
|
|
2021-03-27 05:56:28 +00:00
|
|
|
- name: Setup NodeJS
|
2022-03-15 01:33:46 +00:00
|
|
|
uses: actions/setup-node@v3
|
2021-03-25 14:22:43 +00:00
|
|
|
with:
|
2022-08-21 12:06:17 +00:00
|
|
|
node-version: "lts/*"
|
2021-03-25 14:22:43 +00:00
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: npm install
|
2021-03-27 05:48:12 +00:00
|
|
|
working-directory: ${{ env.UI_DIRECTORY }}
|
2021-03-25 14:22:43 +00:00
|
|
|
|
2022-03-16 06:26:15 +00:00
|
|
|
- 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
|
2021-03-27 05:48:12 +00:00
|
|
|
working-directory: ${{ env.UI_DIRECTORY }}
|
|
|
|
|
2021-08-14 12:59:08 +00:00
|
|
|
- name: Unit Test
|
|
|
|
run: npm test
|
|
|
|
working-directory: ${{ env.UI_DIRECTORY }}
|
|
|
|
|
2022-03-16 06:26:15 +00:00
|
|
|
- name: Build
|
|
|
|
run: npm run build:ci
|
|
|
|
working-directory: ${{ env.UI_DIRECTORY }}
|
|
|
|
|
2022-04-12 09:05:34 +00:00
|
|
|
- uses: actions/upload-artifact@v3
|
2021-03-27 05:48:12 +00:00
|
|
|
with:
|
2021-06-20 14:56:16 +00:00
|
|
|
name: ${{ env.UI_ARTIFACT_NAME }}
|
2021-03-27 05:56:28 +00:00
|
|
|
path: "${{ env.UI_DIRECTORY }}/build"
|
2021-06-20 13:12:31 +00:00
|
|
|
|
2021-06-20 14:49:29 +00:00
|
|
|
Backend:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: Frontend
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
2023-10-26 16:22:19 +00:00
|
|
|
uses: actions/checkout@v4
|
2021-06-20 14:49:29 +00:00
|
|
|
|
2021-06-20 13:12:31 +00:00
|
|
|
- name: Set up Python 3.8
|
2022-06-15 02:25:11 +00:00
|
|
|
uses: actions/setup-python@v4
|
2021-06-20 13:12:31 +00:00
|
|
|
with:
|
2022-03-16 06:26:15 +00:00
|
|
|
python-version: "3.8"
|
2021-06-20 13:12:31 +00:00
|
|
|
|
2021-06-20 14:49:29 +00:00
|
|
|
- name: Install UI
|
2022-04-19 03:05:39 +00:00
|
|
|
uses: actions/download-artifact@v3
|
2021-06-20 14:49:29 +00:00
|
|
|
with:
|
2021-06-20 14:56:16 +00:00
|
|
|
name: ${{ env.UI_ARTIFACT_NAME }}
|
2021-06-20 14:49:29 +00:00
|
|
|
path: "${{ env.UI_DIRECTORY }}/build"
|
|
|
|
|
2021-06-20 13:12:31 +00:00
|
|
|
- name: Install Python dependencies
|
2021-06-20 14:49:29 +00:00
|
|
|
run: pip install -r requirements.txt
|
2021-06-20 13:12:31 +00:00
|
|
|
|
2021-06-20 14:49:29 +00:00
|
|
|
- name: Unit Tests
|
2021-06-20 13:12:31 +00:00
|
|
|
run: |
|
2021-06-20 14:49:29 +00:00
|
|
|
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
|