act/.github/workflows/push.yml
Josh Soref 5752a03dcd
Support running commands in repositories without action.yaml (#293)
* Comment for public function

* Add git describe fallback

* spelling: github

* Set initial branch to satisfy tests for modern git

* Clarify -even- if

* Go 1.16

* Support running commands in repositories without action.yaml

Support runnings commands with only a Docker file

Co-authored-by: Casey Lee <cplee@nektos.com>
2021-03-30 12:26:25 -07:00

113 lines
2.9 KiB
YAML

name: push
on: [push, pull_request]
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v1
with:
go-version: 1.16
- uses: golangci/golangci-lint-action@v2
env:
CGO_ENABLED: 0
with:
version: v1.32.2
test:
name: Test on Linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- uses: actions/setup-go@v1
with:
go-version: 1.16
- run: go test -cover -coverprofile=coverage.txt -covermode=atomic ./...
env:
CGO_ENABLED: 0
- name: Upload Codecov report
uses: codecov/codecov-action@v1.3.1
with:
files: coverage.txt
fail_ci_if_error: true # optional (default = false)
test-macos:
name: Test on MacOS
runs-on: macos-latest
continue-on-error: true # Don't let macos test fail whole workflow
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v1
with:
go-version: 1.16
- name: Install MacOS Docker
uses: docker-practice/actions-setup-docker@master
- run: go test -v -timeout 1h -cover ./...
env:
CGO_ENABLED: 0
snapshot:
name: Snapshot
if: ${{ github.event_name == 'pull_request' }}
needs:
- lint
- test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v1
with:
go-version: 1.16
- name: GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --snapshot --rm-dist
- name: Capture Linux Binary
uses: actions/upload-artifact@v2
with:
name: act-linux
path: dist/act_linux_amd64/act
- name: Capture Windows Binary
uses: actions/upload-artifact@v2
with:
name: act-windows
path: dist/act_windows_amd64/act.exe
- name: Capture MacOS Binary
uses: actions/upload-artifact@v2
with:
name: act-macos
path: dist/act_darwin_amd64/act
release:
name: Release
if: startsWith(github.ref, 'refs/tags/v')
needs:
- lint
- test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-go@v1
with:
go-version: 1.16
- name: GoReleaser
uses: goreleaser/goreleaser-action@v1
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
- name: Chocolatey
uses: ./.github/actions/choco
with:
version: ${{ github.ref }}
apiKey: ${{ secrets.CHOCO_APIKEY }}