setting project, adding environments to deployments
This commit is contained in:
parent
4a0c045b27
commit
a3aabb3b88
56
.github/workflows/ci.yml
vendored
56
.github/workflows/ci.yml
vendored
@ -1,30 +1,28 @@
|
|||||||
name: test and deploy
|
name: test and deploy
|
||||||
on: [push]
|
on: [push]
|
||||||
|
|
||||||
|
env:
|
||||||
|
python-version: '3.11'
|
||||||
|
poetry-version: 1.5.1
|
||||||
|
node-version: 20
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
strategy:
|
runs-on: ubuntu-latest
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
python-version: ['3.11']
|
|
||||||
poetry-version: [1.5.1]
|
|
||||||
node: [20]
|
|
||||||
os: [ubuntu-latest]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3 # get source
|
- uses: actions/checkout@v3 # get source
|
||||||
|
|
||||||
# PYTHON
|
# PYTHON
|
||||||
- name: Install Python ${{ matrix.python-version }}
|
- name: Install Python ${{ env.python-version }}
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ env.python-version }}
|
||||||
|
|
||||||
# PYTHON dependency management
|
# PYTHON dependency management
|
||||||
- name: Install Poetry ${{ matrix.poetry-version }}
|
- name: Install Poetry ${{ env.poetry-version }}
|
||||||
uses: abatilo/actions-poetry@v2.1.6
|
uses: abatilo/actions-poetry@v2.1.6
|
||||||
with:
|
with:
|
||||||
poetry-version: ${{ matrix.poetry-version }}
|
poetry-version: ${{ env.poetry-version }}
|
||||||
|
|
||||||
# PYTHON install dependencies
|
# PYTHON install dependencies
|
||||||
- name: Install Python Dependencies
|
- name: Install Python Dependencies
|
||||||
@ -43,10 +41,10 @@ jobs:
|
|||||||
run: poetry run python -m unittest discover -s tests
|
run: poetry run python -m unittest discover -s tests
|
||||||
|
|
||||||
# JS setup for testing
|
# JS setup for testing
|
||||||
- name: Install Node ${{ matrix.node }}
|
- name: Install Node ${{ env.node-version }}
|
||||||
uses: actions/setup-node@v2
|
uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node }}
|
node-version: ${{ env.node-version }}
|
||||||
|
|
||||||
# JS install from lock.json
|
# JS install from lock.json
|
||||||
- name: Install Node Packages
|
- name: Install Node Packages
|
||||||
@ -62,32 +60,33 @@ jobs:
|
|||||||
|
|
||||||
documentation:
|
documentation:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
environment: prod
|
||||||
needs: build # for ignoring bad builds
|
needs: build # for ignoring bad builds
|
||||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3 # get source
|
- uses: actions/checkout@v3 # get source
|
||||||
|
|
||||||
# PYTHON
|
# PYTHON
|
||||||
- name: Install Python 3.11
|
- name: Install Python ${{ env.python-version }}
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: '3.11'
|
python-version: ${{ env.python-version }}
|
||||||
|
|
||||||
# PYTHON for dependency export only, not installing
|
# PYTHON for dependency export only, not installing
|
||||||
- name: Install Poetry 1.5.1
|
- name: Install Poetry ${{ env.poetry-version }}
|
||||||
uses: abatilo/actions-poetry@v2.1.6
|
uses: abatilo/actions-poetry@v2.1.6
|
||||||
with:
|
with:
|
||||||
poetry-version: 1.5.1
|
poetry-version: ${{ env.poetry-version }}
|
||||||
|
|
||||||
# PYTHON install dependencies
|
# PYTHON install dependencies
|
||||||
- name: Install Python Dependencies
|
- name: Install Python Dependencies
|
||||||
run: poetry install
|
run: poetry install
|
||||||
|
|
||||||
# # JS setup for jsdoc
|
# # JS setup for jsdoc
|
||||||
# - name: Install Node 20
|
# - name: Install Node ${{ env.node-version }}
|
||||||
# uses: actions/setup-node@v2
|
# uses: actions/setup-node@v2
|
||||||
# with:
|
# with:
|
||||||
# node-version: 20
|
# node-version: ${{ env.node-version }}
|
||||||
|
|
||||||
# # JS setup for jsdoc
|
# # JS setup for jsdoc
|
||||||
# - name: Install jsdoc
|
# - name: Install jsdoc
|
||||||
@ -118,8 +117,8 @@ jobs:
|
|||||||
publish_dir: ./public
|
publish_dir: ./public
|
||||||
|
|
||||||
package:
|
package:
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
environment: prod
|
||||||
needs: [build] # for ignoring bad builds
|
needs: [build] # for ignoring bad builds
|
||||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
||||||
|
|
||||||
@ -147,32 +146,33 @@ jobs:
|
|||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
environment: prod
|
||||||
needs: build # for ignoring bad builds
|
needs: build # for ignoring bad builds
|
||||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3 # get source
|
- uses: actions/checkout@v3 # get source
|
||||||
|
|
||||||
# PYTHON (pinned to 3.9 for gcloud attribute mapping error)
|
# PYTHON (pinned to 3.9 for gcloud attribute mapping error)
|
||||||
- name: Install Python 3.11
|
- name: Install Python ${{ env.python-version }}
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: '3.11'
|
python-version: ${{ env.python-version }}
|
||||||
|
|
||||||
# PYTHON for dependency export only, not installing
|
# PYTHON for dependency export only, not installing
|
||||||
- name: Install Poetry 1.5.1
|
- name: Install Poetry ${{ env.poetry-version }}
|
||||||
uses: abatilo/actions-poetry@v2.1.6
|
uses: abatilo/actions-poetry@v2.1.6
|
||||||
with:
|
with:
|
||||||
poetry-version: 1.5.1
|
poetry-version: ${{ env.poetry-version }}
|
||||||
|
|
||||||
# PYTHON Export Poetry dependencies as requirements.txt
|
# PYTHON Export Poetry dependencies as requirements.txt
|
||||||
- name: Export Poetry Dependencies
|
- name: Export Poetry Dependencies
|
||||||
run: python admin.py pydepend
|
run: python admin.py pydepend
|
||||||
|
|
||||||
# JS setup
|
# JS setup
|
||||||
- name: Install Node 20
|
- name: Install Node ${{ env.node-version }}
|
||||||
uses: actions/setup-node@v2
|
uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
node-version: 20
|
node-version: ${{ env.node-version }}
|
||||||
|
|
||||||
# JS install from lock.json
|
# JS install from lock.json
|
||||||
- name: Install Node Packages
|
- name: Install Node Packages
|
||||||
@ -199,7 +199,7 @@ jobs:
|
|||||||
|
|
||||||
# DEPLOY set project
|
# DEPLOY set project
|
||||||
- name: Set GCP Project
|
- name: Set GCP Project
|
||||||
run: python admin.py set_project
|
run: python admin.py set_project ${{ vars.GCP_PROJECT }}
|
||||||
|
|
||||||
# DEPLOY domain routes
|
# DEPLOY domain routes
|
||||||
- name: Deploy dispatch.yaml
|
- name: Deploy dispatch.yaml
|
||||||
|
2
admin.py
2
admin.py
@ -74,7 +74,7 @@ class Admin(Cmd):
|
|||||||
Set project setting in gcloud console
|
Set project setting in gcloud console
|
||||||
"""
|
"""
|
||||||
print('>> setting project')
|
print('>> setting project')
|
||||||
subprocess.check_call('gcloud config set project sarsooxyz', shell=True)
|
subprocess.check_call(f'gcloud config set project {args.strip()}', shell=True)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def gcloud_project(self):
|
def gcloud_project(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user