Skip to content

Commit

Permalink
enable building latest megaservice image on push event in CI
Browse files Browse the repository at this point in the history
Signed-off-by: Yingchun Guo <[email protected]>
  • Loading branch information
daisy-ycguo committed Jun 14, 2024
1 parent 2b51374 commit b27ad19
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 4 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/image-build-on-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
# Test
name: Build latest images on push event

on:
push:
branches: [ 'main', 'daisyonpush' ]
paths:
- "**/docker/*.py"
- "**/docker/Dockerfile"
- "**/docker/ui/**"
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-on-push
cancel-in-progress: true

jobs:
job1:
uses: ./.github/workflows/reuse-get-test-matrix.yml

mega-image-build:
needs: job1
strategy:
matrix: ${{ fromJSON(needs.job1.outputs.run_matrix) }}
uses: ./.github/workflows/reuse-image-build.yml
with:
image-tag: latest
mega-service: "${{ matrix.example }}"
2 changes: 1 addition & 1 deletion .github/workflows/manifest-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
job1:
uses: ./.github/workflows/reuse-get-test-matrix.yml
with:
diff-excluded-files: '.github|deprecated|docker|assets'
diff-excluded-files: '.github|deprecated|docker|assets|*.md|*.txt'
xeon-server-lable: 'k8s'
gaudi-server-lable: ""

Expand Down
19 changes: 17 additions & 2 deletions .github/workflows/reuse-get-test-matrix.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

# Support push and pull_request events
name: Get Test Matrix
permissions: read-all
on:
Expand Down Expand Up @@ -33,15 +34,29 @@ jobs:
- name: Checkout out Repo
uses: actions/checkout@v4
with:
ref: "refs/pull/${{ github.event.number }}/merge"
fetch-depth: 0

- name: print
run: |
echo "The event name is ${{ github.event_name }}"
echo "Before SHA is ${{ github.event.before }}"
echo "After SHA is ${{ github.event.after }}"
echo "Commit SHA is ${{ github.sha }}"
merged_commit=$(git log -1 --format='%H')
echo "Merged commit is $merged_commit"
echo "pull_request.base.sha is ${{ github.event.pull_request.base.sha }}"
- name: Get test matrix
id: get-test-matrix
run: |
set -xe
merged_commit=$(git log -1 --format='%H')
changed_files="$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${merged_commit} | \
if [ "${{ github.event_name }}" == "pull_request" ] || [ "${{ github.event_name }}" == "pull_request_target" ]; then
base_commit=${{ github.event.pull_request.base.sha }}
else
base_commit=$(git rev-parse HEAD~1) # push event
fi
changed_files="$(git diff --name-only ${base_commit} ${merged_commit} | \
grep -vE '${{ inputs.diff-excluded-files }}')" || true
examples=$(printf '%s\n' "${changed_files[@]}" | grep '/' | cut -d'/' -f1 | sort -u)
run_matrix="{\"include\":["
Expand Down
2 changes: 1 addition & 1 deletion CodeGen/docker/codegen.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

# Test
import asyncio
import os

Expand Down

0 comments on commit b27ad19

Please sign in to comment.