Merge pull request #60 from migtools/dependabot/go_modules/golang.org… #105
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
name: Go | |
on: | |
push: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
BUILDTAGS: include_gcs include_oss | |
steps: | |
- uses: actions/checkout@v3 | |
- name: pre-req gpgme | |
run: sudo apt-get install libgpgme11 libgpgme-dev | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.18 | |
- name: Build | |
run: go build -tags "${{ env.BUILDTAGS }}" -v ./... | |
- name: Test | |
run: | | |
# enable e2e | |
export UDISTRIBUTION_TEST_E2E_ENABLE=${{ secrets.UDISTRIBUTION_TEST_E2E_ENABLE }} | |
# set env vars from secrets | |
export REGISTRY_STORAGE=${{ secrets.REGISTRY_STORAGE }} | |
export REGISTRY_STORAGE_S3_BUCKET=${{ secrets.REGISTRY_STORAGE_S3_BUCKET }} | |
export REGISTRY_STORAGE_S3_ACCESSKEY=${{ secrets.REGISTRY_STORAGE_S3_ACCESSKEY }} | |
export REGISTRY_STORAGE_S3_SECRETKEY=${{ secrets.REGISTRY_STORAGE_S3_SECRETKEY }} | |
export REGISTRY_STORAGE_S3_REGION=${{ secrets.REGISTRY_STORAGE_S3_REGION }} | |
# start tests | |
make test | |
- uses: codecov/codecov-action@v2 | |
format: | |
needs: [build] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.18 | |
- run: go mod tidy | |
- name: Go mod is tidy | |
run: | | |
git diff --exit-code go.mod go.sum | |
- name: Format | |
run: go fmt ./... | |
- name: commit format | |
uses: EndBug/[email protected] | |
with: | |
message: 'go fmt ./... from Github Actions (Go)' |