From ba36bf6cfa06f740063b518d3991e1817c49667c Mon Sep 17 00:00:00 2001 From: joe-at-startupmedia Date: Tue, 15 Oct 2024 22:00:32 +0000 Subject: [PATCH] rename testing to CI --- .github/workflows/ci.yml | 51 +++++++++++++++++++++++++++++++ .github/workflows/testing-cgo.yml | 2 +- 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..8c030fb --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,51 @@ +name: CI + +on: + push: + branches: [ "master", "develop" ] + paths-ignore: + - '**.md' + - '**.sh' + - '**.yml' + - '**.yaml' + pull_request: + branches: [ "master", "develop" ] + 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 + +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=test -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 \ No newline at end of file diff --git a/.github/workflows/testing-cgo.yml b/.github/workflows/testing-cgo.yml index 3166ac2..0a7151d 100644 --- a/.github/workflows/testing-cgo.yml +++ b/.github/workflows/testing-cgo.yml @@ -2,7 +2,7 @@ name: Testing CGO on: workflow_run: - workflows: [Testing] + workflows: [CI] types: - completed workflow_dispatch: