static-checks: Check for the force-skip-ci label on each step

This is not the most beautiful solution, but when do the check on every
single step we ensure the test at least started, and consequently will
succeed.

Without this the tests wouldn't even start, making any PR using the
`force-skip-ci` label not mergeable.

Fixes: #2362

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
This commit is contained in:
Fabiano Fidêncio 2021-07-30 12:14:45 +02:00
parent 1d70523a59
commit 3fe6695b0a

View File

@ -11,7 +11,6 @@ on:
name: Static checks name: Static checks
jobs: jobs:
test: test:
if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }}
strategy: strategy:
matrix: matrix:
go-version: [1.15.x, 1.16.x] go-version: [1.15.x, 1.16.x]
@ -26,36 +25,43 @@ jobs:
target_branch: ${{ github.base_ref }} target_branch: ${{ github.base_ref }}
steps: steps:
- name: Install Go - name: Install Go
if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }}
uses: actions/setup-go@v2 uses: actions/setup-go@v2
with: with:
go-version: ${{ matrix.go-version }} go-version: ${{ matrix.go-version }}
env: env:
GOPATH: ${{ runner.workspace }}/kata-containers GOPATH: ${{ runner.workspace }}/kata-containers
- name: Setup GOPATH - name: Setup GOPATH
if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }}
run: | run: |
echo "TRAVIS_BRANCH: ${TRAVIS_BRANCH}" echo "TRAVIS_BRANCH: ${TRAVIS_BRANCH}"
echo "TRAVIS_PULL_REQUEST_BRANCH: ${TRAVIS_PULL_REQUEST_BRANCH}" echo "TRAVIS_PULL_REQUEST_BRANCH: ${TRAVIS_PULL_REQUEST_BRANCH}"
echo "TRAVIS_PULL_REQUEST_SHA: ${TRAVIS_PULL_REQUEST_SHA}" echo "TRAVIS_PULL_REQUEST_SHA: ${TRAVIS_PULL_REQUEST_SHA}"
echo "TRAVIS: ${TRAVIS}" echo "TRAVIS: ${TRAVIS}"
- name: Set env - name: Set env
if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }}
run: | run: |
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
- name: Checkout code - name: Checkout code
if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }}
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
fetch-depth: 0 fetch-depth: 0
path: ./src/github.com/${{ github.repository }} path: ./src/github.com/${{ github.repository }}
- name: Setup travis references - name: Setup travis references
if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }}
run: | run: |
echo "TRAVIS_BRANCH=${TRAVIS_BRANCH:-$(echo $GITHUB_REF | awk 'BEGIN { FS = \"/\" } ; { print $3 }')}" echo "TRAVIS_BRANCH=${TRAVIS_BRANCH:-$(echo $GITHUB_REF | awk 'BEGIN { FS = \"/\" } ; { print $3 }')}"
target_branch=${TRAVIS_BRANCH} target_branch=${TRAVIS_BRANCH}
- name: Setup - name: Setup
if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }}
run: | run: |
cd ${GOPATH}/src/github.com/${{ github.repository }} && ./ci/setup.sh cd ${GOPATH}/src/github.com/${{ github.repository }} && ./ci/setup.sh
env: env:
GOPATH: ${{ runner.workspace }}/kata-containers GOPATH: ${{ runner.workspace }}/kata-containers
- name: Building rust - name: Building rust
if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }}
run: | run: |
cd ${GOPATH}/src/github.com/${{ github.repository }} && ./ci/install_rust.sh cd ${GOPATH}/src/github.com/${{ github.repository }} && ./ci/install_rust.sh
PATH=$PATH:"$HOME/.cargo/bin" PATH=$PATH:"$HOME/.cargo/bin"
@ -63,14 +69,18 @@ jobs:
rustup component add rustfmt clippy rustup component add rustfmt clippy
# Check whether the vendored code is up-to-date & working as the first thing # Check whether the vendored code is up-to-date & working as the first thing
- name: Check vendored code - name: Check vendored code
if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }}
run: | run: |
cd ${GOPATH}/src/github.com/${{ github.repository }} && make vendor cd ${GOPATH}/src/github.com/${{ github.repository }} && make vendor
- name: Static Checks - name: Static Checks
if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }}
run: | run: |
cd ${GOPATH}/src/github.com/${{ github.repository }} && make static-checks cd ${GOPATH}/src/github.com/${{ github.repository }} && make static-checks
- name: Run Compiler Checks - name: Run Compiler Checks
if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }}
run: | run: |
cd ${GOPATH}/src/github.com/${{ github.repository }} && make check cd ${GOPATH}/src/github.com/${{ github.repository }} && make check
- name: Run Unit Tests - name: Run Unit Tests
if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }}
run: | run: |
cd ${GOPATH}/src/github.com/${{ github.repository }} && make test cd ${GOPATH}/src/github.com/${{ github.repository }} && make test