Skip to content

Merge pull request #9 from intercepted16/fix-skip-upload #14

Merge pull request #9 from intercepted16/fix-skip-upload

Merge pull request #9 from intercepted16/fix-skip-upload #14

Workflow file for this run

name: Master CI
permissions:
contents: write
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
test:
name: Test
runs-on: ubuntu-latest
if: github.event_name == 'push'
timeout-minutes: 5
strategy:
matrix:
go: ['stable']
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Cache Go Modules
uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/go/bin
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
- name: Go Format
run: |
gofmt -s -w .
if [ -n "$(git diff --exit-code)" ]; then
echo "::warning::there are uncommitted changes after running go fmt"
fi
- name: Go Vet
run: go vet ./...
- name: Go Tidy
run: go mod tidy
- name: Go Mod Download
run: go mod download
- name: Go Mod Verify
run: go mod verify
- name: Go Generate
run: |
go generate ./...
if [ -n "$(git diff --exit-code)" ]; then
echo "::warning::there are uncommitted changes after running go generate"
fi
- name: Go Test
run: go test -v -count=1 -race -shuffle=on -coverprofile=coverage.txt ./...
tag_and_upload:
name: Create Tag and Upload Artifact
runs-on: ubuntu-latest
needs: test
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Create and Push Tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git tag "build-$(date +'%Y%m%d%H%M%S')"
git push origin --tags
- name: Upload Compiled File
uses: softprops/action-gh-release@v2
with:
tag_name: "build-$(date +'%Y%m%d%H%M%S')"
files: |
mtafoubs