Skip to content

Commit

Permalink
Build by strategy (#940)
Browse files Browse the repository at this point in the history
* Make it possible to re-build by build-strategy
  • Loading branch information
kwk authored Dec 17, 2024
1 parent b0680e5 commit fccfbe2
Showing 1 changed file with 50 additions and 15 deletions.
65 changes: 50 additions & 15 deletions .github/workflows/fedora-copr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,61 @@ on:
# See https://docs.github.com/en/actions/reference/events-that-trigger-workflows#schedule
- cron: "45 0 * * *"

workflow_dispatch: {}
workflow_dispatch:
inputs:
strategy:
description: 'build strategy'
required: true
type: choice
options:
- big-merge
- pgo

jobs:
generate-matrix:
runs-on: ubuntu-latest
outputs:
mymatrix: ${{ steps.set-matrix.outputs.myoutput }}
steps:
- id: set-matrix
run: |
BIG_MERGE_CONFIG=$(jq -c <<EOF
{
"name": "big-merge",
"copr_project_tpl": "@fedora-llvm-team/llvm-snapshots-big-merge-YYYYMMDD",
"copr_target_project": "@fedora-llvm-team/llvm-snapshots",
"clone_url_tpl": "https://src.fedoraproject.org/rpms/PKG.git",
"clone_ref": "rawhide"
}
EOF
)
PGO_CONFIG=$(jq -c <<EOF
{
"name": "pgo",
"copr_project_tpl": "@fedora-llvm-team/llvm-snapshots-pgo-YYYYMMDD",
"copr_target_project": "@fedora-llvm-team/llvm-snapshots-pgo",
"extra_script_file": "scripts/functions-pgo.sh",
"clone_url_tpl": "https://src.fedoraproject.org/forks/kkleine/rpms/PKG.git",
"clone_ref": "pgo"
}
EOF
)
if [[ '${{ inputs.strategy }}' == 'big-merge' ]]; then
INCLUDES="[$BIG_MERGE_CONFIG]"
elif [[ '${{ inputs.strategy }}' == 'pgo' ]]; then
INCLUDES="[$PGO_CONFIG]"
else
INCLUDES="[$BIG_MERGE_CONFIG, $PGO_CONFIG]"
fi
echo "myoutput=$(jq -cn --argjson includes "$INCLUDES" '{include:$includes}')" >> $GITHUB_OUTPUT
build-on-copr:
needs: generate-matrix
strategy:
fail-fast: false
matrix:
name: [big-merge, pgo]
include:
- name: big-merge
copr_project_tpl: "@fedora-llvm-team/llvm-snapshots-big-merge-YYYYMMDD"
copr_target_project: "@fedora-llvm-team/llvm-snapshots"
clone_url_tpl: "https://src.fedoraproject.org/rpms/PKG.git"
clone_ref: rawhide
- name: pgo
copr_project_tpl: "@fedora-llvm-team/llvm-snapshots-pgo-YYYYMMDD"
copr_target_project: "@fedora-llvm-team/llvm-snapshots-pgo"
extra_script_file: "scripts/functions-pgo.sh"
clone_url_tpl: "https://src.fedoraproject.org/forks/kkleine/rpms/PKG.git"
clone_ref: pgo
matrix: ${{fromJson(needs.generate-matrix.outputs.mymatrix)}}
runs-on: ubuntu-latest
container: fedora:39
steps:
Expand Down

0 comments on commit fccfbe2

Please sign in to comment.