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/**
|
|
|
|
- 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:
|
|
|
|
UI_DIRECTORY: ./frontend
|
2021-06-20 14:56:16 +00:00
|
|
|
UI_ARTIFACT_NAME: ui
|
2021-03-25 14:22:43 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
Frontend:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@v2
|
2021-06-20 14:49:29 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 1
|
2021-03-25 14:22:43 +00:00
|
|
|
|
2021-03-27 05:48:12 +00:00
|
|
|
- name: Cache node_modules
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: '${{ env.UI_DIRECTORY }}/node_modules'
|
|
|
|
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
restore-keys: ${{ runner.os }}-modules-
|
|
|
|
|
2021-03-27 05:56:28 +00:00
|
|
|
- name: Setup NodeJS
|
|
|
|
uses: actions/setup-node@v2
|
2021-03-25 14:22:43 +00:00
|
|
|
with:
|
2021-03-27 05:56:28 +00:00
|
|
|
node-version: "15.x"
|
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
|
|
|
|
|
|
|
- name: Build
|
|
|
|
run: npm run build
|
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 }}
|
|
|
|
|
2021-03-27 05:48:12 +00:00
|
|
|
- uses: actions/upload-artifact@v2
|
|
|
|
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
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 1
|
|
|
|
|
2021-06-20 13:12:31 +00:00
|
|
|
- name: Set up Python 3.8
|
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: '3.8'
|
|
|
|
|
2021-06-20 14:49:29 +00:00
|
|
|
- name: Install UI
|
|
|
|
uses: actions/download-artifact@v2
|
|
|
|
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
|