Skip to content

Commit

Permalink
ci/feat(build,pr-build,seed-build): integrate check runs to report bu…
Browse files Browse the repository at this point in the history
…ild status (#218)

* ci(build,pr-build,seed-build): integrate check runs

* ci(pr-build): use reusable workflow for conclusion stage

* fix: fix syntax

* fix: fix syntax

* fix: fix syntax

* ci(pr-build): wrap instantiate-check-runs in pre-actions workflow

* ci(pr-build): refactor seed workflow ref

* fix: fix syntax

* fix: fix syntax

* ci(pr-build): inherit secret from org

* trigger build

* trigger build

* fix: fix stage dependency

* ci(seed-build): add build-type input

* refactor(build): rework main-build logic

* patch(pr-build): specify build-type param

* fix: fix syntax

* patch(seed-build): use string type for build-type

* fix: fix syntax

* refactor(daily-build): rework workflow logic

* chore: pin build workflow to @main

* ci: test potential bug fix

* chore: ready to be merged

* patch/chore(daily-build): update default check-run-id

---------

Co-authored-by: dae-bot[bot] <136105375+dae-bot[bot]@users.noreply.github.com>
  • Loading branch information
piyoki and dae-prow[bot] authored Jul 16, 2023
1 parent 00b39df commit 5e32ffe
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 9 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,20 @@ jobs:
repository: ${{ github.repository }}
ref: ${{ github.sha }}
fetch-depth: 0
check-runs: '["build", "main-build-passed"]'
secrets: inherit

build:
uses: daeuniverse/dae/.github/workflows/seed-build.yml@main
with:
ref: ${{ github.sha }}
build-type: main-build

post-actions:
if: always()
needs: [build]
uses: daeuniverse/ci-seed-jobs/.github/workflows/dae-post-actions.yml@master
with:
check-run-id: "dae-bot[bot]/main-build-passed"
check-run-conclusion: ${{ needs.build.result }}
secrets: inherit
11 changes: 11 additions & 0 deletions .github/workflows/daily-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,20 @@ jobs:
repository: ${{ github.repository }}
ref: ${{ github.sha }}
fetch-depth: 0
check-runs: '["build", "daily-build-passed"]'
secrets: inherit

build:
uses: daeuniverse/dae/.github/workflows/seed-build.yml@main
with:
ref: ${{ github.sha }}
build-type: daily-build

post-actions:
if: always()
needs: [build]
uses: daeuniverse/ci-seed-jobs/.github/workflows/dae-post-actions.yml@master
with:
check-run-id: "dae-bot[bot]/daily-build-passed"
check-run-conclusion: ${{ needs.build.result }}
secrets: inherit
16 changes: 14 additions & 2 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,24 @@ jobs:
repository: ${{ github.repository }}
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
check-runs: '["build", "pr-build-passed"]'
secrets: inherit

build:
needs: [pre-actions]
if: ${{ github.event.pull_request.draft == false }}
uses: daeuniverse/dae/.github/workflows/seed-build.yml@main
with:
ref: ${{ github.event.pull_request.head.sha }}
pr_build: true
pr_number: ${{ github.event.pull_request.number }}
pr-number: ${{ github.event.pull_request.number }}
build-type: pr-build
secrets: inherit

post-actions:
if: always()
needs: [build]
uses: daeuniverse/ci-seed-jobs/.github/workflows/dae-post-actions.yml@master
with:
check-run-id: "dae-bot[bot]/pr-build-passed"
check-run-conclusion: ${{ needs.build.result }}
secrets: inherit
21 changes: 14 additions & 7 deletions .github/workflows/seed-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ on:
type: string
required: true
default: ${{ github.ref }}
pr_build:
type: boolean
required: false
default: false
pr_number:
pr-number:
type: number
required: false
build-type:
type: string
description: "[pr-build,main-build,daily-build,release-build]"

jobs:
build:
Expand Down Expand Up @@ -78,9 +77,9 @@ jobs:
run: |
date=$(git log -1 --format="%cd" --date=short | sed s/-//g)
commit=$(echo ${REF} | cut -c1-6)
if [[ "${{ inputs.pr_build }}" == "true" ]]; then
if [[ "${{ inputs.build-type }}" == "pr-build" ]]; then
count=$(git rev-list --count origin/main..HEAD)
version="unstable-${date}.pr-${{ inputs.pr_number }}.r${count}.${commit}"
version="unstable-${date}.pr-${{ inputs.pr-number }}.r${count}.${commit}"
else
count=$(git rev-list --count HEAD)
version="unstable-${date}.r${count}.${commit}"
Expand Down Expand Up @@ -150,3 +149,11 @@ jobs:
with:
name: dae-${{ steps.get_filename.outputs.ASSET_NAME }}.zip
path: build/*

- name: Report result
uses: daeuniverse/ci-seed-jobs/common/report-check-run@master
if: always()
with:
app_id: ${{ secrets.GH_APP_ID }}
private_key: ${{ secrets.GH_APP_PRIVATE_KEY }}
id: "dae-bot[bot]/build"

0 comments on commit 5e32ffe

Please sign in to comment.