Skip to content

Commit

Permalink
Add more to test action
Browse files Browse the repository at this point in the history
  • Loading branch information
ahosgood committed Nov 6, 2024
1 parent 29f2983 commit fdbdfc8
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .github/actions/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ inputs:
outputs:
tag:
description: "The generated tag"
value: ${{ env.TAG }}
value: ${{ steps.generate-tags.outputs.tag }}

runs:
using: "composite"
Expand All @@ -43,6 +43,7 @@ runs:
run: echo "${{ inputs.github-token }}" | docker login ghcr.io -u $ --password-stdin
shell: bash
- name: Prepare image tag
id: generate-tags
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/${{ inputs.image-name }}
# Change all uppercase to lowercase
Expand All @@ -58,6 +59,7 @@ runs:
echo "TAG=$VERSION" >> "$GITHUB_ENV"
echo "MAJOR_VERSION=$VERSION_MAJOR" >> "$GITHUB_ENV"
echo "MINOR_VERSION=$VERSION_MAJOR.$VERSION_MINOR" >> "$GITHUB_ENV"
echo "tag=$VERSION" >> "$GITHUB_OUTPUT"
shell: bash
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand Down
25 changes: 25 additions & 0 deletions .github/actions/test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ inputs:
application-repository:
required: true
type: string
service:
required: true
type: string
image:
required: true
type: string
Expand All @@ -14,10 +17,32 @@ inputs:
runs:
using: "composite"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: ${{ inputs.application-repository }}
path: test
- name: TODO
run: |
echo "inputs.application-repository: ${{ inputs.application-repository }}"
echo "inputs.image: ${{ inputs.image }}"
echo "inputs.image-tag: ${{ inputs.image-tag }}"
ls -alh
ls -alh test
shell: bash
- name: Update docker-compose.yml
run: |
cd test
cat docker-compose.yml
yq '(.services.app.build.args.IMAGE|="ghcr.io/${{ github.repository_owner }}/${{ inputs.image }}")' docker-compose.yml > tmp.$$.yml && mv tmp.$$.yml docker-compose.yml
yq '(.services.app.build.args.IMAGE_TAG|="ghcr.io/${{ github.repository_owner }}/${{ inputs.image-tag }}")' docker-compose.yml > tmp.$$.yml && mv tmp.$$.yml docker-compose.yml
cat docker-compose.yml
PORT=$(yq '(.services.app.ports)' docker-compose.yml | sed -e 's/^\- \(.*\)\:.*$/\1/')
echo "PORT=$PORT" >> "$GITHUB_ENV"
docker compose up -d
shell: bash
- name: Wait for healthcheck
uses: nev7n/wait_for_response@v1
with:
url: http://localhost:${{ env.PORT }}/healthcheck/live/

1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
uses: ./.github/actions/test
with:
application-repository: https://github.com/nationalarchives/flask-application-template
service: app
image: tna-python
image-tag: ${{ steps.build.outputs.tag }}

Expand Down

0 comments on commit fdbdfc8

Please sign in to comment.