Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Stop destroying test output with automatic logging (#569)
sarayourfriendd2bc44cdad36
diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.ymlindex 9caecf327..ab7e44ab3 100644--- a/.github/workflows/ci_cd.yml+++ b/.github/workflows/ci_cd.yml@@ -72,12 +72,15 @@ jobs:steps:- name: Checkout repositoryuses: actions/checkout@v2+- name: Setup justuses: extractions/setup-just@v1+- name: Setup Pythonuses: actions/setup-python@v2with:python-version: "3.10"+- name: Cache Python dependenciesuses: actions/cache@v2with:@@ -85,6 +88,7 @@ jobs:key: ${{ runner.os }}-pip-${{ hashFiles('**/Pipfile.lock') }}restore-keys: |${{ runner.os }}-pip-+- name: Install Python deps for ingestion-serverrun: |pip install -U pip@@ -102,6 +106,17 @@ jobs:- name: Run ingestion-server testsrun: just ing-testlocal+ - name: Upload ingestion test logs+ if: ${{ always() }}+ uses: actions/upload-artifact@v2+ with:+ name: ing_logs+ path: ingestion_server/test/ingestion_logs.txt++ - name: Print ingestion test logs+ if: ${{ always() }}+ run: cat ingestion_server/test/ingestion_logs.txt+test-api:name: Run tests for the APIruns-on: ubuntu-latest@@ -126,11 +141,26 @@ jobs:- name: Start API, ingest and index test datarun: just init+- name: Run API testsrun: just api-test -T+ - name: Print API test logs+ if: ${{ always() }}+ run: |+ just logs > api_logs+ cat api_logs++ - name: Upload API test logs+ if: ${{ always() }}+ uses: actions/upload-artifact@v2+ with:+ name: api_logs+ path: api_logs+- name: Make developer docsrun: just sphinx-make -T+- name: Upload developer docsuses: actions/upload-artifact@v2with:diff --git a/api/test/run_test.sh b/api/test/run_test.shindex 706beeb86..e4fcb2bbe 100755--- a/api/test/run_test.sh+++ b/api/test/run_test.sh@@ -16,10 +16,9 @@ pytest -s --disable-pytest-warnings $TEST_ARGsucceeded=$?if [[ $succeeded -eq 0 ]]; then- printf "${green}:-) All tests passed${endcol}\n"+ printf "${green}:-) All tests passed${endcol}\n"else- printf "Full system logs:\n"- docker-compose logs- printf "${red}:'( Some tests did not pass${endcol}\n"+ printf "\n\n${red}:'( Some tests did not pass${endcol}\n"+ printf "Hint: \`just logs [service]\` will print the Docker logs and may be helpful for debugging.\n\n"fiexit $succeededdiff --git a/ingestion_server/test/run_test.sh b/ingestion_server/test/run_test.shindex 66a926e73..7a5da9494 100755--- a/ingestion_server/test/run_test.sh+++ b/ingestion_server/test/run_test.sh@@ -18,8 +18,6 @@ succeeded=$?if [[ $succeeded -eq 0 ]]; thenprintf "${green}:-) All tests passed${endcol}\n"else- printf "Full system logs:\n"- cat test/ingestion_logs.txtprintf "${red}:'( Some tests did not pass${endcol}\n"fiexit $succeededdiff --git a/justfile b/justfileindex eafbdbd66..fc1f584d7 100644--- a/justfile+++ b/justfile@@ -1,5 +1,7 @@set dotenv-load := false+IS_CI := env_var_or_default("CI", "")+# Show all available recipesdefault:@just --list --unsorted@@ -48,7 +50,7 @@ recreate:@just up "--force-recreate --build"# Show logs of all, or named, Docker services-logs services="" args="-f":+logs services="" args=(if IS_CI != "" { "" } else { "-f" }):docker-compose {{ DOCKER_FILE }} logs {{ args }} {{ services }}