adding CD to workflow
This commit is contained in:
parent
24fd9c1802
commit
fb7f8a6334
50
.github/workflows/ci.yml
vendored
50
.github/workflows/ci.yml
vendored
@ -8,7 +8,7 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
python-version: [3.8]
|
python-version: [3.8]
|
||||||
poetry-version: [1.1.4]
|
poetry-version: [1.1.4]
|
||||||
# node: [ '10', '12' ]
|
# node: [ '10', '12', '14' ]
|
||||||
os: [ubuntu-20.04, ubuntu-18.04, macos-latest, windows-latest]
|
os: [ubuntu-20.04, ubuntu-18.04, macos-latest, windows-latest]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
@ -27,14 +27,6 @@ jobs:
|
|||||||
- name: Install Dependencies # PYTHON install dependencies
|
- name: Install Dependencies # PYTHON install dependencies
|
||||||
run: poetry install
|
run: poetry install
|
||||||
|
|
||||||
# - name: Setup node # JS setup
|
|
||||||
# uses: actions/setup-node@v2
|
|
||||||
# with:
|
|
||||||
# node-version: ${{ matrix.node }}
|
|
||||||
|
|
||||||
# - name: Install Node Packages # JS install
|
|
||||||
# run: npm ci
|
|
||||||
|
|
||||||
- name: Set up Cloud SDK
|
- name: Set up Cloud SDK
|
||||||
uses: google-github-actions/setup-gcloud@master
|
uses: google-github-actions/setup-gcloud@master
|
||||||
with:
|
with:
|
||||||
@ -44,3 +36,43 @@ jobs:
|
|||||||
|
|
||||||
- name: Run Tests # test script
|
- name: Run Tests # test script
|
||||||
run: poetry run python -m unittest discover -s tests
|
run: poetry run python -m unittest discover -s tests
|
||||||
|
|
||||||
|
# - name: Setup node # JS setup for testing
|
||||||
|
# uses: actions/setup-node@v2
|
||||||
|
# with:
|
||||||
|
# node-version: ${{ matrix.node }}
|
||||||
|
|
||||||
|
# - name: Install Node Packages # JS install
|
||||||
|
# run: npm ci
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
needs: build
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2 # get source
|
||||||
|
|
||||||
|
- name: Install Python 3
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: 3.8
|
||||||
|
|
||||||
|
- name: Setup Node # JS setup
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: 14
|
||||||
|
|
||||||
|
- name: Install Node Packages # JS install
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Set up Cloud SDK
|
||||||
|
uses: google-github-actions/setup-gcloud@master
|
||||||
|
with:
|
||||||
|
project_id: ${{ secrets.GCP_PROJECT_ID }}
|
||||||
|
service_account_key: ${{ secrets.GCP_SA_KEY }}
|
||||||
|
export_default_credentials: true
|
||||||
|
|
||||||
|
- name: Deploy API to App Engine
|
||||||
|
run: python admin.py all
|
||||||
|
|
||||||
|
- name: Deploy Cron Functions
|
||||||
|
run: python admin.py all_cron
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,5 +1,6 @@
|
|||||||
scratch.py
|
scratch.py
|
||||||
service.json
|
service.json
|
||||||
|
requirements.txt
|
||||||
|
|
||||||
*~*
|
*~*
|
||||||
*#
|
*#
|
||||||
@ -12,7 +13,7 @@ node_modules/
|
|||||||
*$py.class
|
*$py.class
|
||||||
|
|
||||||
.idea
|
.idea
|
||||||
.vscode
|
launch.json
|
||||||
|
|
||||||
# C extensions
|
# C extensions
|
||||||
*.so
|
*.so
|
||||||
|
12
.vscode/settings.json
vendored
Normal file
12
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"python.testing.unittestArgs": [
|
||||||
|
"-v",
|
||||||
|
"-s",
|
||||||
|
"./tests",
|
||||||
|
"-p",
|
||||||
|
"test*.py"
|
||||||
|
],
|
||||||
|
"python.testing.pytestEnabled": false,
|
||||||
|
"python.testing.nosetestsEnabled": false,
|
||||||
|
"python.testing.unittestEnabled": true
|
||||||
|
}
|
47
admin.py
47
admin.py
@ -23,28 +23,29 @@ class Admin(Cmd):
|
|||||||
print('>> freezing dependencies')
|
print('>> freezing dependencies')
|
||||||
self.export_filtered_dependencies()
|
self.export_filtered_dependencies()
|
||||||
|
|
||||||
print('>> backing up a directory')
|
# Now done via online repos, not static injection
|
||||||
os.chdir(Path(__file__).absolute().parent.parent)
|
# print('>> backing up a directory')
|
||||||
|
# os.chdir(Path(__file__).absolute().parent.parent)
|
||||||
|
|
||||||
print('>> deleting old deployment stage')
|
# print('>> deleting old deployment stage')
|
||||||
shutil.rmtree(stage_dir, ignore_errors=True)
|
# shutil.rmtree(stage_dir, ignore_errors=True)
|
||||||
|
|
||||||
print('>> copying main source')
|
# print('>> copying main source')
|
||||||
shutil.copytree('playlist-manager' if Path('playlist-manager').exists() else 'Music-Tools',
|
# shutil.copytree('playlist-manager' if Path('playlist-manager').exists() else 'Music-Tools',
|
||||||
stage_dir,
|
# stage_dir,
|
||||||
ignore=lambda path, contents:
|
# ignore=lambda path, contents:
|
||||||
contents if any(i in Path(path).parts for i in folders_to_ignore) else []
|
# contents if any(i in Path(path).parts for i in folders_to_ignore) else []
|
||||||
)
|
# )
|
||||||
|
|
||||||
for dependency in Admin.locals:
|
# for dependency in Admin.locals:
|
||||||
print(f'>> injecting {dependency}')
|
# print(f'>> injecting {dependency}')
|
||||||
shutil.copytree(
|
# shutil.copytree(
|
||||||
Path(dependency, dependency),
|
# Path(dependency, dependency),
|
||||||
Path(stage_dir, dependency)
|
# Path(stage_dir, dependency)
|
||||||
)
|
# )
|
||||||
|
|
||||||
os.chdir(stage_dir)
|
# os.chdir(stage_dir)
|
||||||
os.system('gcloud config set project sarsooxyz')
|
# os.system('gcloud config set project sarsooxyz')
|
||||||
|
|
||||||
def prepare_frontend(self):
|
def prepare_frontend(self):
|
||||||
print('>> building css')
|
print('>> building css')
|
||||||
@ -176,14 +177,14 @@ class Admin(Cmd):
|
|||||||
self.export_filtered_dependencies()
|
self.export_filtered_dependencies()
|
||||||
|
|
||||||
def export_filtered_dependencies(self):
|
def export_filtered_dependencies(self):
|
||||||
string = os.popen('poetry export -f requirements.txt').read()
|
string = os.popen('poetry export -f requirements.txt --without-hashes').read()
|
||||||
|
|
||||||
depend = string.split('\n')
|
depend = string.split('\n')
|
||||||
|
|
||||||
filtered = [i for i in depend if not any(i.startswith(local) for local in Admin.locals)]
|
# filtered = [i for i in depend if not any(i.startswith(local) for local in Admin.locals)]
|
||||||
filtered = [i for i in filtered if '==' in i]
|
# filtered = [i for i in filtered if '==' in i]
|
||||||
filtered = [i[:-2] for i in filtered] # get rid of space and slash at end of line
|
# filtered = [i[:-2] for i in filtered] # get rid of space and slash at end of line
|
||||||
filtered = [i.split(';')[0] for i in filtered]
|
filtered = [i.split(';')[0] for i in depend]
|
||||||
|
|
||||||
with open('requirements.txt', 'w') as f:
|
with open('requirements.txt', 'w') as f:
|
||||||
f.write("\n".join(filtered))
|
f.write("\n".join(filtered))
|
||||||
|
@ -8,7 +8,6 @@ homepage = "https://music.sarsoo.xyz/"
|
|||||||
repository = "https://github.com/Sarsoo/Music-Tools"
|
repository = "https://github.com/Sarsoo/Music-Tools"
|
||||||
|
|
||||||
[tool.poetry.scripts]
|
[tool.poetry.scripts]
|
||||||
backend-dev = 'music.music:start'
|
|
||||||
test = 'admin:test'
|
test = 'admin:test'
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
backports-datetime-fromisoformat==1.0.0
|
|
||||||
beautifulsoup4==4.9.3
|
|
||||||
cachetools==4.2.1
|
|
||||||
certifi==2020.12.5
|
|
||||||
chardet==4.0.0
|
|
||||||
click==7.1.2
|
|
||||||
fireo==1.4.1
|
|
||||||
flask==1.1.2
|
|
||||||
google-api-core==1.25.1
|
|
||||||
google-auth==1.24.0
|
|
||||||
google-cloud-core==1.5.0
|
|
||||||
google-cloud-firestore==1.9.0
|
|
||||||
google-cloud-logging==1.15.1
|
|
||||||
google-cloud-pubsub==1.7.0
|
|
||||||
google-cloud-tasks==1.5.0
|
|
||||||
googleapis-common-protos==1.52.0
|
|
||||||
grpc-google-iam-v1==0.12.3
|
|
||||||
grpcio==1.35.0
|
|
||||||
idna==2.10
|
|
||||||
itsdangerous==1.1.0
|
|
||||||
jinja2==2.11.2
|
|
||||||
markupsafe==1.1.1
|
|
||||||
protobuf==3.14.0
|
|
||||||
pyasn1-modules==0.2.8
|
|
||||||
pyasn1==0.4.8
|
|
||||||
pytz==2020.5
|
|
||||||
requests==2.25.1
|
|
||||||
rsa==4.7
|
|
||||||
six==1.15.0
|
|
||||||
soupsieve==2.1
|
|
||||||
tabulate==0.8.7
|
|
||||||
urllib3==1.26.3
|
|
||||||
werkzeug==1.0.1
|
|
Loading…
Reference in New Issue
Block a user