mirror of
https://github.com/tofuutils/pre-commit-opentofu.git
synced 2025-10-15 17:38:54 +02:00
50 lines
1.6 KiB
YAML
50 lines
1.6 KiB
YAML
name: "Build Dockerfile if changed and run smoke tests"
|
|
|
|
on: [pull_request]
|
|
|
|
env:
|
|
IMAGE_TAG: pr-test
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@dc323e67f16fb5f7663d20ff7941f27f5809e9b6 # v2.6.0
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Get changed Dockerfile
|
|
id: changed-files-specific
|
|
uses: tj-actions/changed-files@v13.1
|
|
with:
|
|
files: |
|
|
Dockerfile
|
|
.dockerignore
|
|
tools/entrypoint.sh
|
|
|
|
- name: Build if Dockerfile changed
|
|
if: steps.changed-files-specific.outputs.any_changed == 'true'
|
|
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a # v2.10.0
|
|
with:
|
|
context: .
|
|
build-args: |
|
|
INSTALL_ALL=true
|
|
platforms: linux/amd64
|
|
push: false
|
|
tags: |
|
|
ghcr.io/${{ github.repository }}:${{ env.IMAGE_TAG }}
|
|
|
|
- name: Run structure tests
|
|
if: steps.changed-files-specific.outputs.any_changed == 'true'
|
|
uses: plexsystems/container-structure-test-action@fc4492b7bf1d5bbca12490f416808ea75c1ae75e # v0.2.0
|
|
with:
|
|
image: ghcr.io/${{ github.repository }}:${{ env.IMAGE_TAG }}
|
|
config: .github/.container-structure-test-config.yaml
|
|
|
|
- name: Dive - check image for waste files
|
|
if: steps.changed-files-specific.outputs.any_changed == 'true'
|
|
uses: MaxymVlasov/dive-action@v0.1.0
|
|
with:
|
|
image: ghcr.io/${{ github.repository }}:${{ env.IMAGE_TAG }}
|
|
config-file: ${{ github.workspace }}/.github/.dive-ci.yaml
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|