-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
2,924 additions
and
2,707 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: "build-python" | ||
description: "Action to build a Python and poetry environment." | ||
|
||
inputs: | ||
python-version: | ||
required: false | ||
description: "The python version to use" | ||
default: "3.11" | ||
|
||
context-directory: | ||
required: true | ||
description: "The context directory to use" | ||
default: "." | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Set up python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ inputs.python-version }} | ||
|
||
- name: Install Poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
virtualenvs-in-project: true | ||
|
||
- name: Load cached venv | ||
id: cached-poetry-dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: .venv | ||
key: venv-${{ runner.os }}-${{ inputs.python-version }}-${{ hashFiles('poetry.lock') }} | ||
|
||
- name: Install dependencies | ||
working-directory: ${{ inputs.context-directory }} | ||
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | ||
run: poetry install --no-interaction | ||
shell: bash | ||
|
||
- name: Make Check | ||
working-directory: ${{ inputs.context-directory }} | ||
run: make check | ||
shell: bash | ||
|
||
- name: Make Build | ||
working-directory: ${{ inputs.context-directory }} | ||
run: make build | ||
shell: bash |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: "package-container" | ||
description: "Composite action to to build a docker image." | ||
|
||
inputs: | ||
IMAGE_NAME: | ||
required: true | ||
description: "The name of the image" | ||
FOLDER_PATH: | ||
required: true | ||
description: "The context path to build the docker" | ||
TOKEN: | ||
description: "A Github PAT" | ||
required: true | ||
USERNAME: | ||
description: "A Github PAT username" | ||
required: true | ||
ORGANIZATION_NAME: | ||
description: "The organization name" | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Create a new tag | ||
id: tag | ||
uses: anothrNick/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ inputs.TOKEN }} | ||
WITH_V: "true" | ||
DEFAULT_BUMP: patch | ||
|
||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ghcr.io/${{inputs.ORGANIZATION_NAME}}/${{inputs.IMAGE_NAME}} | ||
tags: | | ||
type=sha | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=raw,value=latest,enable={{is_default_branch}} | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ inputs.USERNAME }} | ||
password: ${{ inputs.TOKEN }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ${{ inputs.FOLDER_PATH }} | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }},ghcr.io/${{inputs.ORGANIZATION_NAME}}/${{inputs.IMAGE_NAME}}:${{ steps.tag.outputs.new_tag }} | ||
labels: ${{ steps.meta.outputs.labels }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: "setup-poetry-env" | ||
description: "Composite action to setup the Python and poetry environment." | ||
|
||
inputs: | ||
python-version: | ||
required: false | ||
description: "The python version to use" | ||
default: "3.11" | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Set up python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ inputs.python-version }} | ||
|
||
- name: Install Poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
virtualenvs-in-project: true | ||
|
||
- name: Load cached venv | ||
id: cached-poetry-dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: .venv | ||
key: venv-${{ runner.os }}-${{ inputs.python-version }}-${{ hashFiles('poetry.lock') }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
time: "07:00" | ||
timezone: "Asia/Ho_Chi_Minh" | ||
groups: | ||
github: | ||
patterns: | ||
- "*" | ||
labels: | ||
- "ci" | ||
- "dependencies" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: "Build" | ||
|
||
on: | ||
push: | ||
branches: | ||
- "main" | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }} - CI" | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
docker-build: | ||
name: Chatbot Image | ||
environment: dev | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
contents: write | ||
if: github.event.pull_request.draft == false | ||
steps: | ||
- name: Checkout Actions Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build Chatbot | ||
uses: ./.github/actions/package-container | ||
with: | ||
FOLDER_PATH: ./app | ||
IMAGE_NAME: chatbot | ||
TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
USERNAME: ${{ github.actor }} | ||
ORGANIZATION_NAME: datvodinh |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: "CI" | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- "main" | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }} - CI" | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
lint: | ||
name: Ruff Lint | ||
runs-on: self-hosted | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.11" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install ruff | ||
# Update output format to enable automatic inline annotations. | ||
- name: Run Ruff | ||
run: ruff check --output-format=github . | ||
|
||
build: | ||
name: Build Package | ||
runs-on: self-hosted | ||
strategy: | ||
matrix: | ||
python-version: ["3.11"] | ||
fail-fast: false | ||
steps: | ||
- name: Check out | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build Chatbot | ||
uses: ./.github/actions/build-python | ||
with: | ||
context-directory: ./app/ | ||
|
||
test: | ||
runs-on: self-hosted | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.11" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install poetry pytest | ||
# Update output format to enable automatic inline annotations. | ||
- name: Run Pytest | ||
run: | | ||
cd app | ||
poetry run pytest |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -168,3 +168,4 @@ junit.xml | |
harry_potter_dataset | ||
storage | ||
result | ||
.conda_config |
Oops, something went wrong.