@@ -202,7 +202,9 @@ jobs:
202202 - name : Rust Clippy ${{ matrix.target }}
203203 run : make clippy_${{ matrix.target }}
204204
205- build-and-test-postgres :
205+ # Postgres
206+ build-and-unit-test-postgres :
207+ needs : [rust-env, python-env]
206208 runs-on : ubuntu-latest
207209 permissions :
208210 contents : read
@@ -335,3 +337,112 @@ jobs:
335337 glob : " *.json"
336338 parent : false
337339 process_gcloudignore : false
340+
341+ build-postgres-image :
342+ runs-on : ubuntu-latest
343+ needs : [rust-env, python-env]
344+ permissions :
345+ contents : read
346+ actions : write
347+
348+ steps :
349+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
350+ with :
351+ persist-credentials : false
352+
353+ - name : Create version.json
354+ run : |
355+ printf '{"commit":"%s","version":"%s","source":"https://github.com/%s/%s","build":"%s"}\n' \
356+ "${GITHUB_SHA}" \
357+ "${GITHUB_REF_NAME}" \
358+ "${GITHUB_REPOSITORY_OWNER}" \
359+ "${GITHUB_REPOSITORY_NAME}" \
360+ "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" \
361+ > version.json
362+ env :
363+ GITHUB_REPOSITORY_NAME : ${{ github.event.repository.name }}
364+
365+ - name : Set up Docker Buildx
366+ uses : docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
367+
368+ - name : Build Postgres Docker image
369+ uses : docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
370+ with :
371+ context : .
372+ push : false
373+ tags : app:build
374+ build-args : |
375+ SYNCSTORAGE_DATABASE_BACKEND=postgres
376+ TOKENSERVER_DATABASE_BACKEND=postgres
377+ outputs : type=docker,dest=/tmp/postgres-image.tar
378+ cache-from : type=gha
379+ cache-to : type=gha,mode=max
380+
381+ - name : Upload Docker image artifact
382+ uses : actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
383+ with :
384+ name : postgres-docker-image
385+ path : /tmp/postgres-image.tar
386+ retention-days : 1
387+
388+ postgres-e2e-tests :
389+ runs-on : ubuntu-latest
390+ needs : build-postgres-image
391+ permissions :
392+ contents : read
393+ checks : write
394+
395+ steps :
396+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
397+ with :
398+ persist-credentials : false
399+
400+ - name : Download Docker image
401+ uses : actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6
402+ with :
403+ name : postgres-docker-image
404+ path : /tmp
405+
406+ - name : Load Docker image
407+ run : docker load --input /tmp/postgres-image.tar
408+
409+ - name : Create test results directory
410+ run : mkdir -p workflow/test-results
411+
412+ - name : Run Postgres e2e tests
413+ run : make docker_run_postgres_e2e_tests
414+ env :
415+ SYNCSTORAGE_RS_IMAGE : app:build
416+
417+ - name : Publish E2E Test Report
418+ uses : dorny/test-reporter@a810f9bf83f2344124a920a7a0a85a6716e791f0
419+ if : always()
420+ with :
421+ name : Postgres E2E Tests
422+ path : workflow/test-results/*.xml
423+ reporter : java-junit
424+ fail-on-error : false
425+
426+ - name : Upload e2e test results
427+ if : always()
428+ uses : actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
429+ with :
430+ name : postgres-e2e-test-results
431+ path : workflow/test-results/
432+
433+ # Upload to GCS on master
434+ - name : Authenticate to Google Cloud
435+ if : github.ref == 'refs/heads/master'
436+ uses : google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3
437+ with :
438+ credentials_json : ${{ secrets.ETE_GCLOUD_SERVICE_KEY }}
439+
440+ - name : Upload e2e test results to GCS
441+ if : github.ref == 'refs/heads/master'
442+ uses : google-github-actions/upload-cloud-storage@c0f6160ff80057923ff50e5e567695cea181ec23 # v2
443+ with :
444+ path : workflow/test-results
445+ destination : ecosystem-test-eng-metrics/syncstorage-rs/junit
446+ glob : " *.xml"
447+ parent : false
448+ process_gcloudignore : false
0 commit comments