From 316d5ff442ee7f6a80c5fdaf3962c227d8c72f09 Mon Sep 17 00:00:00 2001 From: "Soren L. Hansen" Date: Tue, 30 Aug 2022 22:54:02 -0700 Subject: [PATCH] Run tests on pull requests Pull requests will automatically trigger a build and test run. The produced binaries are stored as artifacts in the Github workflow. --- .github/workflows/main.yaml | 28 +++++++++++++--------- .github/workflows/pre-release.yaml | 37 ------------------------------ Makefile | 4 ++-- 3 files changed, 19 insertions(+), 50 deletions(-) delete mode 100644 .github/workflows/pre-release.yaml diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 177e36c..6e9de21 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -1,24 +1,30 @@ -name: Go +name: "Unit and Build Tests" on: - - push + push: + pull_request: + branches: [ master ] + jobs: + build-test: + runs-on: "ubuntu-latest" - build: - runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 - name: Set up Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: - go-version: 1.16 + go-version: 1.19 - - name: Test - run: make test + - name: "Build & test" + run: "make tools test cross_compile" - - name: Build - run: make tools cross_compile + - name: Upload build artifacts + uses: actions/upload-artifact@v3 + with: + name: binaries + path: builds/pkg/*/gotty \ No newline at end of file diff --git a/.github/workflows/pre-release.yaml b/.github/workflows/pre-release.yaml deleted file mode 100644 index 8e2748f..0000000 --- a/.github/workflows/pre-release.yaml +++ /dev/null @@ -1,37 +0,0 @@ ---- -name: "pre-release" - -on: - push: - branches: - - "master" - - -jobs: - pre-release: - name: "Pre Release" - runs-on: "ubuntu-latest" - - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: 1.16 - - - - name: "Build & test" - run: "make tools release-artifacts" - - - uses: "marvinpinto/action-automatic-releases@latest" - with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "latest" - prerelease: true - title: "Development Build" - files: | - LICENSE - builds/dist/* \ No newline at end of file diff --git a/Makefile b/Makefile index 6570620..28b7fcf 100644 --- a/Makefile +++ b/Makefile @@ -55,8 +55,8 @@ README-options: rm options.txt.tmp tools: - go get github.com/mitchellh/gox - go get github.com/tcnksm/ghr + go install github.com/mitchellh/gox@latest + go install github.com/tcnksm/ghr@latest test: if [ `go fmt $(go list ./... | grep -v /vendor/) | wc -l` -gt 0 ]; then echo "go fmt error"; exit 1; fi