From f86f5e881d0149a065efa6686f9499c0a6e432fe Mon Sep 17 00:00:00 2001 From: Wenbing Sun Date: Wed, 17 Jan 2024 11:44:16 -0800 Subject: [PATCH 1/5] add init workload --- .github/workflows/build-test-ci.yaml | 47 ++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/build-test-ci.yaml diff --git a/.github/workflows/build-test-ci.yaml b/.github/workflows/build-test-ci.yaml new file mode 100644 index 00000000..6c7ca4ae --- /dev/null +++ b/.github/workflows/build-test-ci.yaml @@ -0,0 +1,47 @@ +name: nlqs build and test ci + +on: + push: + branches: [ "build-test-ci" ] + pull_request: + branches: [ "master" ] + types: [ closed ] + workflow_dispatch: + +jobs: + build-and-test: + runs-on: [ self-hosted, dind ] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + file: ./Dockerfile.tests + push: false + load: true + tags: nlqs/tests:0.1 + + - name: Create db config + run: | + mkdir configs + echo "$DB_CONFIG" > configs/db_config.json + echo "$LLM_CONFIG_OPENAI_GPT4" > configs/openai_gpt4_config.json + env: + DB_CONFIG: ${{ secrets.DB_CONFIG }} + LLM_CONFIG_OPENAI_GPT4: ${{ secrets.LLM_CONFIG_OPENAI_GPT4 }} + + - name: Run Docker container + run: docker run -v $(pwd)/configs/:/code/configs -e WANDB_API_KEY=${{ secrets.WANDB_API_KEY }} --name nlqs-tests -d nlqs/tests:0.1 + + - name: Execute tests + run: docker exec nlqs-tests bash -c "conda run --no-capture-output -n py39 ./run_tests.sh openai_gpt4 all" + + - name: Cleanup + run: docker rm -f nlqs-tests \ No newline at end of file From 429063b88facfa28c36e44e85274367096104e8d Mon Sep 17 00:00:00 2001 From: Wenbing Sun Date: Wed, 17 Jan 2024 11:46:00 -0800 Subject: [PATCH 2/5] fix indent problem --- .github/workflows/build-test-ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-test-ci.yaml b/.github/workflows/build-test-ci.yaml index 6c7ca4ae..90b43d4f 100644 --- a/.github/workflows/build-test-ci.yaml +++ b/.github/workflows/build-test-ci.yaml @@ -28,7 +28,7 @@ jobs: load: true tags: nlqs/tests:0.1 - - name: Create db config + - name: Create db config run: | mkdir configs echo "$DB_CONFIG" > configs/db_config.json From f52df44ea95d3af539ff0398890dc7281ecc7f5b Mon Sep 17 00:00:00 2001 From: Wenbing Sun Date: Wed, 17 Jan 2024 12:17:42 -0800 Subject: [PATCH 3/5] update docker run --- .github/workflows/build-test-ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-test-ci.yaml b/.github/workflows/build-test-ci.yaml index 90b43d4f..39c2b41b 100644 --- a/.github/workflows/build-test-ci.yaml +++ b/.github/workflows/build-test-ci.yaml @@ -38,7 +38,7 @@ jobs: LLM_CONFIG_OPENAI_GPT4: ${{ secrets.LLM_CONFIG_OPENAI_GPT4 }} - name: Run Docker container - run: docker run -v $(pwd)/configs/:/code/configs -e WANDB_API_KEY=${{ secrets.WANDB_API_KEY }} --name nlqs-tests -d nlqs/tests:0.1 + run: docker run -it -v $(pwd)/configs/:/code/configs -e WANDB_API_KEY=${{ secrets.WANDB_API_KEY }} --name nlqs-tests -d nlqs/tests:0.1 - name: Execute tests run: docker exec nlqs-tests bash -c "conda run --no-capture-output -n py39 ./run_tests.sh openai_gpt4 all" From 2dfbf71912eedc6ee89880f86420e33d438b1593 Mon Sep 17 00:00:00 2001 From: Wenbing Sun Date: Wed, 17 Jan 2024 12:27:09 -0800 Subject: [PATCH 4/5] add step to clean existing container --- .github/workflows/build-test-ci.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-test-ci.yaml b/.github/workflows/build-test-ci.yaml index 39c2b41b..15bf0fb2 100644 --- a/.github/workflows/build-test-ci.yaml +++ b/.github/workflows/build-test-ci.yaml @@ -38,7 +38,9 @@ jobs: LLM_CONFIG_OPENAI_GPT4: ${{ secrets.LLM_CONFIG_OPENAI_GPT4 }} - name: Run Docker container - run: docker run -it -v $(pwd)/configs/:/code/configs -e WANDB_API_KEY=${{ secrets.WANDB_API_KEY }} --name nlqs-tests -d nlqs/tests:0.1 + run: | + docker rm -f nlqs-tests || true + docker run -it -v $(pwd)/configs/:/code/configs -e WANDB_API_KEY=${{ secrets.WANDB_API_KEY }} --name nlqs-tests -d nlqs/tests:0.1 - name: Execute tests run: docker exec nlqs-tests bash -c "conda run --no-capture-output -n py39 ./run_tests.sh openai_gpt4 all" From 0d3791b75164187788033358c31be43cafbdbf47 Mon Sep 17 00:00:00 2001 From: Wenbing Sun Date: Wed, 17 Jan 2024 12:53:48 -0800 Subject: [PATCH 5/5] fix branch name --- .github/workflows/build-test-ci.yaml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-test-ci.yaml b/.github/workflows/build-test-ci.yaml index 15bf0fb2..98c32823 100644 --- a/.github/workflows/build-test-ci.yaml +++ b/.github/workflows/build-test-ci.yaml @@ -4,7 +4,7 @@ on: push: branches: [ "build-test-ci" ] pull_request: - branches: [ "master" ] + branches: [ "main" ] types: [ closed ] workflow_dispatch: @@ -43,7 +43,13 @@ jobs: docker run -it -v $(pwd)/configs/:/code/configs -e WANDB_API_KEY=${{ secrets.WANDB_API_KEY }} --name nlqs-tests -d nlqs/tests:0.1 - name: Execute tests - run: docker exec nlqs-tests bash -c "conda run --no-capture-output -n py39 ./run_tests.sh openai_gpt4 all" + run: | + docker exec nlqs-tests bash -c "conda run --no-capture-output -n py39 ./run_tests.sh openai_gpt4 all" + status=$? + if [ $status -ne 0 ]; then + echo "test failed with status $status" + exit $status + fi - name: Cleanup run: docker rm -f nlqs-tests \ No newline at end of file