diff --git a/.github/actions/test-image/action.yml b/.github/actions/test-image/action.yml new file mode 100644 index 00000000..9930edc7 --- /dev/null +++ b/.github/actions/test-image/action.yml @@ -0,0 +1,22 @@ +name: "Pull and test image" +description: "Download image from GitHub artifacts and test it" + +inputs: + imageName: + description: "Image name to be tested" + required: true + +runs: + using: "composite" + steps: + - name: Download built image 📥 + uses: actions/download-artifact@v3 + with: + name: ${{ inputs.imageName }} + path: /tmp/ + - name: Load downloaded image to docker 📥 + run: | + docker load --input /tmp/${{ inputs.imageName }}.tar + docker image ls -a + - name: Run tests ✅ + run: python3 -m tests.run_tests --short-image-name ${{ inputs.imageName }} diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index fcdbdd25..8bc4fff6 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -57,7 +57,8 @@ jobs: uses: actions/checkout@v3 - name: Create dev environment 📦 uses: ./.github/actions/create-dev-env - - name: Build image 🛠 + + - name: Build and push image as GitHub artifact 🛠 uses: ./.github/actions/build-push-image with: imageName: base-notebook @@ -71,14 +72,8 @@ jobs: uses: actions/checkout@v3 - name: Create dev environment 📦 uses: ./.github/actions/create-dev-env - - name: Download built image 📥 - uses: actions/download-artifact@v3 + + - name: Pull image from GitHub artifacts and test it 🛠 + uses: ./.github/actions/test-image with: - name: base-notebook - path: /tmp/ - - name: Load downloaded image to docker 📥 - run: | - docker load --input /tmp/base-notebook.tar - docker image ls -a - - name: Run tests ✅ - run: python3 -m tests.run_tests --short-image-name base-notebook + imageName: base-notebook