Skip to content

Commit

Permalink
verify reusable test job
Browse files Browse the repository at this point in the history
  • Loading branch information
aakash-rajur committed Oct 8, 2023
1 parent de359ad commit dc55f24
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
16 changes: 7 additions & 9 deletions .github/workflows/test.yaml → .github/workflows/test-job.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
name: Test
name: "Test Job"

on:
push:
branches:
- main
workflow_dispatch:
workflow_call:
inputs:
ref:
type: string
description: 'Branch or tag'
required: true
default: 'main'
Expand Down Expand Up @@ -55,7 +53,7 @@ jobs:
-e POSTGRESQL_USERNAME=${{ env.TMDB_PG_USER }} \
-e POSTGRESQL_PASSWORD=${{ env.TMDB_PG_PASSWORD }} \
${{ env.POSTGRESQL_IMAGE }}:${{ env.POSTGRESQL_VERSION }};
docker run -d --name ${{ env.TMDB_MYSQL_CONTAINER_NAME }} \
-v ./fixtures/mysql/backup.sql:/docker-entrypoint-initdb.d/backup.sql \
-p ${{ env.TMDB_MYSQL_PORT }}:3306 \
Expand All @@ -76,12 +74,12 @@ jobs:
TMDB_MYSQL_PASSWORD: ${{ env.TMDB_MYSQL_PASSWORD }}
run: |
docker inspect ${{ env.TMDB_PG_CONTAINER_NAME }} --format='{{.Name}}: {{.State.Status}}';
docker inspect ${{ env.TMDB_MYSQL_CONTAINER_NAME }} --format='{{.Name}}: {{.State.Status}}';
go test -json ./internal/... ./integration/... 2>&1 | tee TestResults.json
- name: upload test results
uses: actions/upload-artifact@v3
with:
name: TestResults
path: TestResults.json
path: TestResults.json
20 changes: 20 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Test

on:
push:
branches:
- main
workflow_dispatch:
inputs:
ref:
type: string
description: 'Branch or tag'
required: true
default: 'main'

jobs:
test:
name: test
uses: ./.github/workflows/test-job.yml
with:
ref: ${{ github.event.inputs.ref }}

0 comments on commit dc55f24

Please sign in to comment.