Test CI
This commit is contained in:
parent
f4364c6398
commit
413302b58e
3 changed files with 73 additions and 1 deletions
|
@ -10,4 +10,7 @@ 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 || true
|
||||||
|
- name: Report checks
|
||||||
|
run: report-checks
|
||||||
|
|
||||||
|
|
39
packages/forgejo-report-checks/default.nix
Normal file
39
packages/forgejo-report-checks/default.nix
Normal 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)
|
30
packages/forgejo-report-checks/forgejo-report-checks.py
Normal file
30
packages/forgejo-report-checks/forgejo-report-checks.py
Normal 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
|
||||||
|
)
|
||||||
|
)
|
Loading…
Add table
Reference in a new issue