-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a new format check workflow to CI. To run format check locally: - on docker: docker build --target=format -o out . - see results in: out/format-output.txt - last line should be "PASS" - command line: make check To fix format errors, run "make fix" locally. Signed-off-by: Jarno Rajahalme <jarno@isovalent.com>
- Loading branch information
1 parent
f1a1608
commit 79f9a08
Showing
7 changed files
with
86 additions
and
9 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: CI check format | ||
on: | ||
pull_request_target: | ||
types: [opened, synchronize, reopened] | ||
|
||
# By specifying the access of one of the scopes, all of those that are not specified are set to 'none'. | ||
permissions: | ||
# To be able to access the repository with actions/checkout | ||
contents: read | ||
|
||
jobs: | ||
format: | ||
timeout-minutes: 30 | ||
name: Check source format | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout PR Source Code | ||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
persist-credentials: false | ||
|
||
- name: Prep for build | ||
run: | | ||
echo "${{ github.event.pull_request.head.sha }}" >SOURCE_VERSION | ||
echo "ENVOY_VERSION=$(cat ENVOY_VERSION)" >> $GITHUB_ENV | ||
echo "BAZEL_VERSION=$(cat .bazelversion)" >> $GITHUB_ENV | ||
echo "BUILDER_DOCKER_HASH=$(git ls-tree --full-tree HEAD -- ./Dockerfile.builder | awk '{ print $3 }')" >> $GITHUB_ENV | ||
- name: Wait for cilium-envoy-builder to be available | ||
timeout-minutes: 45 | ||
shell: bash | ||
run: until docker manifest inspect quay.io/${{ github.repository_owner }}/cilium-envoy-builder-dev:${{ env.BAZEL_VERSION }}-${{ env.BUILDER_DOCKER_HASH }} &> /dev/null; do sleep 15s; done | ||
|
||
- name: Check format | ||
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0 | ||
id: docker_format_ciak | ||
with: | ||
target: format | ||
provenance: false | ||
context: . | ||
file: ./Dockerfile | ||
platforms: linux/amd64 | ||
outputs: type=local,dest=check-format-results | ||
build-args: | | ||
BUILDER_BASE=quay.io/${{ github.repository_owner }}/cilium-envoy-builder-dev:${{ env.BAZEL_VERSION }}-${{ env.BUILDER_DOCKER_HASH }} | ||
cache-from: type=local,src=/tmp/buildx-cache | ||
push: false | ||
|
||
- name: Check for failure | ||
run: ! grep "^Format check failed" check-format-results/format-output.txt | ||
|
||
- name: Upload Format results | ||
if: failure() | ||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 | ||
with: | ||
name: check-format-results | ||
path: check-format-results/format-output.txt | ||
retention-days: 5 |
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
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
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
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
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
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