Skip to content

Commit

Permalink
Test action
Browse files Browse the repository at this point in the history
  • Loading branch information
ahosgood committed Nov 6, 2024
1 parent 748fc37 commit 29f2983
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 72 deletions.
18 changes: 10 additions & 8 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ inputs:
docker-context:
required: true
type: string
dockerfile:
required: true
type: string
base-image:
required: false
type: string
Expand All @@ -24,12 +21,17 @@ inputs:
required: true
type: string

outputs:
tag:
description: "The generated tag"
value: ${{ env.TAG }}

runs:
using: "composite"
steps:
- uses: hadolint/[email protected]
with:
dockerfile: ${{ inputs.docker-context }}/${{ inputs.dockerfile }}
dockerfile: ${{ inputs.docker-context }}/Dockerfile
ignore: SC1091,${{ inputs.ignore-linting-rules }}
- name: ShellCheck
run: |
Expand Down Expand Up @@ -72,7 +74,7 @@ runs:
BASE_IMAGE=${{ inputs.base-image }}
BASE_IMAGE_TAG=${{ env.TAG }}
TNA_DOCKER_IMAGE_VERSION=${{ env.TAG }}
TNA_DOCKER_IMAGE_SOURCE=${{ github.server_url }}/${{ github.repository }}/blob/main/${{ inputs.docker-context }}/${{ inputs.dockerfile }}
TNA_DOCKER_IMAGE_SOURCE=${{ github.server_url }}/${{ github.repository }}/blob/main/${{ inputs.docker-context }}/Dockerfile
USER_IMAGE=${{ inputs.user-image }}
push: true
tags: ${{ env.IMAGE_ID }}:${{ env.TAG }}
Expand All @@ -92,7 +94,7 @@ runs:
BASE_IMAGE=${{ inputs.base-image }}
BASE_IMAGE_TAG=${{ env.MAJOR_VERSION }}
TNA_DOCKER_IMAGE_VERSION=${{ env.TAG }}
TNA_DOCKER_IMAGE_SOURCE=${{ github.server_url }}/${{ github.repository }}/blob/main/${{ inputs.docker-context }}/${{ inputs.dockerfile }}
TNA_DOCKER_IMAGE_SOURCE=${{ github.server_url }}/${{ github.repository }}/blob/main/${{ inputs.docker-context }}/Dockerfile
USER_IMAGE=${{ inputs.user-image }}
push: true
tags: ${{ env.IMAGE_ID }}:${{ env.MAJOR_VERSION }}
Expand All @@ -109,7 +111,7 @@ runs:
BASE_IMAGE=${{ inputs.base-image }}
BASE_IMAGE_TAG=${{ env.MINOR_VERSION }}
TNA_DOCKER_IMAGE_VERSION=${{ env.TAG }}
TNA_DOCKER_IMAGE_SOURCE=${{ github.server_url }}/${{ github.repository }}/blob/main/${{ inputs.docker-context }}/${{ inputs.dockerfile }}
TNA_DOCKER_IMAGE_SOURCE=${{ github.server_url }}/${{ github.repository }}/blob/main/${{ inputs.docker-context }}/Dockerfile
USER_IMAGE=${{ inputs.user-image }}
push: true
tags: ${{ env.IMAGE_ID }}:${{ env.MINOR_VERSION }}
Expand All @@ -126,7 +128,7 @@ runs:
BASE_IMAGE=${{ inputs.base-image }}
BASE_IMAGE_TAG=latest
TNA_DOCKER_IMAGE_VERSION=${{ env.TAG }}
TNA_DOCKER_IMAGE_SOURCE=${{ github.server_url }}/${{ github.repository }}/blob/main/${{ inputs.docker-context }}/${{ inputs.dockerfile }}
TNA_DOCKER_IMAGE_SOURCE=${{ github.server_url }}/${{ github.repository }}/blob/main/${{ inputs.docker-context }}/Dockerfile
USER_IMAGE=${{ inputs.user-image }}
push: true
tags: ${{ env.IMAGE_ID }}:latest
Expand Down
23 changes: 23 additions & 0 deletions .github/actions/test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Test Docker image

