Skip to content

ci: update workflows #16

New issue

Have a question about this project? Sign up for a free account to open an issue and contact its maintainers and the community.

By clicking “Sign up for ”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on ? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions ./workflows/release.yml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
name: Publish Package

on:
push:
tags: ["v*.*.*"]
paths-ignore:
- '**.md'

env:
ECR_REPOSITORY: ${{ vars.ECR_REPOSITORY }}
# EKS_NAMESPACE: ${{ vars.EKS_NAMESPACE_TEST }}
# AWS_DEFAULT_REGION: ${{ vars.AWS_REGION_TEST }}
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
environment: test
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Set short SHA
run: echo "IMAGE_TAG=$(echo ${{ .sha }} | cut -c 1-7)" >> $_ENV

- name: Check for git tag version
id: get_tag
run: |
TAG=$(git describe --tags --exact-match 2> /dev/null || echo "")
if [[ -n "$TAG" ]]; then
echo "IMAGE_TAG=${TAG}" >> $_ENV
fi

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.x

- name: Run Version Verification
run: |
python -c "from config import CONFIG; import os; current_tag = os.getenv('IMAGE_TAG'); assert CONFIG.VERSION == current_tag, 'Version mismatch: Expected {} but got {}'.format(CONFIG.VERSION, current_tag); print('Version matched!')"


- name: Install Twine
run: |
python -m pip install --upgrade pip
pip install twine

- name: Build Package
run: python setup.py sdist bdist_wheel

- name: Publish Package
run: twine upload dist/*
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}

- name: Create Release
uses: actions/create-release@v1
env:
_TOKEN: ${{ secrets._TOKEN }}
with:
tag_name: ${{ env.IMAGE_TAG }}
release_name: Release ${{ env.IMAGE_TAG }}
body: |
This is the release for version ${{ env.IMAGE_TAG }}.
draft: false
prerelease: false
65 changes: 65 additions & 0 deletions ./workflows/test.yml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
name: Run test

on:
push:
branches: [ "master" ]
paths-ignore:
- '**.md'

env:
ECR_REPOSITORY: ${{ vars.ECR_REPOSITORY }}
EKS_NAMESPACE: ${{ vars.EKS_NAMESPACE_TEST }}
AWS_DEFAULT_REGION: ${{ vars.AWS_REGION_TEST }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
environment: test
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Set short SHA
run: echo "IMAGE_TAG=$(echo ${{ .sha }} | cut -c 1-7)" >> $_ENV

- name: Check for git tag version
id: get_tag
run: |
TAG=$(git describe --tags --exact-match 2> /dev/null || echo "")
if [[ -n "$TAG" ]]; then
echo "IMAGE_TAG=${TAG}" >> $_ENV
fi


- name: Checkout Other Repository
uses: actions/checkout@v2
with:
repository: TaskingAI/TaskingAI
ref: master
path: TaskingAI
env:
_TOKEN: ${{ secrets._TOKEN }}

- name: Set up Docker Compose
run: |
sudo apt-get update
sudo apt-get install -y docker-compose

- name: Build and Start Services
run: |
cd TaskingAI/docker
docker-compose up -d

- name: Run Tests
run: |
echo "run your test command"

- name: Stop Services
run: |
cd TaskingAI/docker
docker-compose down