forked from GoogleContainerTools/skaffold
-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (59 loc) · 2.58 KB
/
verify-examples.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: Verify examples
# Triggers the workflow on push or pull request events
on: [pull_request]
concurrency:
group: build-${{ github.event.pull_request.number || github.ref }}-${{github.workflow}}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
permissions: read-all
jobs:
dependabot:
name: Verify changes to examples
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19.*
id: go
# Skip changes not affecting examples or integration/examples
- name: Computes number of changes to examples
# can't use github.event.before as it may represent
run: |
git diff --name-only ${{github.event.pull_request.base.sha}}...${{github.event.pull_request.head.sha}} \
| sed -n -e 's;^integration/examples/\([^/]*\)/.*;integration/examples/\1;p' \
| sort -u > /tmp/changed
CHANGED_EXAMPLES=$(tr '\012' ' ' < /tmp/changed)
echo "CHANGED_EXAMPLES=$CHANGED_EXAMPLES"
echo "CHANGED_EXAMPLES=$CHANGED_EXAMPLES" >> $GITHUB_ENV
CHANGED_EXAMPLES_COUNT=$(wc -l < /tmp/changed)
echo CHANGED_EXAMPLES_COUNT=$CHANGED_EXAMPLES_COUNT
echo "CHANGED_EXAMPLES_COUNT=$CHANGED_EXAMPLES_COUNT" >> $GITHUB_ENV
#- name: Install Minikube from minikube master branch @HEAD and start cluster
# run: |
# curl -Lo minikube https://storage.googleapis.com/minikube-builds/master/minikube-linux-amd64
# sudo install minikube /usr/local/bin/minikube
# minikube start --profile=minikube --driver=docker
- name: Build Skaffold from HEAD
if: ${{ env.CHANGED_EXAMPLES_COUNT > 0 }}
run: |
make
echo SKAFFOLD_BINARY=$PWD/out/skaffold >> $GITHUB_ENV
out/skaffold config set --global collect-metrics false
- name: Build changed examples
if: ${{ env.CHANGED_EXAMPLES_COUNT > 0 }}
run: |
for dir in $CHANGED_EXAMPLES; do
(cd $dir && echo ">> $dir" && \
if [[ $dir == 'integration/examples/custom-buildx' ]]; then \
echo "skipping $dir: requires image pushing to succeed which is not done in these tests"; \
elif [ $(expr "$($SKAFFOLD_BINARY inspect build-env list)" : '.*"type":"local".*') -gt 0 ]; then \
$SKAFFOLD_BINARY build --push=false --cache-artifacts=false; \
else \
echo "skipping $dir: not local build-env"; \
fi) \
|| exit 1;
done