Skip to content

Commit

Permalink
Runs tests on push (#317)
Browse files Browse the repository at this point in the history
* Runs tests on push

* Move out config
  • Loading branch information
hendricius authored Dec 19, 2023
1 parent 0fecb8e commit d0f71d9
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 14 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/test-book-website-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Test building book and website with custom image

on:
pull_request:

jobs:
build-and-push-image:
uses: ./.github/workflows/docker-build-push.yml

test-building-book-website:
needs: build-and-push-image
uses: ./.github/workflows/test-book-website.yml
with:
docker-image: ghcr.io/${{ github.repository }}:${{ github.event.pull_request.head.ref }}
14 changes: 14 additions & 0 deletions .github/workflows/test-book-website-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Test building book and website with default image

on:
push:

jobs:
build-and-push-image:
uses: ./.github/workflows/docker-build-push.yml

test-building-book-website:
needs: build-and-push-image
uses: ./.github/workflows/test-book-website.yml
with:
docker-image: ghcr.io/${{ github.repository }}:latest
25 changes: 11 additions & 14 deletions .github/workflows/test-book-website.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,38 @@
name: Test building book and website
name: Test book and website for given image

on:
pull_request:

env:
IMAGE: ghcr.io/${{ github.repository }}:${{ github.event.pull_request.head.ref }}
workflow_call:
inputs:
docker-image:
required: true
type: string

jobs:
build-and-push-image:
uses: ./.github/workflows/docker-build-push.yml

test-building-book-website:
needs: build-and-push-image
test-book-website:
runs-on: ubuntu-latest
steps:
- name: Set up git repository
uses: actions/checkout@v3
- name: Print dependency versions
uses: addnab/docker-run-action@v3
with:
image: ${{ env.IMAGE }}
image: ${{ inputs.docker-image }}
options: -v ${{ github.workspace }}:/app
run: |
cd /app/book
make show_tools_version
- name: Print build variables
uses: addnab/docker-run-action@v3
with:
image: ${{ env.IMAGE }}
image: ${{ inputs.docker-image }}
options: -v ${{ github.workspace }}:/app
run: |
cd /app/book
make printvars
- name: Test baking the release versions
uses: addnab/docker-run-action@v3
with:
image: ${{ env.IMAGE }}
image: ${{ inputs.docker-image }}
options: -v ${{ github.workspace }}:/app
run: |
cd /app/book
Expand All @@ -51,7 +48,7 @@ jobs:
- name: Test building website
uses: addnab/docker-run-action@v3
with:
image: ${{ env.IMAGE }}
image: ${{ inputs.docker-image }}
options: -v ${{ github.workspace }}:/app
run: |
cd /app/book
Expand Down

0 comments on commit d0f71d9

Please sign in to comment.