address review #563
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Run Tests | |
| on: | |
| push: | |
| pull_request: | |
| env: | |
| DEVCONTAINER_REGISTRY: ghcr.io | |
| DEVCONTAINER_IMAGE_NAME: ${{ github.repository }}/devcontainer | |
| DEVCONTAINER_IMAGE_TAG_MAIN: "cache-main" | |
| defaults: | |
| run: | |
| shell: bash | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-devcontainer: | |
| runs-on: ubuntu-24.04 | |
| outputs: | |
| image_repository: ${{ steps.docker_image.outputs.image_repository }} | |
| image_tag: ${{ steps.docker_image.outputs.image_tag }} | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Docker image metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.DEVCONTAINER_REGISTRY }}/${{ env.DEVCONTAINER_IMAGE_NAME }} | |
| tags: | | |
| type=ref,event=pr,prefix=cache-pr-,priority=600 | |
| type=ref,event=branch,prefix=cache-,priority=500 | |
| type=ref,event=tag,prefix=cache-,priority=500 | |
| flavor: | | |
| latest=false | |
| - name: Extract Docker image name | |
| id: docker_image | |
| env: | |
| IMAGE_TAGS: ${{ steps.meta.outputs.tags }} | |
| run: | | |
| IMAGE=$(echo "$IMAGE_TAGS" | cut -d" " -f1) | |
| IMAGE_REPOSITORY=$(echo "$IMAGE" | cut -d":" -f1) | |
| IMAGE_TAG=$(echo "$IMAGE" | cut -d":" -f2) | |
| echo "image=$IMAGE" >> "$GITHUB_OUTPUT" | |
| echo "image_repository=$IMAGE_REPOSITORY" >> "$GITHUB_OUTPUT" | |
| echo "image_tag=$IMAGE_TAG" >> "$GITHUB_OUTPUT" | |
| - uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Pre-build devcontainer | |
| uses: devcontainers/ci@v0.3 | |
| continue-on-error: true | |
| with: | |
| push: always | |
| skipContainerUserIdUpdate: false | |
| imageName: ${{ steps.docker_image.outputs.image_repository }} | |
| imageTag: ${{ steps.docker_image.outputs.image_tag }} | |
| cacheFrom: | | |
| ${{ steps.docker_image.outputs.image_repository }}:${{ steps.docker_image.outputs.image_tag }} | |
| ${{ steps.docker_image.outputs.image_repository }}:${{ env.DEVCONTAINER_IMAGE_TAG_MAIN }} | |
| tests: | |
| runs-on: ubuntu-24.04 | |
| needs: | |
| - build-devcontainer | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build csi-rclone | |
| uses: devcontainers/ci@v0.3 | |
| with: | |
| runCmd: | | |
| make build/csi-rclone | |
| push: never | |
| skipContainerUserIdUpdate: false | |
| cacheFrom: ${{ needs.build-devcontainer.outputs.image_repository }}:${{ needs.build-devcontainer.outputs.image_tag }} | |
| - name: Helm check | |
| uses: devcontainers/ci@v0.3 | |
| with: | |
| runCmd: | | |
| make helm-lint | |
| push: never | |
| skipContainerUserIdUpdate: false | |
| cacheFrom: ${{ needs.build-devcontainer.outputs.image_repository }}:${{ needs.build-devcontainer.outputs.image_tag }} | |
| - name: Run tests | |
| id: tests | |
| uses: devcontainers/ci@v0.3 | |
| with: | |
| runCmd: | | |
| make cleanup | |
| make kind-delete-cluster | |
| make kind-create-cluster | |
| make kind-get-kubeconfig | |
| make kind-create-namespace | |
| make kind-load-docker-image-test | |
| make helm-template-test | |
| make kind-depoy-test | |
| make tests | |
| push: never | |
| skipContainerUserIdUpdate: false | |
| cacheFrom: ${{ needs.build-devcontainer.outputs.image_repository }}:${{ needs.build-devcontainer.outputs.image_tag }} | |
| - name: Print rclone log | |
| if: ${{ failure() && steps.tests.conclusion == 'failure' }} | |
| run: cat /tmp/rclone.log |