Build/Test for PR #38
Workflow file for this run
This file contains 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: Build and Test | |
run-name: Build/Test for PR #${{ github.event.number }} on ${{ github.head_ref }} | |
on: | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
jobs: | |
lint-and-build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Lint Dockerfile | |
uses: hadolint/hadolint-action@v3.1.0 | |
with: | |
dockerfile: "Dockerfile" | |
- name: Build Docker image | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: false | |
load: true | |
tags: johnnyknighten/test:latest | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
test: | |
runs-on: ubuntu-latest | |
needs: | |
- lint-and-build | |
steps: | |
- name: Test the Docker image TEST_VAR equals content of text_content.text | |
run: docker run --rm johnnyknighten/test:latest -c "cat test_content.txt | grep -q \"Hello World\"" | |
- name: Check Nano is installed | |
run: docker run --rm johnnyknighten/test:latest -c "nano --version" |