Skip to content

Commit

Permalink
ci(#49): consolidate steps
Browse files Browse the repository at this point in the history
Signed-off-by: Bryant Finney <[email protected]>
  • Loading branch information
bryant-finney committed Dec 23, 2023
1 parent 09a90d2 commit 67db39e
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 13 deletions.
35 changes: 35 additions & 0 deletions .github/actions/poe-test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: 🧪 poe test
description: Invoke 'poe test' to run tests for the package.

inputs:
comment_mode:
default: always
description: Passed directly to EnricoMi/publish-unit-test-result-action

title:
default: Test Results
description: Passed directly to EnricoMi/publish-unit-test-result-action

runs:
steps:
- run: poetry install
shell: bash

- run: poe test
shell: bash

- if: always()
uses: actions/upload-artifact@v4
with:
name: Coverage Report
path: docs/reports/pytest-html

- if: always()
uses: EnricoMi/publish-unit-test-result-action@v2
with:
action_fail_on_inconclusive: true
check_name: ${{ inputs.title }}
comment_mode: ${{ inputs.comment_mode }}
files: docs/reports/pytest.xml

using: composite
10 changes: 4 additions & 6 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,19 +118,17 @@ jobs:
needs: build-and-push

permissions:
checks: write
contents: read
issues: read
packages: read
pull-requests: write

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- run: poetry install
- run: poe test

- if: always()
uses: actions/upload-artifact@v4
- uses: ./.github/actions/poe-test
with:
name: Coverage Report
path: docs/reports/pytest-html
title: "Test Results (image: ${{ needs.build-and-push.outputs.version }})"
36 changes: 29 additions & 7 deletions .github/workflows/poe-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,46 @@ on:
- sample-config.yml

jobs:
check:
outputs:
triggered_docker: ${{ steps.changes.outputs.match }}

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: gh pr diff
--name-only ${{ github.event.pull_request.number }}
--repo ${{ github.repository }} | sort >changes.txt

- run: yq -r '.on.pull_request.paths[]' .github/workflows/docker-build.yml |
sort | uniq >docker.txt

- id: changes
run: |
{
echo 'match<<EOF'
comm -12 changes.txt docker.txt
echo EOF
} >>"$GITHUB_OUTPUT"
run:
container:
image: ghcr.io/${{ github.repository }}/dev:main

needs: check

permissions:
checks: write
contents: read
issues: read
packages: read
pull-requests: write

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- run: poetry install
- run: poe test

- if: always()
uses: actions/upload-artifact@v4
- uses: ./.github/actions/poe-test
with:
name: Coverage Report
path: docs/reports/pytest-html
comment_mode: ${{ needs.check.outputs.triggered_docker == '' && 'always' || 'off' }}
title: "Test Results (image: main)"

0 comments on commit 67db39e

Please sign in to comment.