Merge pull request #1066 from godaddy/dependabot/github_actions/actio… #73
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] AppEncryption CI' | |
on: | |
workflow_dispatch: | |
inputs: | |
go-version: | |
description: 'Go version' | |
required: false | |
push: | |
paths: | |
- 'go/appencryption/**' | |
- '.github/workflows/go-appencryption-*' | |
branches-ignore: | |
- 'release-*' | |
permissions: | |
contents: read | |
concurrency: | |
group: ${{ github.workflow }}-go-ae-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
init-defaults: | |
name: Init Defaults | |
runs-on: ubuntu-latest | |
outputs: | |
go-version: ${{ steps.init.outputs.go-version }} | |
steps: | |
- id: init | |
name: Init Go version | |
run: | | |
go_version="${{ inputs.go-version }}" | |
if [ -z "${go_version}" ]; then | |
go_version='stable' | |
fi | |
echo "Go version: ${go_version}" | |
echo "go-version=${go_version}" >> $GITHUB_OUTPUT | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
needs: init-defaults | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Set up Go | |
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 | |
with: | |
go-version: ${{ needs.init-defaults.outputs.go-version }} | |
cache-dependency-path: 'go/*/go.sum' | |
- name: Install dependencies | |
run: | | |
cd go/appencryption | |
go get . | |
- name: Build | |
run: | | |
cd go/appencryption | |
./scripts/build.sh | |
test: | |
name: Run Unit Tests | |
runs-on: ubuntu-latest | |
needs: [init-defaults, build] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Set up Go | |
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 | |
with: | |
go-version: ${{ needs.init-defaults.outputs.go-version }} | |
cache-dependency-path: 'go/*/go.sum' | |
- name: Install dependencies | |
run: | | |
cd go/appencryption | |
go get . | |
go install gotest.tools/gotestsum@latest | |
- name: Run linters | |
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1 | |
with: | |
version: 'v1.60.1' | |
skip-cache: true | |
working-directory: 'go/appencryption' | |
- name: Run unit tests | |
run: | | |
cd go/appencryption | |
sudo prlimit --pid $$ --core=-1 | |
sudo prlimit --pid $$ --memlock=-1:-1 | |
./scripts/test.sh | |
- name: Unit test summary | |
uses: test-summary/action@032c8a9cec6aaa3c20228112cae6ca10a3b29336 # v2.3.0 | |
with: | |
paths: 'go/appencryption/junit_results.xml' | |
if: always() |