blob: b96c17b005f3d6f1e156ca61f687da265ee2bd2c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
|
name: Test builds
on: push
jobs:
test-frontend:
name: Test build frontend
runs-on: ubuntu-latest
strategy:
matrix:
node: [12.x, 14.x, 15.x]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Uses Node.JS ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- name: Cache Node.js modules
uses: actions/cache@v2
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.OS }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-${{ matrix.node-version }}
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Install dependencies
run: |
yarn install --frozen-lockfile
sudo apt update
sudo apt install -y firefox
working-directory: front
- name: Lint code
run: npm run lint
working-directory: front
# might need firefox...
- name: Test front
run: npm run unit
working-directory: front
- name: Test build front
run: npm run build
working-directory: front
sync-frontend:
name: Sync frontend release
runs-on: ubuntu-latest
needs: test-frontend
if: github.ref == 'refs/heads/master' || (github.event_name == 'push' && contains(github.ref, 'refs/tags/'))
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Uses Node.JS 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- name: Cache Node.js modules
uses: actions/cache@v2
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.OS }}-node-14.x-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-14.x
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Install dependencies
run: |
yarn install --frozen-lockfile
working-directory: front
- name: Build front
run: npm run build
working-directory: front
- name: Archive build (tag)
run: |
export NAME="front-dist-${{ github.event.release.tag_name }}"
zip -r "${NAME}.zip" dist/
working-directory: front
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
- name: Archive build (master)
run: |
export NAME="front-dist-master"
zip -r "${NAME}.zip" dist/
working-directory: front
if: github.ref == 'refs/heads/master'
- name: Deploy front (tag)
uses: burnett01/rsync-deployments@4.1
with:
switches: -avc
path: front-dist-${{ github.event.release.tag_name }}.zip
remote_path: /
remote_host: ${{ secrets.ASSETS_DEPLOY_HOST }}
remote_user: ${{ secrets.ASSETS_DEPLOY_USER }}
remote_key: ${{ secrets.ASSETS_DEPLOY_KEY }}
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
- name: Deploy front (master)
uses: burnett01/rsync-deployments@4.1
with:
switches: -avc
path: front-dist-master.zip
remote_path: /
remote_host: ${{ secrets.ASSETS_DEPLOY_HOST }}
remote_user: ${{ secrets.ASSETS_DEPLOY_USER }}
remote_key: ${{ secrets.ASSETS_DEPLOY_KEY }}
if: github.ref == 'refs/heads/master'
backend:
name: Test build backend
runs-on: ubuntu-latest
strategy:
matrix:
python: [3.6, 3.7, 3.8, 3.9]
services:
postgres:
image: postgres:12
env:
POSTGRES_DB: reel2bits_test
POSTGRES_USER: postgres
POSTGRES_HOST_AUTH_METHOD: trust
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Uses Python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Cache pip
uses: actions/cache@v2
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ matrix.python }}-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python }}
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install system dependencies
run: |
sudo add-apt-repository -y ppa:chris-needham/ppa
sudo apt update
sudo apt install -y sox libtag1v5 libmagic1 libffi7 ffmpeg postgresql-client-12 rsync
sudo apt install -y cmake build-essential git wget make libboost-all-dev rustc cargo
sudo apt install -y libsox-dev libsox-fmt-all libtag1-dev libmagic-dev libffi-dev libgd-dev libmad0-dev libsndfile1-dev libid3tag0-dev libmediainfo-dev audiowaveform
- name: Install python dependencies
run: |
pip install --requirement api/requirements.txt
pip install black
pip install flake8
touch front/dist/index.html
- name: Lint code
run: |
black --check .
flake8 . --count --show-source --statistics
working-directory: api
- name: Test backend
run: python setup.py test
working-directory: api
env:
AUTHLIB_INSECURE_TRANSPORT: 1
APP_SETTINGS: "config.testing.Config"
- name: Test full migrations
run: |
psql -U postgres -h localhost -w -c 'CREATE DATABASE reel2bits'
psql -U postgres -h localhost -w -c 'CREATE EXTENSION IF NOT EXISTS "uuid-ossp";' reel2bits
flask db upgrade
flask db-datas 000-seeds
flask db-datas 001-generate-tracks-uuids
flask db-datas 002-set-local-users
flask db-datas 003-set-user-quota
flask db-datas 004-update-file-sizes
flask db-datas 005-update-user-quotas
working-directory: api
|