Skip to content

Commit

Permalink
tmt: automatically determine copr version matrix
Browse files Browse the repository at this point in the history
Fixes #79
  • Loading branch information
kwk committed Feb 5, 2024
1 parent 5d17454 commit 71a3f38
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 11 deletions.
57 changes: 46 additions & 11 deletions .github/workflows/tmt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,55 @@ permissions:
actions: write

jobs:
osmatrix:
runs-on: ubuntu-latest
container:
image: "fedora:rawhide"
outputs:
matrix: ${{ steps.osmatrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4

- name: Setup Copr config file
env:
# You need to have those secrets in your repo.
# See also: https://copr.fedorainfracloud.org/api/.
COPR_CONFIG_FILE: ${{ secrets.COPR_CONFIG }}
run: |
mkdir -p ~/.config
printf "$COPR_CONFIG_FILE" > ~/.config/copr
- name: Install Copr CLI and required tools
run: |
dnf install -y copr-cli
- id: osmatrix
shell: bash -e {0}
run: |
source scripts/functions.sh
# Get OS versions comma separated with properly quoted rawhide
os_versions=`get_os_versions | paste -sd "," - | sed 's/rawhide/"rawhide"/'`
cat <<EOF > /tmp/osmatrix
matrix={
"version": [$os_versions]
"strategy": [standalone, big-merge, bootstrap],
"include": [
{"strategy": "standalone", "copr_project_tpl": "llvm-snapshots-incubator-YYYYMMDD"},
{"strategy": "big-merge", "copr_project_tpl": "llvm-snapshots-big-merge-YYYYMMDD"},
{"strategy": "bootstrap", "copr_project_tpl": "llvm-snapshots-bootstrap-YYYYMMDD"}
]
}
EOF
# Store the output
cat /tmp/osmatrix | tr '\n' ' ' >> $GITHUB_OUTPUT
run-tmt:
needs: osmatrix
strategy:
fail-fast: false
matrix:
os: [fedora]
version: [38, 39, rawhide]
strategy: [standalone, big-merge, bootstrap]
include:
- strategy: standalone
copr_project_tpl: "llvm-snapshots-incubator-YYYYMMDD"
- strategy: big-merge
copr_project_tpl: "llvm-snapshots-big-merge-YYYYMMDD"
- strategy: bootstrap
copr_project_tpl: "llvm-snapshots-bootstrap-YYYYMMDD"
matrix: ${{ fromJSON(needs.osmatrix.outputs.matrix) }}
runs-on: ubuntu-latest
container:
image: "${{ matrix.os }}:${{ matrix.version }}"
Expand Down
5 changes: 5 additions & 0 deletions scripts/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ function get_chroots() {
copr list-chroots | grep -P '^fedora-(rawhide|[0-9]+)' | sort | tr '\n' ' '
}

# Returns the Fedora OS versions (including rawhide) that are supported by copr
function get_os_versions() {
get_chroots | grep -ioP 'fedora-\K[0-9,rawhide]+' | sort | uniq
}

# Prints the packages we care about
function get_packages() {
echo "python-lit llvm clang lld compiler-rt libomp"
Expand Down

0 comments on commit 71a3f38

Please sign in to comment.