Skip to content

Commit

Permalink
Auto update version db
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Feb 3, 2024
1 parent 90665f8 commit f8921c8
Show file tree
Hide file tree
Showing 3 changed files with 167 additions and 178 deletions.
33 changes: 33 additions & 0 deletions .github/actions/setup-vcpkg/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Setup Vcpkg
description: Install a full vcpkg environment
inputs:

vcpkgVersion:
description: Enter vcpkg version tag or stable or latest
required: false
default: latest
type: string

vcpkgRoot:
description: Enter VCPKGROOT as vcpkg root path
required: false
default: /usr/local/vcpkg
type: string

vcpkgDownload:
description: Enter VCPKGDOWNLOAD as vcpkg download path
required: false
default: /usr/local/vcpkg-downloads
type: string

runs:
using: composite
steps:
- name: Setup vcpkg
run: |
git clone --depth 1 https://github.com/msclock/features.git /tmp/vcpkg
sudo USERNAME="$USER" VCPKGVERSION="${{ inputs.vcpkgVersion }}" VCPKGROOT="${{ inputs.vcpkgRoot }}" \
VCPKGDOWNLOAD="${{ inputs.vcpkgDownload }}" /tmp/vcpkg/src/vcpkg/install.sh
vcpkg --version
shell: bash
178 changes: 0 additions & 178 deletions .github/workflows/untrustedPR.yml

This file was deleted.

134 changes: 134 additions & 0 deletions .github/workflows/versions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: CI

on:
push:
branches:
- qca-qt5

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
format_and_update_ports:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.head_ref }}
fetch-depth: 2

- name: Setup vcpkg
uses: ./.github/actions/setup-vcpkg
with:
vcpkgVersion: latest
vcpkgRoot: /usr/local/vcpkg
vcpkgDownload: /usr/local/vcpkg-downloads

- name: Format vcpkg.json
run: |
vcpkg format-manifest --all $(find . -name "vcpkg.json")
- name: Commit format vcpkg.json
uses: stefanzweifel/git-auto-commit-action@v5
if: success()
with:
commit_message: 'ci: format vcpkg configuration'
file_pattern: vcpkg.json

- name: Exit 1 if vcpkg configuration changes have been detected
if: steps.auto-commit-action.outputs.changes_detected == 'true'
run: |
exit 1
- name: Verify all modules and update hash
run: |
for dir in ports/* ; do
echo "Test to install $dir"
status=0
install_output=$(vcpkg install ${dir##ports/} --overlay-ports=ports) || status=$?
if [[ ! $status -eq 0 ]]; then
echo " Update hash on $dir/portfile.cmake"
expected=$(echo "$install_output" | grep -oP "(?<=Expected hash: ).{128}")
actual=$(echo "$install_output" | grep -oP "(?<=Actual hash: ).{128}")
sed -i "s@${expected}@${actual}@g" "$dir/portfile.cmake"
echo " Expected hash: ${expected}"
echo " Actual hash: ${actual}"
fi
done
- name: Detect hash changes against local
id: filter-hash
uses: dorny/paths-filter@v2
with:
list-files: shell
base: HEAD
filters: |
ports:
- ports/**
- name: Get ports last commit message
if: steps.filter-hash.outputs.ports == 'true'
id: ports-last-commit-message
run: |
echo "msg=$(git log -1 --pretty=%s)" >> $GITHUB_OUTPUT
- name: Commit port hash
if: steps.filter-hash.outputs.ports == 'true'
uses: stefanzweifel/git-auto-commit-action@v5
with:
file_pattern: ports/*
commit_message: ${{ steps.ports-last-commit-message.outputs.msg }}
push_options: --force
commit_options: --amend --no-edit
skip_fetch: true

- name: Detect ports changes against default branch
id: filter-ports
uses: dorny/paths-filter@v2
with:
list-files: shell
filters: |
ports:
- ports/**
- name: Update versions
if: steps.filter-ports.outputs.ports == 'true'
run: |
for dir in ports/* ; do
vcpkg x-add-version ${dir##ports/} --overlay-ports=./ports \
--x-builtin-registry-versions-dir=./versions/ \
--x-builtin-ports-root=./ports
done
- name: Detect versions changes against local
if: steps.filter-ports.outputs.ports == 'true'
id: filter-versions
uses: dorny/paths-filter@v2
with:
list-files: shell
base: HEAD
filters: |
versions:
- versions/**
- name: Get last commit message
if: steps.filter-versions.outputs.versions == 'true'
id: last-commit-message
run: |
echo "msg=$(git log -1 --pretty=%s)" >> $GITHUB_OUTPUT
- name: Commit versions
if: steps.filter-versions.outputs.versions == 'true'
uses: stefanzweifel/git-auto-commit-action@v5
with:
file_pattern: versions/*
commit_message: ${{ steps.last-commit-message.outputs.msg }}
push_options: --force
commit_options: --amend --no-edit
skip_fetch: true

0 comments on commit f8921c8

Please sign in to comment.