REAME and CONTRIBUTING updates #2331
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.8.0 | |
steps: | |
- | |
name: Set up Go 1.x | |
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 | |
with: | |
go-version: 1.20.10 | |
- | |
name: Set up Python 3.11 | |
uses: actions/setup-python@b64ffcaf5b410884ad320a9cfac8866006a109aa # v4.8.0 | |
with: | |
python-version: 3.11 | |
- | |
name: Check out code into the Go module directory | |
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 | |
- | |
name: Cache Operator SDK ${{ env.OPERATOR_SDK_VERSION }} | |
uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3.3.0 | |
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@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3.3.0 | |
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/[email protected] | |
if ! make check_fmt; then | |
echo "not well formatted sources are found:" | |
git --no-pager diff | |
exit 1 | |
fi | |
- | |
name: Check manifests | |
run: | | |
pip install yq | |
# 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: Check deployment files | |
run: | | |
make generate_default_deployment generate_olm_bundle_yaml | |
if [[ ! -z $(git status -s) ]]; then | |
echo "Generated deployment files are out of date; run 'make generate_default_deployment generate_olm_bundle_yaml'." | |
git status | |
echo "Diff: " | |
git --no-pager diff | |
exit 1 | |
fi | |
- | |
name: Run Go Tests | |
run: | | |
python -m pip install --upgrade pip yq | |
go install github.com/onsi/ginkgo/v2/[email protected] | |
make test | |
- | |
name: Build Codecov report | |
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4 | |
with: | |
files: ./cover.out,./controller.cover.out | |
docker: | |
name: Check docker build | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Check out code into the Go module directory | |
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 | |
- | |
name: Check if dockerimage build is working | |
run: docker build -f ./build/Dockerfile . | |
- | |
name: Check if project-clone dockerimage build is working | |
run: docker build -f ./project-clone/Dockerfile . |