66 branches :
77 - ref_build_from_changed_files
88
9- env :
10- REGISTRY : ghcr.io
11- framework : unikraft
12- monitor : qemu
13-
149jobs :
1510 get-changed-files :
16- runs-on : ubuntu-latest
11+ runs-on : ubuntu-22.04
1712 outputs :
1813 apps : ${{ steps.filter.outputs.changes }}
19- hello-world : ${{ steps.filter.outputs.hello-world }}
20- hello-world_files : ${{ steps.filter.outputs.hello-world_files }}
14+ changed_json : ${{ steps.format.outputs.build }}
2115 steps :
2216 - name : Checkout code
2317 uses : actions/checkout@v3
@@ -30,89 +24,60 @@ jobs:
3024 token : ${{ secrets.GITHUB_TOKEN }}
3125 filters : |
3226 hello-world:
33- - 'hello-world/src/**'
34- - 'hello-world/rumprun/**'
35- - 'hello-world/mirage/**'
36- - 'hello-world/mewz/**'
37- - 'hello-world/unikraft/**'
38- - 'hello-world/linux/**'
27+ - 'hello-world/**'
28+ hello-env:
29+ - 'hello-env/**'
30+ hello-exec-env:
31+ - 'hello-exec-env/**'
32+ hello-server:
33+ - 'hello-server/**'
34+ httpreply:
35+ - 'httpreply/**'
36+ nginx:
37+ - 'nginx/**'
38+ redis:
39+ - 'redis/**'
40+ net:
41+ - 'net/**'
42+ block-test:
43+ - 'block-test/**'
44+ whoami:
45+ - 'whoami/**'
46+ busybox:
47+ - 'busybox/**'
48+
49+ - name : Format build json
50+ id : format
51+ run : |
52+ DIRS_TO_JSON=$(echo '${{ steps.filter.outputs.hello-world_files }}' | \
53+ jq -c 'reduce .[] as $path (
54+ {};
55+ ($path | split("/")) as $parts |
56+ ($parts[0:-1]) as $dirs |
57+ ($parts[-1]) as $file |
58+
59+ reduce range(0; $dirs | length) as $i (
60+ .;
61+ setpath($dirs[0:$i+1]; getpath($dirs[0:$i+1]) // (if $i == (($dirs | length) - 1) then [] else {} end))
62+ ) |
63+ setpath($dirs; (getpath($dirs) + [$file]))
64+ )'
65+ )
66+ echo "build=$DIRS_TO_JSON" >> "$GITHUB_OUTPUT"
3967
4068 - name : Show changed files
4169 run : |
42- echo "Files in hello-world: ${{ steps.filter.outputs.hello-world_files }}"
4370 echo "Changes: ${{ steps.filter.outputs.changes }}"
71+ echo "Changed files in json: ${{ steps.format.outputs.build }}"
4472
45- for-KVM-based-monitors :
46- name : Build changed apps
73+ for-each-app :
74+ name : Track changes for each app
4775 needs : get-changed-files
48- if : |
49- needs.get-changed-files.outputs.hello-world_files != '' &&
50- (
51- contains(needs.get-changed-files.outputs.hello-world_files, 'src') ||
52- contains(needs.get-changed-files.outputs.hello-world_files, 'unikraft')
53- )
5476 strategy :
5577 fail-fast : false
5678 matrix :
57- monitor : [qemu, firecracker]
58- # #apps: ${{ fromJSON(needs.get-chnaged-files.outputs.apps) }}
59- uses : ./.github/workflows/build_and_manifest.yml
79+ app : ${{ fromJSON(needs.get-chnaged-files.outputs.apps) }}
80+ uses : ./.github/workflows/separate_apps.yml
6081 with :
61- monitor : ${{ matrix.monitor }}
62- secrets : inherit
63-
64- # # build-image:
65- # # name: Build and push image
66- # # needs: get-changed-files
67- # # if: |
68- # # needs.get-changed-files.outputs.hello-world_files != '' &&
69- # # (
70- # # contains(needs.get-changed-files.outputs.hello-world_files, 'src') ||
71- # # contains(needs.get-changed-files.outputs.hello-world_files, 'unikraft')
72- # # )
73- # # strategy:
74- # # matrix:
75- # # include:
76- # # - arch: amd64
77- # # runner: ubuntu-22.04
78- # # - arch: arm64
79- # # runner: ubuntu-22.04-arm
80- # # runs-on: ${{ matrix.runner }}
81- # # steps:
82- # # - name: Checkout code
83- # # uses: actions/checkout@v4
84- # # with:
85- # # fetch-depth: 0
86- # #
87- # # - name: Set short SHA
88- # # run: echo "SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
89- # #
90- # # - name: Set up Docker Buildx
91- # # uses: docker/setup-buildx-action@v3
92- # #
93- # # - name: Log into registry ${{ env.REGISTRY }}
94- # # uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772
95- # # with:
96- # # registry: ${{ env.REGISTRY }}
97- # # username: ${{ github.actor }}
98- # # password: ${{ secrets.GITHUB_TOKEN }}
99- # #
100- # # - name: Extract Docker metadata
101- # # id: meta
102- # # uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804
103- # # with:
104- # # images: ${{ env.REGISTRY }}/${{ github.repository }}/hello-world-${{ env.monitor }}-${{ env.framework }}
105- # # tags: |
106- # # type=sha,prefix=${{ matrix.arch }}-,format=long
107- # #
108- # # - name: Build and push
109- # # id: build-and-push
110- # # uses: docker/build-push-action@v6
111- # # with:
112- # # context: ./hello-world/${{ env.framework }}
113- # # tags: ${{ steps.meta.outputs.tags }}
114- # # labels: ${{ steps.meta.outputs.labels }}
115- # # platforms: linux/${{ matrix.arch }}
116- # # push: true
117- # # provenance: false
118- # # file: ./hello-world/${{ env.framework }}/bunnyfile-${{ env.monitor }}-${{ matrix.arch }}
82+ app : ${{ matrix.app }}
83+ changed : ${{ needs.get-chnaged-files.outputs.changed_json }}
0 commit comments