adding CD to workflow
This commit is contained in:
parent
24fd9c1802
commit
fb7f8a6334
52
.github/workflows/ci.yml
vendored
52
.github/workflows/ci.yml
vendored
@ -8,7 +8,7 @@ jobs:
|
||||
matrix:
|
||||
python-version: [3.8]
|
||||
poetry-version: [1.1.4]
|
||||
# node: [ '10', '12' ]
|
||||
# node: [ '10', '12', '14' ]
|
||||
os: [ubuntu-20.04, ubuntu-18.04, macos-latest, windows-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
@ -27,14 +27,6 @@ jobs:
|
||||
- name: Install Dependencies # PYTHON install dependencies
|
||||
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
|
||||
uses: google-github-actions/setup-gcloud@master
|
||||
with:
|
||||
@ -43,4 +35,44 @@ jobs:
|
||||
export_default_credentials: true
|
||||
|
||||
- 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
|
||||
service.json
|
||||
requirements.txt
|
||||
|
||||
*~*
|
||||
*#
|
||||
@ -12,7 +13,7 @@ node_modules/
|
||||
*$py.class
|
||||
|
||||
.idea
|
||||
.vscode
|
||||
launch.json
|
||||
|
||||
# C extensions
|
||||
*.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')
|
||||
self.export_filtered_dependencies()
|
||||
|
||||
print('>> backing up a directory')
|
||||
os.chdir(Path(__file__).absolute().parent.parent)
|
||||
# Now done via online repos, not static injection
|
||||
# print('>> backing up a directory')
|
||||
# os.chdir(Path(__file__).absolute().parent.parent)
|
||||
|
||||
print('>> deleting old deployment stage')
|
||||
shutil.rmtree(stage_dir, ignore_errors=True)
|
||||
# print('>> deleting old deployment stage')
|
||||
# shutil.rmtree(stage_dir, ignore_errors=True)
|
||||
|
||||
print('>> copying main source')
|
||||
shutil.copytree('playlist-manager' if Path('playlist-manager').exists() else 'Music-Tools',
|
||||
stage_dir,
|
||||
ignore=lambda path, contents:
|
||||
contents if any(i in Path(path).parts for i in folders_to_ignore) else []
|
||||
)
|
||||
# print('>> copying main source')
|
||||
# shutil.copytree('playlist-manager' if Path('playlist-manager').exists() else 'Music-Tools',
|
||||
# stage_dir,
|
||||
# ignore=lambda path, contents:
|
||||
# contents if any(i in Path(path).parts for i in folders_to_ignore) else []
|
||||
# )
|
||||
|
||||
for dependency in Admin.locals:
|
||||
print(f'>> injecting {dependency}')
|
||||
shutil.copytree(
|
||||
Path(dependency, dependency),
|
||||
Path(stage_dir, dependency)
|
||||
)
|
||||
# for dependency in Admin.locals:
|
||||
# print(f'>> injecting {dependency}')
|
||||
# shutil.copytree(
|
||||
# Path(dependency, dependency),
|
||||
# Path(stage_dir, dependency)
|
||||
# )
|
||||
|
||||
os.chdir(stage_dir)
|
||||
os.system('gcloud config set project sarsooxyz')
|
||||
# os.chdir(stage_dir)
|
||||
# os.system('gcloud config set project sarsooxyz')
|
||||
|
||||
def prepare_frontend(self):
|
||||
print('>> building css')
|
||||
@ -176,14 +177,14 @@ class Admin(Cmd):
|
||||
self.export_filtered_dependencies()
|
||||
|
||||
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')
|
||||
|
||||
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[:-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 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[:-2] for i in filtered] # get rid of space and slash at end of line
|
||||
filtered = [i.split(';')[0] for i in depend]
|
||||
|
||||
with open('requirements.txt', 'w') as f:
|
||||
f.write("\n".join(filtered))
|
||||
|
@ -8,7 +8,6 @@ homepage = "https://music.sarsoo.xyz/"
|
||||
repository = "https://github.com/Sarsoo/Music-Tools"
|
||||
|
||||
[tool.poetry.scripts]
|
||||
backend-dev = 'music.music:start'
|
||||
test = 'admin:test'
|
||||
|
||||
[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