diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..66f0c74 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,45 @@ +on: [push, pull_request] +name: Test +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + go-version: [1.15.x, 1.16.x] + + services: + etc: + image: quay.io/coreos/etcd + ports: + - 2379:2379 + env: + ETCD_ADVERTISE_CLIENT_URLS: http://0.0.0.0:2379 + ETCD_LISTEN_CLIENT_URLS: http://0.0.0.0:2379 + consul: + image: consul + ports: + - 8500:8500 + vault096: + image: vault:0.9.6 + ports: + - 8200:8200 + env: + VAULT_DEV_ROOT_TOKEN_ID: root + VAULT_DEV_LISTEN_ADDRESS: 0.0.0.0:8200 + vault010: + image: vault:0.10.0 + ports: + - 8222:8200 + env: + VAULT_DEV_ROOT_TOKEN_ID: root + VAULT_DEV_LISTEN_ADDRESS: 0.0.0.0:8200 + + steps: + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go-version }} + - name: Checkout code + uses: actions/checkout@v2 + - name: Test + run: make test diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..4d463a3 --- /dev/null +++ b/Makefile @@ -0,0 +1,8 @@ +VAULT_ADDR ?= http://127.0.0.1:8200 + +.PHONY: test + +test: + go build + VAULT_ADDR="$(VAULT_ADDR)" \ + go test -v -race -cover -timeout=1m ./... && echo OK || (echo FAIL && exit 1)