inputs:
application-repository:
required: true
type: string
image:
required: true
type: string
image-tag:
required: true
type: string

runs:
using: "composite"
steps:
- name: TODO
run: |
echo "inputs.application-repository: ${{ inputs.application-repository }}"
echo "inputs.image: ${{ inputs.image }}"
echo "inputs.image-tag: ${{ inputs.image-tag }}"
shell: bash

129 changes: 65 additions & 64 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ on:
paths:
- .github/**
- docker/**
- tests/**

concurrency:
group: ${{ github.ref }}-publish
Expand All @@ -33,76 +32,78 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Build and push
id: build
uses: ./.github/actions/build
with:
image-name: tna-python
docker-context: docker/tna-python
dockerfile: Dockerfile
ignore-linting-rules: DL3002,DL3006
github-token: ${{ secrets.GITHUB_TOKEN }}

python-root:
name: Python (root)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build and push
uses: ./.github/actions/build
- name: Test
uses: ./.github/actions/test
with:
image-name: tna-python-root
docker-context: docker/tna-python
user-image: root
dockerfile: Dockerfile
ignore-linting-rules: DL3002,DL3006
github-token: ${{ secrets.GITHUB_TOKEN }}
application-repository: https://github.com/nationalarchives/flask-application-template
image: tna-python
image-tag: ${{ steps.build.outputs.tag }}

python-django:
name: Python Django
needs: python
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build and push
uses: ./.github/actions/build
with:
image-name: tna-python-django
base-image: ghcr.io/nationalarchives/tna-python
docker-context: docker/tna-python-django
dockerfile: Dockerfile
github-token: ${{ secrets.GITHUB_TOKEN }}
# python-root:
# name: Python (root)
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Build and push
# uses: ./.github/actions/build
# with:
# image-name: tna-python-root
# docker-context: docker/tna-python
# user-image: root
# ignore-linting-rules: DL3002,DL3006
# github-token: ${{ secrets.GITHUB_TOKEN }}

python-django-root:
name: Python Django (root)
needs: python-root
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build and push
uses: ./.github/actions/build
with:
image-name: tna-python-django-root
base-image: ghcr.io/nationalarchives/tna-python-root
docker-context: docker/tna-python-django
dockerfile: Dockerfile
ignore-linting-rules: DL3002
github-token: ${{ secrets.GITHUB_TOKEN }}
# python-django:
# name: Python Django
# needs: python
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Build and push
# uses: ./.github/actions/build
# with:
# image-name: tna-python-django
# base-image: ghcr.io/nationalarchives/tna-python
# docker-context: docker/tna-python-django
# github-token: ${{ secrets.GITHUB_TOKEN }}

python-dev:
name: Python Dev
needs: python-root
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build and push
uses: ./.github/actions/build
with:
image-name: tna-python-dev
base-image: ghcr.io/nationalarchives/tna-python-root
docker-context: docker/tna-python-dev
dockerfile: Dockerfile
ignore-linting-rules: DL3002,DL3008
github-token: ${{ secrets.GITHUB_TOKEN }}
# python-django-root:
# name: Python Django (root)
# needs: python-root
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Build and push
# uses: ./.github/actions/build
# with:
# image-name: tna-python-django-root
# base-image: ghcr.io/nationalarchives/tna-python-root
# docker-context: docker/tna-python-django
# ignore-linting-rules: DL3002
# github-token: ${{ secrets.GITHUB_TOKEN }}

# python-dev:
# name: Python Dev
# needs: python-root
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Build and push
# uses: ./.github/actions/build
# with:
# image-name: tna-python-dev
# base-image: ghcr.io/nationalarchives/tna-python-root
# docker-context: docker/tna-python-dev
# ignore-linting-rules: DL3002,DL3008
# github-token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 29f2983

Please sign in to comment.