Skip to content

Commit

Permalink
Adds a manual testing workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
joe-at-startupmedia committed Oct 13, 2024
1 parent e863b1c commit d42670b
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
47 changes: 47 additions & 0 deletions .github/workflows/testing-manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Manual Testing

on:
workflow_dispatch:
inputs:
cover_packages:
description: 'passed to the go test -coverpkg flag'
type: string
run_regex:
description: 'passed to the go test -run flag'
type: string
default: 'Test'
required: true
make_target:
description: 'make target'
type: string
default: 'test'
required: true

jobs:

test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch

- name: Docker Build
run: |
GOPATH_BIN=$(go env GOPATH)/bin
export PATH="${GOPATH_BIN}:${PATH}"
docker build --build-arg TEST_PACKAGES_ARG=${{inputs.cover_packages}} --build-arg TEST_REGEX_ARG=${{inputs.run_regex}} --build-arg CODECOV_TOKEN_ARG=${{ secrets.CODECOV_TOKEN }} --build-arg GIT_BRANCH_ARG=${{ steps.extract_branch.outputs.branch }} --build-arg MAKE_TARGET_ARG=${{inputs.make_target}} -t pmon3 .
- name: Docker Testing
run: |
GOPATH_BIN=$(go env GOPATH)/bin
export PATH="${GOPATH_BIN}:${PATH}"
docker run -t pmon3
- name: Finish
run: |
echo ":rocket: Testing complete!" >> $GITHUB_STEP_SUMMARY
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ ENV TEST_REGEX=${TEST_REGEX_ARG}
ENV MAKE_TARGET=${MAKE_TARGET_ARG}
ENV TEST_PACKAGES=${TEST_PACKAGES_ARG}

ENTRYPOINT ["/bin/sh", "-c" , "cd /opt/pmon3 && make build && make install && make ${MAKE_TARGET}"]
ENTRYPOINT ["/bin/sh", "-c" , "cd /opt/pmon3 && make build && make install && CODECOV_TOKEN=${CODECOV_TOKEN} CODECOV_FLAG=${MAKE_TARGET} make ${MAKE_TARGET}"]

0 comments on commit d42670b

Please sign in to comment.