From a88e4e2b75f84f03bcdb57a86a0eee2df06d2d02 Mon Sep 17 00:00:00 2001 From: Vasiliy Dommes Date: Mon, 25 Sep 2023 22:15:57 -0400 Subject: [PATCH] Create GitHub workflow build-and-test.yml --- .github/workflows/build-and-test.yml | 82 ++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 .github/workflows/build-and-test.yml diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 00000000..d5953b6c --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -0,0 +1,82 @@ +name: Docker Image CI + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + # In this step, this action saves a list of existing images, + # the cache is created without them in the post run. + # It also restores the cache if it exists. + - name: Enable Docker Layer Caching + uses: satackey/action-docker-layer-caching@v0.0.11 + # Ignore the failure of a step and avoid terminating the job. + continue-on-error: true + + # sdpb image + - name: Build and export sdpb image + uses: docker/build-push-action@v5 + with: + context: . + tags: sdpb + outputs: type=docker,dest=/tmp/sdpb.tar + - name: Upload sdpb artifact + uses: actions/upload-artifact@v3 + with: + name: sdpb + path: /tmp/sdpb.tar + + # sdpb-test image + - name: Build and export sdpb-test image + uses: docker/build-push-action@v5 + with: + context: . + tags: sdpb-test + target: test + outputs: type=docker,dest=/tmp/sdpb-test.tar + - name: Upload sdpb-test artifact + uses: actions/upload-artifact@v3 + with: + name: sdpb-test + path: /tmp/sdpb-test.tar + + test: + runs-on: ubuntu-latest + needs: build + steps: + - name: Download sdpb artifact + uses: actions/download-artifact@v3 + with: + name: sdpb + path: /tmp + - name: Download sdpb-test artifact + uses: actions/download-artifact@v3 + with: + name: sdpb-test + path: /tmp + + - name: Load images + run: | + docker load --input /tmp/sdpb.tar + docker load --input /tmp/sdpb-test.tar + docker image ls -a + + - name: Run sdpb --help + run: docker run sdpb sdpb --help + + - name: Run all tests + run: docker run sdpb-test ./test/run_all_tests.sh mpirun --oversubscribe + +