From 185b4531a25b665f362103f560ea6ca356b837ef Mon Sep 17 00:00:00 2001 From: hsm207 Date: Fri, 26 Jan 2024 12:32:34 +0000 Subject: [PATCH 1/7] draft prebuild workflow --- .github/workflows/prebuild.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/prebuild.yml diff --git a/.github/workflows/prebuild.yml b/.github/workflows/prebuild.yml new file mode 100644 index 0000000..93932d8 --- /dev/null +++ b/.github/workflows/prebuild.yml @@ -0,0 +1,32 @@ +name: Pre-build checks + +on: + push: + branches: [ ci ] + pull_request: + branches: [ ci ] + +jobs: + lint_check: + name: Lint the code + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Build and run Dev Container task + uses: devcontainers/ci@v0.3 + with: + runCmd: | + ruff -v ./langchain_weaviate/ ./tests/ + + format_check: + name: Check code format + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Build and run Dev Container task + uses: devcontainers/ci@v0.3 + with: + runCmd: | + poetry run ruff format -v --diff ./langchain_weaviate/ ./tests/ \ No newline at end of file From 136089f735f9bf7837d3f398b67bf7abadb57581 Mon Sep 17 00:00:00 2001 From: hsm207 Date: Fri, 26 Jan 2024 12:35:53 +0000 Subject: [PATCH 2/7] fix typo --- .github/workflows/prebuild.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/prebuild.yml b/.github/workflows/prebuild.yml index 93932d8..bd73bc1 100644 --- a/.github/workflows/prebuild.yml +++ b/.github/workflows/prebuild.yml @@ -17,7 +17,7 @@ jobs: uses: devcontainers/ci@v0.3 with: runCmd: | - ruff -v ./langchain_weaviate/ ./tests/ + poetry run ruff -v ./langchain_weaviate/ ./tests/ format_check: name: Check code format From b2629d983cb0bbb3b6fa161e3b6de2e8d2595c27 Mon Sep 17 00:00:00 2001 From: hsm207 Date: Fri, 26 Jan 2024 12:57:55 +0000 Subject: [PATCH 3/7] add tests --- .github/workflows/prebuild.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/prebuild.yml b/.github/workflows/prebuild.yml index bd73bc1..dab45c2 100644 --- a/.github/workflows/prebuild.yml +++ b/.github/workflows/prebuild.yml @@ -29,4 +29,16 @@ jobs: uses: devcontainers/ci@v0.3 with: runCmd: | - poetry run ruff format -v --diff ./langchain_weaviate/ ./tests/ \ No newline at end of file + poetry run ruff format -v --diff ./langchain_weaviate/ ./tests/ + + run_tests: + name: Run tests + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Build and run Dev Container task + uses: devcontainers/ci@v0.3 + with: + runCmd: | + poetry run pytest -n `nproc` \ No newline at end of file From 0bde281381b8e00b1b5ff5673be0c0f67c899f85 Mon Sep 17 00:00:00 2001 From: hsm207 Date: Fri, 26 Jan 2024 13:06:28 +0000 Subject: [PATCH 4/7] add openai key --- .github/workflows/prebuild.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/prebuild.yml b/.github/workflows/prebuild.yml index dab45c2..4a2ee70 100644 --- a/.github/workflows/prebuild.yml +++ b/.github/workflows/prebuild.yml @@ -41,4 +41,6 @@ jobs: uses: devcontainers/ci@v0.3 with: runCmd: | - poetry run pytest -n `nproc` \ No newline at end of file + poetry run pytest -n `nproc` + env: + OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} \ No newline at end of file From 935b712dac2672a59600ab73e9c4cfa3acbc9153 Mon Sep 17 00:00:00 2001 From: hsm207 Date: Fri, 26 Jan 2024 13:11:12 +0000 Subject: [PATCH 5/7] update secret name --- .github/workflows/prebuild.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/prebuild.yml b/.github/workflows/prebuild.yml index 4a2ee70..d225511 100644 --- a/.github/workflows/prebuild.yml +++ b/.github/workflows/prebuild.yml @@ -43,4 +43,4 @@ jobs: runCmd: | poetry run pytest -n `nproc` env: - OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} \ No newline at end of file + OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY_FROM_WEAVIATE }} \ No newline at end of file From 1ea16bc8febb1848aedb17283a60354ca1f89039 Mon Sep 17 00:00:00 2001 From: hsm207 Date: Fri, 26 Jan 2024 14:02:21 +0000 Subject: [PATCH 6/7] add cov threshold --- .github/workflows/prebuild.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/prebuild.yml b/.github/workflows/prebuild.yml index d225511..6fe1c4e 100644 --- a/.github/workflows/prebuild.yml +++ b/.github/workflows/prebuild.yml @@ -41,6 +41,9 @@ jobs: uses: devcontainers/ci@v0.3 with: runCmd: | - poetry run pytest -n `nproc` + poetry run pytest -n `nproc` \ + --cov=langchain_weaviate \ + --cov-report term-missing \ + --cov-fail-under=94.59 env: OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY_FROM_WEAVIATE }} \ No newline at end of file From d1bc977e973266c3d7077241d8ebe307566a9367 Mon Sep 17 00:00:00 2001 From: hsm207 Date: Fri, 26 Jan 2024 14:06:22 +0000 Subject: [PATCH 7/7] set workflow to run on main --- .github/workflows/prebuild.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/prebuild.yml b/.github/workflows/prebuild.yml index 6fe1c4e..861c529 100644 --- a/.github/workflows/prebuild.yml +++ b/.github/workflows/prebuild.yml @@ -2,9 +2,9 @@ name: Pre-build checks on: push: - branches: [ ci ] + branches: [ main ] pull_request: - branches: [ ci ] + branches: [ main ] jobs: lint_check: