tag model (#20) #813
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Python Checks | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
push: | |
branches: | |
- main | |
- 'v*' | |
tags: | |
- 'v*' | |
jobs: | |
ts_pipeline: | |
name: Node CI Pipeline | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node: [16] | |
env: | |
ENV: CI | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install node ${{ matrix.node }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node }} | |
- name: Cache node modules | |
uses: actions/cache@v3 | |
with: | |
path: ui/node_modules/ | |
key: v1-${{ matrix.node }}-${{ hashFiles('ui/yarn.lock') }} | |
- name: Yarn Install | |
run: | | |
make install-ts | |
- name: Unused exports (ts) | |
run: | | |
make ts-unused | |
- name: Lint Code (ts) | |
run: | | |
make lint-ts | |
- name: Test Code (ts) | |
run: | | |
make test-ts | |
- name: Test Build (ts) | |
run: | | |
make ts-build | |
lints_pipeline: | |
name: Lints CI Pipeline | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python: ['3.11'] | |
env: | |
ENV: CI | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
cache: 'pip' | |
- name: Install dependencies | |
run: | | |
make install PYTHON=python | |
- name: Lint Code (use uppercase TODO, XXX, FIXME, NOTE and explain nopep8) | |
run: | | |
make lint-comment | |
- name: Lint Code (sort requirements) | |
run: | | |
make lint-requirements | |
- name: Lint Code (requirements complete) | |
run: | | |
make requirements-complete | |
- name: Lint Code (use f"" style formating) | |
run: | | |
make lint-stringformat | |
- name: Lint Code (indent in fours) | |
run: | | |
make lint-indent | |
- name: Lint Code (no f"a", "{a}", or f'{a}') | |
run: | | |
make lint-forgottenformat PYTHON=python | |
- name: Only pyi in stubs | |
run: | | |
make lint-pyi | |
- name: Lint Code (missing trailing comma) | |
run: | | |
make lint-flake8 | |
- name: Lint Code (pycodestyle) | |
run: | | |
make lint-pycodestyle | |
- name: Lint Code (type-check) | |
run: | | |
make lint-type-check | |
- name: Lint Code (pylint) | |
run: | | |
make lint-pylint | |
deploy_pipeline_v2: | |
name: Deploy | |
needs: [lints_pipeline, ts_pipeline] # , tests_pipeline | |
if: startsWith(github.ref, 'refs/tags/v2') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Docker login | |
uses: azure/docker-login@v1 | |
with: | |
login-server: acclabdocker.azurecr.io | |
username: ${{ secrets.REGISTRY_USERNAME }} | |
password: ${{ secrets.REGISTRY_PASSWORD }} | |
- name: Set env | |
run: echo "IMAGE_TAG=$(make -s name)" >> $GITHUB_ENV | |
- name: Build docker image | |
run: | | |
make -s build | |
env: | |
CONFIG_PATH: "-" | |
- name: Push docker image | |
run: | | |
make -s dockerpush | |
# - name: Login via Azure CLI | |
# uses: azure/login@v1 | |
# with: | |
# creds: ${{ secrets.AZURE_CREDENTIALS }} | |
# - name: Azure CLI script | |
# uses: azure/CLI@v1 | |
# with: | |
# azcliversion: 2.30.0 | |
# inlineScript: | | |
# az webapp create --resource-group ${{ secrets.AZURE_RESOURCE_GROUP }} --plan ${{ secrets.AZURE_SERVICE_PLAN }} --name 'acclabs-nlpapi' --multicontainer-config-type compose --multicontainer-config-file $GITHUB_WORKSPACE/docker-compose.yml | |
deploy_pipeline: | |
name: Deploy | |
needs: lints_pipeline # , tests_pipeline | |
if: startsWith(github.ref, 'refs/tags/v1') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Docker login | |
uses: azure/docker-login@v1 | |
with: | |
login-server: acclabdocker.azurecr.io | |
username: ${{ secrets.REGISTRY_USERNAME }} | |
password: ${{ secrets.REGISTRY_PASSWORD }} | |
- name: Set env | |
run: echo "IMAGE_TAG=$(make -s name)" >> $GITHUB_ENV | |
- name: Build docker image | |
run: | | |
make -s build | |
env: | |
CONFIG_PATH: "-" | |
- name: Push docker image | |
run: | | |
make -s dockerpush | |
- uses: azure/webapps-deploy@v2 | |
with: | |
app-name: 'nlpapi' | |
publish-profile: ${{ secrets.AZURE_WEBAPP_LEGACY_PUBLISH_PROFILE }} | |
images: 'acclabdocker.azurecr.io/smartsearch:${{ env.IMAGE_TAG }}' |