Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Pact decommissioning #1386

Pact decommissioning

Pact decommissioning #1386

Workflow file for this run

#
# Copyright (c) 2021 Red Hat, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: Validate PRs
on:
pull_request:
branches: [main]
env:
GO_VERSION: '1.20'
GOMEGA_DEFAULT_EVENTUALLY_TIMEOUT: 10s
jobs:
go:
name: Check sources
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version: "${{ env.GO_VERSION }}"
- name: Download dependencies
run: go mod download
- 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
- 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: Codecov
uses: codecov/codecov-action@v4
spi-check:
name: Check spi compatibility
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version: "${{ env.GO_VERSION }}"
- name: Checkout SPI Repository
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Extract repository owner from the forked repository full name
fork_owner=$(echo "${{ github.event.pull_request.head.repo.full_name }}" | cut -d '/' -f1)
echo "Fork owner: ${fork_owner}"
# Check if there is a PR in the original repository from the fork owner with the same branch name
pr_number=$(curl -s -H "Authorization: token $GH_TOKEN" "https://api.github.com/repos/redhat-appstudio/service-provider-integration-operator/pulls?state=all&base=main&head=${fork_owner}:${{ github.event.pull_request.head.ref }}" | jq -r '.[0].number' || true)
echo "PR number: ${pr_number}"
re='^[0-9]+$'
if [[ $pr_number =~ $re ]] ; then
echo "A PR exists, check out that branch"
mkdir -p spi
cd spi
git clone "https://github.com/redhat-appstudio/service-provider-integration-operator.git" .
git fetch origin pull/${pr_number}/head:${{ github.event.pull_request.head.ref }}
git checkout "${{ github.event.pull_request.head.ref }}"
else
echo "No PR, check out the main branch"
git clone "https://github.com/redhat-appstudio/service-provider-integration-operator.git" spi
fi
- name: Check SPI mod
run: |
sed -i '4 i replace github.com/redhat-appstudio/remote-secret => ../' ./spi/go.mod
sed -i '5 i replace github.com/Azure/azure-sdk-for-go => github.com/Azure/azure-sdk-for-go v67.2.0+incompatible' ./spi/go.mod
cd spi
cat go.mod
go mod tidy
git diff
- name: Run Go Tests
run: |
cd spi
make test
docker-controller:
name: Check controller docker image build
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check if dockerimage build is working
run: docker build -f ./Dockerfile .