-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add clean workflow - remove msvc-analysis workflow - minor changes
- Loading branch information
Showing
6 changed files
with
193 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Delete old artifacts | ||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 0 1 * *' | ||
# Run monthly, at 00:00 on the 1st day of month. | ||
|
||
jobs: | ||
clean_wf_runs: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: write | ||
contents: read | ||
steps: | ||
- name: Delete workflow runs | ||
uses: Mattraks/delete-workflow-runs@v2 | ||
with: | ||
token: ${{ github.token }} | ||
repository: ${{ github.repository }} | ||
retain_days: 30 | ||
keep_minimum_runs: 6 | ||
check_pullrequest_exist: true | ||
|
||
clean_packages: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout repo content | ||
uses: actions/checkout@v4 | ||
|
||
- name: setup python | ||
uses: actions/setup-python@v5 | ||
|
||
- name: install python packages | ||
working-directory: ./ci/clean_packages | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: execute clean script | ||
working-directory: ./ci/clean_packages | ||
env: | ||
ORG_NAME: colorer | ||
PACKAGE_MASK: ^farcolorer_.* | ||
PACKAGE_TYPE: nuget | ||
GITHUB_TOKEN: ${{ secrets.PACKAGES_GITHUB_TOKEN }} | ||
run: python main.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: "Prebuild vcpkg" | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 1 * * 1,3,5' | ||
|
||
env: | ||
BUILD_TYPE: Release | ||
X_VCPKG_NUGET_ID_PREFIX: 'colorer' | ||
VCPKG_BINARY_SOURCES: 'clear;nuget,GitHub,readwrite' | ||
|
||
jobs: | ||
windows-vc: | ||
runs-on: windows-2022 | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
build: [ x64, x86 , ARM64 ] | ||
include: | ||
- { build: x64, arch: amd64, triplet: x64-windows-static-rel, } | ||
- { build: x86, arch: amd64_x86, triplet: x86-windows-static-rel, } | ||
- { build: ARM64, arch: amd64_arm64, triplet: arm64-windows-static-rel, } | ||
|
||
name: windows-${{ matrix.arch }} | ||
|
||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
# fetch all for vcpkg versions functionality | ||
fetch-depth: 0 | ||
|
||
- name: Install vcpkg | ||
run: | | ||
cd external\vcpkg | ||
.\bootstrap-vcpkg.bat | ||
- name: Add C++ build tools to PATH | ||
uses: ilammy/msvc-dev-cmd@v1 | ||
with: | ||
arch: ${{ matrix.arch }} | ||
|
||
- name: Setup NuGet Credentials for vpckg cache | ||
shell: bash | ||
run: > | ||
`$GITHUB_WORKSPACE/external/vcpkg/vcpkg fetch nuget | tail -n 1` | ||
sources add | ||
-source "https://nuget.pkg.github.com/colorer/index.json" | ||
-storepasswordincleartext | ||
-name "GitHub" | ||
-username "${{ secrets.PACKAGES_GITHUB_USER }}" | ||
-password "${{ secrets.PACKAGES_GITHUB_TOKEN }}" | ||
- name: Create Build folder | ||
run: mkdir -p _build | ||
|
||
- name: Configure CMake | ||
shell: bash | ||
# add -DVCPKG_INSTALL_OPTIONS="--debug" for debug output | ||
run: > | ||
cmake -S . -B _build -G "Ninja" | ||
-DCMAKE_BUILD_TYPE=$BUILD_TYPE | ||
-DCOLORER_BUILD_ARCH=${{ matrix.build }} | ||
-DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/external/colorer/external/vcpkg/scripts/buildsystems/vcpkg.cmake | ||
-DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} | ||
-DVCPKG_OVERLAY_PORTS=$GITHUB_WORKSPACE/external/colorer/external/vcpkg-ports | ||
-DVCPKG_OVERLAY_TRIPLETS=$GITHUB_WORKSPACE/external/colorer/external/vcpkg-triplets | ||
-DVCPKG_FEATURE_FLAGS=manifests,versions | ||
# dependencies are being built at the configuration stage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Script for cleaning old versions of packages in GitHub Packages | ||
# Author: https://github.com/ctapmex | ||
|
||
from ghapi.all import GhApi | ||
from ghapi.page import paged | ||
import os | ||
import re | ||
|
||
|
||
def get_version_for_remove(package_versions): | ||
sorted_version = sorted(package_versions, key=lambda d: d['created_at'], reverse=True) | ||
# remove from list actual version | ||
del sorted_version[0] | ||
return sorted_version | ||
|
||
|
||
org_name = os.getenv('ORG_NAME', None) | ||
package_mask = os.getenv('PACKAGE_MASK', None) | ||
package_type = os.getenv('PACKAGE_TYPE', None) | ||
github_token = os.getenv('GITHUB_TOKEN', None) | ||
|
||
if not org_name or not package_type or not package_mask or not github_token: | ||
raise BaseException("not all significant parameters are set") | ||
|
||
api = GhApi(token=github_token) | ||
|
||
package_pages = paged(api.packages.list_packages_for_organization, org=org_name, | ||
package_type=package_type, visibility=None, per_page=100) | ||
|
||
print("search packages") | ||
for package_page in package_pages: | ||
for package in package_page: | ||
if re.search(package_mask, package['name']): | ||
print("found package - ", package['name']) | ||
package_version = [] | ||
version_pages = paged(api.packages.get_all_package_versions_for_package_owned_by_org, org=org_name, | ||
package_name=package['name'], package_type=package['package_type'], state='active', | ||
per_page=100) | ||
for version_page in version_pages: | ||
for version in version_page: | ||
vp = {'version_id': version['id'], 'created_at': version['created_at']} | ||
package_version.append(vp) | ||
|
||
version_for_del = get_version_for_remove(package_version) | ||
print("count of versions of the package to delete - ", len(version_for_del)) | ||
for version in version_for_del: | ||
print("delete id=", version['version_id']) | ||
api.packages.delete_package_version_for_org(org=org_name, package_name=package['name'], | ||
package_type=package['package_type'], | ||
package_version_id=version['version_id']) | ||
|
||
print("finish") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fastcore==1.6.3 | ||
ghapi==1.0.5 | ||
packaging==24.1 |