Skip to content

Commit

Permalink
fix: splitting variables and secrets and reconfiguring pipeline to us…
Browse files Browse the repository at this point in the history
…e new structure. Also added an indicator to skip the ci pipeline if pyproject.toml
  • Loading branch information
svange committed Jul 18, 2024
1 parent 3b4cde4 commit 4c93fda
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 166 deletions.
101 changes: 32 additions & 69 deletions .github/workflows/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,34 @@ on:
branches:
- 'main'
- 'dev'
# - 'feature**'
delete:
branches:
# - 'feature**'
tags-ignore:
- '*'



env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
PYPI_TEST_TOKEN: ${{ secrets.PYPI_TEST_TOKEN }}
PIPELINE_USER_ACCESS_KEY_ID: ${{ secrets.GH_AWS_ACCESS_KEY_ID }}
PIPELINE_USER_SECRET_ACCESS_KEY: ${{ secrets.GH_AWS_SECRET_ACCESS_KEY }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
DEV_OB_PROVIDER_API_KEY: ${{ secrets.DEV_OB_PROVIDER_API_KEY }}
PROD_OB_PROVIDER_API_KEY: ${{ secrets.PROD_OB_PROVIDER_API_KEY }}

SAM_TEMPLATE: resources.yaml
TESTING_STACK_NAME: OpenBrainPublish
TESTING_PIPELINE_EXECUTION_ROLE: ${{ secrets.TESTING_PIPELINE_EXECUTION_ROLE }}
TESTING_CLOUDFORMATION_EXECUTION_ROLE: ${{ secrets.TESTING_CLOUDFORMATION_EXECUTION_ROLE }}
TESTING_ARTIFACTS_BUCKET: ${{ secrets.TESTING_ARTIFACTS_BUCKET }}
TESTING_REGION: us-east-1

OB_MODE: ${{ secrets.OB_MODE }}
INFRA_STACK_NAME: ${{ secrets.INFRA_STACK_NAME }}
EVENTBUS_NAME: ${{ secrets.EVENTBUS_NAME }}

OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
DEV_OB_PROVIDER_API_KEY: ${{ secrets.DEV_OB_PROVIDER_API_KEY }}
PROD_OB_PROVIDER_API_KEY: ${{ secrets.PROD_OB_PROVIDER_API_KEY }}
DEV_API_URL: ${{ secrets.DEV_API_URL }}
PROD_API_URL: ${{ secrets.PROD_API_URL }}
OB_API_URL: ${{ secrets.OB_API_URL }}
TESTING_PIPELINE_EXECUTION_ROLE: ${{ vars.TESTING_PIPELINE_EXECUTION_ROLE }}
TESTING_CLOUDFORMATION_EXECUTION_ROLE: ${{ vars.TESTING_CLOUDFORMATION_EXECUTION_ROLE }}
TESTING_ARTIFACTS_BUCKET: ${{ vars.TESTING_ARTIFACTS_BUCKET }}
OB_MODE: ${{ vars.OB_MODE }}
INFRA_STACK_NAME: ${{ vars.INFRA_STACK_NAME }}
EVENTBUS_NAME: ${{ vars.EVENTBUS_NAME }}
DEV_API_URL: ${{ vars.DEV_API_URL }}
PROD_API_URL: ${{ vars.PROD_API_URL }}
OB_API_URL: ${{ vars.OB_API_URL }}

PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
PYPI_TEST_TOKEN: ${{ secrets.PYPI_TEST_TOKEN }}

jobs:
pre-commit-tests:
Expand Down Expand Up @@ -201,12 +201,10 @@ jobs:
with:
fetch-depth: 0
persist-credentials: false
# token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}

#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
# - name: Check out repository
# uses: actions/checkout@v4
- name: Set up python
id: setup-python
uses: actions/setup-python@v5
Expand All @@ -216,57 +214,20 @@ jobs:
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry

uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
#
# #----------------------------------------------
# # load cached venv if cache exists
# #----------------------------------------------
# - name: Load cached venv
# id: cached-poetry-dependencies
# uses: actions/cache@v3
# with:
# path: .venv
# key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
# #----------------------------------------------
# # install dependencies if cache does not exist
# #----------------------------------------------
# - name: Install dependencies
# if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
# run: poetry install --no-interaction --no-root
# #----------------------------------------------
# # install your root project, if required
# #----------------------------------------------
# - name: Install project
# run: poetry install --no-interaction

# - uses: bjoluc/[email protected]
# with:
# pypi_token: ${{ secrets.PYPI_TEST_TOKEN }}
# github_token: ${{ secrets.GH_TOKEN }}
# pypi_repository: https://test.pypi.org/legacy/
# release_branch: dev
# env:
# RELEASE_BRANCH: dev


- name: Python Semantic Release
uses: python-semantic-release/python-semantic-release@master
env:
PYPI_TOKEN: ${{ secrets.PYPI_TEST_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
PYPI_REPOSITORY: https://test.pypi.org/legacy/
RELEASE_BRANCH: dev
# - name: Python Semantic Release
# uses: python-semantic-release/python-semantic-release@master
# env:
# PYPI_TOKEN: ${{ secrets.PYPI_TEST_TOKEN }}
# GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
# PYPI_REPOSITORY: https://test.pypi.org/legacy/
# RELEASE_BRANCH: dev


publish-release:
if: github.ref == 'refs/heads/main'
Expand All @@ -281,7 +242,7 @@ jobs:
with:
fetch-depth: 0
persist-credentials: false
# token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}

#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
Expand All @@ -292,11 +253,11 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: '3.10'

#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry

uses: snok/install-poetry@v1
with:
virtualenvs-create: true
Expand All @@ -312,15 +273,17 @@ jobs:
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
# #----------------------------------------------
# # install dependencies if cache does not exist
# #----------------------------------------------

#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
# #----------------------------------------------
# # install your root project, if required
# #----------------------------------------------

#----------------------------------------------
# install your root project, if required
#----------------------------------------------
- name: Install project
run: poetry install --no-interaction

Expand Down
53 changes: 0 additions & 53 deletions example.env

This file was deleted.

39 changes: 0 additions & 39 deletions openbrain/.env.example

This file was deleted.

Empty file removed openbrain/app.py.bak
Empty file.
2 changes: 1 addition & 1 deletion openbrain/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def cli(client_id, profile_name, message):
@click.command()
def cli_env():
"""Print the .env.example file to stdout."""
with open(".env.example", "r") as f:
with open("../.env.example", "r") as f:
print(f.read())


Expand Down
39 changes: 36 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ scm = "commitizen.providers:ScmProvider"

[tool.semantic_release]
major_on_zero = false
commit_message = "chore(release): release {version}"
commit_message = "chore(release): release {version} [skip ci]"

# End from video
[tool.semantic_release.branches.main]
Expand Down

0 comments on commit 4c93fda

Please sign in to comment.