-
Notifications
You must be signed in to change notification settings - Fork 0
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
4 changed files
with
148 additions
and
0 deletions.
There are no files selected for viewing
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,19 @@ | ||
inputs: | ||
path: | ||
description: 'Path where linting test will be executed' | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Install dependencies | ||
shell: bash | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install pylint==3.1.0 | ||
- name: Run linting test on $ {{ inputs.path }} | ||
shell: bash | ||
run: | | ||
pylint_rc=$(pwd)/qa/python/pylintrc | ||
cd ${{ inputs.path }} | ||
pylint --rcfile $pylint_rc --load-plugins=pylint.extensions.bad_builtin -r y -j 0 -f colorized **/*.py |
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,23 @@ | ||
name: Linting test | ||
|
||
on: | ||
push: | ||
branches: [ 'main' ] | ||
pull_request: | ||
paths: | ||
- 'ml_worker/**.py' | ||
- '.github/workflows/linting.yml' | ||
|
||
# TODO: leverage some caching here | ||
jobs: | ||
linting-worker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/pylint | ||
with: | ||
path: "." | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true |
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,54 @@ | ||
name: Publish release assets | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
create-release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Create GH release | ||
run: gh release create "$tag" --generate-notes | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
tag: ${{ github.ref_name }} | ||
|
||
publish-to-dockerhub: | ||
needs: [ create-release ] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
# Replace this with your own docker hub image | ||
with: | ||
images: <org>/<image> | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
# You'll need to set these secrets | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build and push image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
target: ml-worker | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: false |
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,52 @@ | ||
name: Tests | ||
|
||
on: | ||
push: | ||
branches: [ 'main' ] | ||
pull_request: | ||
paths: | ||
- 'ml_worker/**.py' | ||
- 'pyproject.toml' | ||
- 'uv.lock' | ||
- '.github/workflows/tests.yml' | ||
|
||
jobs: | ||
test-worker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: psf/black@stable | ||
with: | ||
options: "--check --verbose" | ||
jupyter: true | ||
src: "." | ||
version: "~= 24.2.0" | ||
- name: Install uv | ||
uses: astral-sh/setup-uv@v4 | ||
with: | ||
version: "0.5.5" | ||
python-version: "3.11" | ||
enable-cache: true | ||
- name: Setup Python project | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.11" | ||
- name: Run tests | ||
run: uv run --frozen pytest -vvv --cache-clear --show-capture=all -r A . | ||
services: | ||
elasticsearch: | ||
image: elasticsearch:7.17.25 | ||
env: | ||
discovery.type: single-node | ||
options: >- | ||
--health-cmd "curl http://localhost:9200" | ||
--health-interval 3s | ||
--health-timeout 1s | ||
--health-retries 10 | ||
--health-start-period 5s | ||
ports: | ||
- "9200:9200" | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true |