[DEVHAS-438]get latest Alizer #1309
Workflow file for this run
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: Validate PRs | |
on: | |
pull_request: | |
branches: [ main ] | |
jobs: | |
go: | |
name: Check sources | |
runs-on: ubuntu-20.04 | |
env: | |
OPERATOR_SDK_VERSION: v1.14.0 | |
PR_CHECK: true | |
steps: | |
- name: Set up Go 1.x | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.18 | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Cache Operator SDK ${{ env.OPERATOR_SDK_VERSION }} | |
uses: actions/cache@v2 | |
id: cache-operator-sdk | |
with: | |
path: ~/cache | |
key: operator-sdk-${{ env.OPERATOR_SDK_VERSION }} | |
- name: Download Operator SDK ${{ env.OPERATOR_SDK_VERSION }} | |
if: steps.cache-operator-sdk.outputs.cache-hit != 'true' | |
run: | | |
mkdir -p ~/cache | |
wget https://github.com/operator-framework/operator-sdk/releases/download/${OPERATOR_SDK_VERSION}/operator-sdk_linux_amd64 -O ~/cache/operator-sdk-${OPERATOR_SDK_VERSION} > /dev/null -O ~/cache/operator-sdk-${OPERATOR_SDK_VERSION} > /dev/null | |
chmod +x ~/cache/operator-sdk-${OPERATOR_SDK_VERSION} | |
- name: Install Operator SDK ${{ env.OPERATOR_SDK_VERSION }} | |
run: | | |
mkdir -p ~/bin | |
cp ~/cache/operator-sdk-${OPERATOR_SDK_VERSION} ~/bin/operator-sdk | |
echo "$HOME/bin" >> $GITHUB_PATH | |
- name: Cache go modules | |
id: cache-mod | |
uses: actions/cache@v2 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Download dependencies | |
run: go mod download | |
if: steps.cache-mod.outputs.cache-hit != 'true' | |
- name: Check go mod status | |
run: | | |
go mod tidy | |
if [[ ! -z $(git status -s) ]] | |
then | |
echo "Go mod state is not clean:" | |
git --no-pager diff | |
exit 1 | |
fi | |
- name: Check format | |
run: | | |
go install github.com/google/addlicense@latest | |
go install golang.org/x/tools/cmd/goimports@latest | |
git reset HEAD --hard | |
make check_fmt | |
if [[ $? != 0 ]] | |
then | |
echo "not well formatted sources are found:" | |
git --no-pager diff | |
exit 1 | |
fi | |
- uses: dominikh/[email protected] | |
with: | |
version: "2022.1.3" | |
install-go: false | |
- name: Check manifests | |
run: | | |
# Note: fmt is necessary after generate since generated sources will | |
# fail format check by default. | |
make generate fmt manifests | |
if [[ ! -z $(git status -s) ]] | |
then | |
echo "generated sources are not up to date:" | |
git --no-pager diff | |
exit 1 | |
fi | |
- name: Run Go Tests | |
run: | | |
make test | |
- name: Check if Manager Kustomize has the right image | |
run: | | |
./check-manager-kustomize.sh | |
exit $? | |
- name: Upload coverage to Codecov | |
uses: codecov/[email protected] | |
- name: Run Gosec Security Scanner | |
run: | | |
go install github.com/securego/gosec/v2/cmd/gosec@latest | |
make gosec | |
if [[ $? != 0 ]] | |
then | |
echo "gosec scanner failed to run " | |
exit 1 | |
fi | |
- name: Upload SARIF file | |
uses: github/codeql-action/upload-sarif@v2 | |
with: | |
# Path to SARIF file relative to the root of the repository | |
sarif_file: gosec.sarif | |
- name: Upload coverage to Codecov | |
uses: codecov/[email protected] | |
docker: | |
name: Check docker build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Check if dockerimage build is working | |
run: docker build -f ./Dockerfile . | |
pact: | |
name: Pact tests | |
runs-on: ubuntu-latest | |
env: | |
PR_NUMBER: ${{ github.event.pull_request.number }} | |
COMMIT_SHA: ${{ github.event.pull_request.head.sha }} | |
PR_CHECK: true | |
OPERATOR_SDK_VERSION: v1.14.0 | |
steps: | |
- name: Set up Go 1.x | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.18 | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Cache Operator SDK ${{ env.OPERATOR_SDK_VERSION }} | |
uses: actions/cache@v2 | |
id: cache-operator-sdk | |
with: | |
path: ~/cache | |
key: operator-sdk-${{ env.OPERATOR_SDK_VERSION }} | |
- name: Download Operator SDK ${{ env.OPERATOR_SDK_VERSION }} | |
if: steps.cache-operator-sdk.outputs.cache-hit != 'true' | |
run: | | |
mkdir -p ~/cache | |
wget https://github.com/operator-framework/operator-sdk/releases/download/${OPERATOR_SDK_VERSION}/operator-sdk_linux_amd64 -O ~/cache/operator-sdk-${OPERATOR_SDK_VERSION} > /dev/null -O ~/cache/operator-sdk-${OPERATOR_SDK_VERSION} > /dev/null | |
chmod +x ~/cache/operator-sdk-${OPERATOR_SDK_VERSION} | |
- name: Install Operator SDK ${{ env.OPERATOR_SDK_VERSION }} | |
run: | | |
mkdir -p ~/bin | |
cp ~/cache/operator-sdk-${OPERATOR_SDK_VERSION} ~/bin/operator-sdk | |
echo "$HOME/bin" >> $GITHUB_PATH | |
- name: Cache go modules | |
id: cache-mod | |
uses: actions/cache@v2 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Download dependencies | |
run: go mod download | |
if: steps.cache-mod.outputs.cache-hit != 'true' | |
- name: Test Pact contracts | |
run: | | |
wget -qO- https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v1.92.0/pact-1.92.0-linux-x86_64.tar.gz | tar xz --one-top-level=./pactcli | |
PATH=${PATH}:$(pwd)/pactcli/pact/bin | |
COMMIT_SHA=${COMMIT_SHA:0:7} | |
make pact |