[ci] check for upstream updates of the custom vcpkgs ports

Signed-off-by: Vitalii Koshura <lestat.de.lionkur@gmail.com>
This commit is contained in:
Vitalii Koshura 2024-07-31 01:22:00 +02:00
parent 87bf0b8715
commit effb05f5dd
No known key found for this signature in database
GPG Key ID: CE0DB1726070A5A3
3 changed files with 96 additions and 0 deletions

View File

@ -0,0 +1,42 @@
# This file is part of BOINC.
# http://boinc.berkeley.edu
# Copyright (C) 2024 University of California
#
# BOINC is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation,
# either version 3 of the License, or (at your option) any later version.
#
# BOINC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with BOINC. If not, see <http://www.gnu.org/licenses/>.
name: Check vcpkg ports
on:
schedule:
- cron: '0 0 * * *'
jobs:
build:
if: github.repository == 'BOINC/boinc'
name: ${{ matrix.type }}
runs-on: ubuntu-latest
strategy:
matrix:
type: [check]
fail-fast: false
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with:
fetch-depth: 2
- name: Bootstrap vcpkg
run: |
./linux/bootstrap_vcpkg_cmake.sh
- name: Check custom vcpkg ports for upstream updates
if: success()
run: |
python ./ci_tools/check_custom_vcpkg_ports_for_updates.py

View File

@ -1,6 +1,7 @@
{
"name": "gdk-pixbuf",
"version": "2.42.12",
"port-version": 1,
"description": "Image loading library.",
"homepage": "https://gitlab.gnome.org/GNOME/gdk-pixbuf",
"license": "LGPL-2.1-or-later",

View File

@ -0,0 +1,53 @@
import json
import os
import sys
def get_vcpkg_ports():
vcpkg_ports = []
for root, _, files in os.walk('3rdParty/vcpkg_ports/ports'):
for file in files:
if file == 'vcpkg.json':
vcpkg_ports.append(os.path.join(root, file))
return vcpkg_ports
def get_port_info(port):
with open(port, 'r') as f:
data = json.load(f)
name = data.get('name')
version = data.get('version')
port_version = data.get('port-version', 0)
return name, version, port_version
def parse_ports(file_path):
with open(file_path, 'r') as f:
data = json.load(f)
ports_info = []
for port, details in data.get('default', {}).items():
baseline = details.get('baseline')
port_version = details.get('port-version', 0)
ports_info.append((port, baseline, port_version))
return ports_info
def check_for_updated_ports():
updated_ports = []
for port in get_vcpkg_ports():
name, version, port_version = get_port_info(port)
for port, baseline, baseline_version in parse_ports('3rdParty/linux/vcpkg/versions/baseline.json'):
if name == port and (version != baseline or port_version != baseline_version):
updated_ports.append((port, baseline, baseline_version))
return updated_ports
updated_ports = check_for_updated_ports()
if (updated_ports):
print('The following ports have been updated:')
for port, baseline, baseline_version in updated_ports:
print(f'{port}: {baseline}:{baseline_version}')
sys.exit(1)
else:
print('All ports are up-to-date.')
sys.exit(0)