Test CI
Some checks failed
/ test (push) Failing after 1m5s

This commit is contained in:
Andrea Ciceri 2024-11-22 16:44:00 +01:00
parent f4364c6398
commit 42bb16b862
Signed by: aciceri
SSH key fingerprint: SHA256:/AagBweyV4Hlfg9u092n8hbHwD5fcB6A3qhDiDA65Rg
3 changed files with 74 additions and 1 deletions

View file

@ -10,4 +10,8 @@ jobs:
- name: Attic login - name: Attic login
run: attic login sisko http://10.100.0.1:8081 ${{secrets.ATTIC_SISKO_TOKEN}} run: attic login sisko http://10.100.0.1:8081 ${{secrets.ATTIC_SISKO_TOKEN}}
- name: Build with nix - name: Build with nix
run: nix-fast-build --no-nom --skip-cached --systems "x86_64-linux aarch64-linux" --attic-cache "sisko" run: nix-fast-build --no-nom --skip-cached --systems "x86_64-linux" --attic-cache "sisko" --result-file result.json
- name: Report checks
if: true
run: report-checks

View file

@ -0,0 +1,39 @@
{
writers,
python3Packages,
fetchFromGitea,
...
}:
let
pyforgejo = python3Packages.buildPythonPackage rec {
pname = "pyforgejo";
version = "1.0.4";
pyproject = true;
build-system = [ python3Packages.poetry-core ];
src = fetchFromGitea {
domain = "codeberg.org";
owner = "harabat";
repo = "pyforgejo";
rev = "3dba949bea41140a47e4dd422a84a6da9fd394e9";
hash = "sha256-qVXlfhKrc7yBnRvL/65bLZFW9fDjC+8FNz7yA6iMPp4=";
};
pythonRelaxDeps = [
"httpx"
];
dependencies = with python3Packages; [
attrs
httpx
python-dateutil
];
pythonImportsCheck = [ "pyforgejo" ];
};
in
writers.writePython3Bin "report-checks" {
libraries = [ pyforgejo ];
flakeIgnore = [ "E501" ];
} (builtins.readFile ./forgejo-report-checks.py)

View file

@ -0,0 +1,30 @@
from pyforgejo import AuthenticatedClient
from pyforgejo.api.repository import repo_create_status
from pyforgejo.models.create_status_option import CreateStatusOption
import json
from os import environ
client = AuthenticatedClient(base_url=environ["GITHUB_API_URL"], token=environ["GITHUB_TOKEN"])
print("hello")
with open('result.json', 'r') as file:
data = json.load(file)
for result in data['results']:
attr = result['attr']
success = result['success']
type = result['type']
print(attr)
response = repo_create_status.sync_detailed(
owner="aciceri",
repo="nixfleet",
sha=environ["GITHUB_SHA"],
client=client,
body=CreateStatusOption(
context=type,
description=attr,
target_url="https://google.com",
state="success" if success else "failure" # ma be pending,success,failure,error_message
)
)