-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from joemiller/github-actions-migration
- Loading branch information
Showing
15 changed files
with
200 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
name: main | ||
on: [push, pull_request] | ||
|
||
# TODO: implement support for [skip ci], https://timheuer.com/blog/skipping-ci-github-actions-workflows/ | ||
# TODO: bonus: can we achiever apple codesigning in CI and remove the local script step? | ||
# TODO: update CI/CD section in readme to remove azure refs | ||
# TODO: switch readme CI badge to github actions | ||
# TODO: document autotag git branch+tags stuff in autotag README | ||
|
||
jobs: | ||
lint: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
runs-on: ${{ matrix.os }} | ||
if: github.event_name == 'push' && !contains(toJson(github.event.commits), '[ci skip]') && !contains(toJson(github.event.commits), '[skip ci]') | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-go@v2 | ||
- uses: actions/cache@v1 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: install golangci-lint | ||
run: | | ||
mkdir -p "$HOME/bin" | ||
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b "$HOME/bin" v1.26.0 | ||
echo "::add-path::$HOME/bin" | ||
shell: bash # force windows to use git-bash for access to curl | ||
|
||
- name: install goreleaser | ||
# only need to lint goreleaser on one platform: | ||
if: startsWith(runner.os, 'Linux') | ||
run: curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sudo sh -s -- -b /usr/local/bin | ||
|
||
- name: make lint | ||
env: | ||
CI: "true" | ||
run: make lint | ||
shell: bash | ||
|
||
test: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
runs-on: ${{ matrix.os }} | ||
if: github.event_name == 'push' && !contains(toJson(github.event.commits), '[ci skip]') && !contains(toJson(github.event.commits), '[skip ci]') | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-go@v2 | ||
- uses: actions/cache@v1 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: install go deps | ||
run: make deps | ||
|
||
- name: install pass (linux) | ||
if: startsWith(runner.os, 'Linux') | ||
run: | | ||
sudo apt-get -qy update | ||
sudo apt-get -qy install pass | ||
- name: install pass (macos) | ||
if: startsWith(runner.os, 'macOS') | ||
run: | | ||
brew install pass | ||
- name: make test | ||
env: | ||
CI: "true" | ||
run: make test | ||
|
||
release-test: | ||
needs: [lint, test] | ||
# don't waste time running a goreleaser test build on master since we will run a full release: | ||
if: github.ref != 'refs/heads/master' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-go@v2 | ||
- uses: actions/cache@v1 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: install go deps | ||
run: make deps | ||
- run: make snapshot | ||
|
||
release: | ||
needs: [lint, test] | ||
# only create a release on master builds: | ||
if: github.ref == 'refs/heads/master' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-go@v2 | ||
- uses: actions/cache@v1 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: Unshallow | ||
run: | | ||
# fetch all tags and history so that goreleaser can generate a proper changelog | ||
# and autotag can calculate the next version tag: | ||
git fetch --tags --unshallow --prune | ||
if [ $(git rev-parse --abbrev-ref HEAD) != "master" ]; then | ||
# ensure a local 'master' branch exists for autotag to work correctly: | ||
git branch --track master origin/master | ||
fi | ||
- name: install go deps | ||
run: make deps | ||
|
||
- name: install autotag | ||
run: | | ||
curl -sL https://git.io/autotag-install | sudo sh -s -- -b /usr/local/bin | ||
- name: run autotag to increment version | ||
run: | | ||
autotag | ||
- name: build and push release artifacts | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.BREW_GITHUB_TOKEN }} | ||
# GPG_KEY contents must be base64 encoded: | ||
GPG_KEY: ${{ secrets.GPG_KEY }} | ||
run: | | ||
make release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ vault-token-helper.exe | |
.DS_Store | ||
.envrc | ||
vault-token-helper.signing-key.gpg | ||
.Attic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.