Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scripts for matrix #17

Merged
merged 10 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 58 additions & 58 deletions .github/workflows/check-kernel-releases.yaml
Original file line number Diff line number Diff line change
@@ -1,61 +1,61 @@
name: Check remote DTK tags

on:
#name: Check remote DTK tags
#
#on:
# schedule:
# - cron: '*/5 * * * *'
# workflow_dispatch: # Allow manual trigger
[push]
jobs:
check-and-update-dtk-tags:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up skopeo
run: |
sudo apt-get update
sudo apt-get install -y skopeo

- name: Fetch remote DTK kernel version tags
id: fetch-tags
run: |
DTKREPO="quay.io/build-and-sign/pa-driver-toolkit"
TAGS=$(skopeo list-tags docker://$DTKREPO | jq -c '.Tags | sort')
echo "::set-output name=tags::$TAGS"

- name: Compare and update local DTK tags if remote changed
id: compare
run: |
FILE="kernel-versions.json"
RAW_TAGS='${{ steps.fetch-tags.outputs.tags }}'
NEW_TAGS=$(echo "$RAW_TAGS" | jq -c '.')
NEW_TAGS_JSON=$(jq -n \
--argjson kernel_versions "${{ steps.fetch-tags.outputs.tags }}" \
--arg date "$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
'{kernel_versions: $kernel_versions, last_updated: $date}')
if [ -f "$FILE" ]; then
OLD_TAGS=$(cat "$FILE" | jq -c '.kernel_versions | sort')
else
OLD_TAGS="[]"
fi
NEW_TAGS=$(echo "$NEW_TAGS_JSON" | jq -c '.kernel_versions | sort')
if [ "$NEW_TAGS" != "$OLD_TAGS" ]; then
echo "New kernel versions found."
echo "$NEW_TAGS_JSON" > "$FILE"
echo "CHANGED=true" >> $GITHUB_ENV
else
echo "No new kernel versions found."
echo "CHANGED=false" >> $GITHUB_ENV
fi

- name: Commit and push changes for new found kernel versions
if: env.CHANGED == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add kernel-versions.json
git commit -m "Update available DTK Kernel versions tags"
git push

# [push]
#jobs:
# check-and-update-dtk-tags:
# runs-on: ubuntu-latest
#
# steps:
# - name: Checkout repository
# uses: actions/checkout@v3
#
# - name: Set up skopeo
# run: |
# sudo apt-get update
# sudo apt-get install -y skopeo
#
# - name: Fetch remote DTK kernel version tags
# id: fetch-tags
# run: |
# DTKREPO="quay.io/build-and-sign/pa-driver-toolkit"
# TAGS=$(skopeo list-tags docker://$DTKREPO | jq -c '.Tags | sort')
# echo "::set-output name=tags::$TAGS"
#
# - name: Compare and update local DTK tags if remote changed
# id: compare
# run: |
# FILE="kernel-versions.json"
# RAW_TAGS='${{ steps.fetch-tags.outputs.tags }}'
# NEW_TAGS=$(echo "$RAW_TAGS" | jq -c '.')
# NEW_TAGS_JSON=$(jq -n \
# --argjson kernel_versions "${{ steps.fetch-tags.outputs.tags }}" \
# --arg date "$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
# '{kernel_versions: $kernel_versions, last_updated: $date}')
# if [ -f "$FILE" ]; then
# OLD_TAGS=$(cat "$FILE" | jq -c '.kernel_versions | sort')
# else
# OLD_TAGS="[]"
# fi
# NEW_TAGS=$(echo "$NEW_TAGS_JSON" | jq -c '.kernel_versions | sort')
# if [ "$NEW_TAGS" != "$OLD_TAGS" ]; then
# echo "New kernel versions found."
# echo "$NEW_TAGS_JSON" > "$FILE"
# echo "CHANGED=true" >> $GITHUB_ENV
# else
# echo "No new kernel versions found."
# echo "CHANGED=false" >> $GITHUB_ENV
# fi
#
# - name: Commit and push changes for new found kernel versions
# if: env.CHANGED == 'true'
# run: |
# git config user.name "github-actions[bot]"
# git config user.email "github-actions[bot]@users.noreply.github.com"
# git add kernel-versions.json
# git commit -m "Update available DTK Kernel versions tags"
# git push
#
31 changes: 19 additions & 12 deletions .github/workflows/kernel-list.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
name: Python package
name: Get Kernel List

on: [pull_request]
on: [push]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["pypy3.10", "3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- name: checkout repo content
uses: actions/checkout@v2
- name: setup python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
python-version: '3.9'
- name: install python packages
run: |
python -m pip install --upgrade pip
pip install -r scripts/requirements.txt
- name: Display kernel list
run: python scripts/kernel-list.py
run: python scripts/kernels.py
- name: Commit kernel list updates
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Updating the kernel version list"
git push
1 change: 1 addition & 0 deletions data/kernel-list.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"5.14.0-427.13.1.el9_4.x86_64": "4ead5b9864b4839e4e5d2a6348bd7deba5682d057952eab83695d62ad2ea3652", "5.14.0-503.11.1.el9_5.x86_64": "386d86254354e29d3b864523aed478dba3a982c67968b5e2da9ab863deab9a54", "5.14.0-503.19.1.el9_5.x86_64": "de5624ba39358ba4ba962535e4a972a64bd62ef57bd286834eded962856ed39a"}
1 change: 1 addition & 0 deletions data/kernel-list.md5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
46283b373ca65ad42ac9f3cf3bfef316
Binary file added scripts/__pycache__/md5mod.cpython-39.pyc
Binary file not shown.
1 change: 1 addition & 0 deletions scripts/ci
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

2 changes: 1 addition & 1 deletion scripts/kernels.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# Get DTK tags
response = requests.get(dtk_registry_api)
kernel_json = (response.json())
kernel_list = "kernel-list.json"
kernel_list = "data/kernel-list.json"
# Save tags in file
with open(kernel_list, "w+") as output:
json.dump(kernel_json, output)
Expand Down
1 change: 1 addition & 0 deletions scripts/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
requests==2.32.3