mirror of
https://github.com/pyTooling/Actions.git
synced 2026-02-12 02:56:56 +08:00
Merge remote-tracking branch 'github/main' into dev
# Conflicts: # .github/workflows/BuildTheDocs.yml # .github/workflows/CoverageCollection.yml # .github/workflows/Parameters.yml # .github/workflows/Release.yml # .github/workflows/UnitTesting.yml
This commit is contained in:
49
.github/workflows/CoverageCollection.yml
vendored
49
.github/workflows/CoverageCollection.yml
vendored
@@ -83,9 +83,10 @@ jobs:
|
|||||||
id: getVariables
|
id: getVariables
|
||||||
shell: python
|
shell: python
|
||||||
run: |
|
run: |
|
||||||
from os import getenv
|
from os import getenv
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from tomli import load as tomli_load
|
from tomli import load as tomli_load
|
||||||
|
from textwrap import dedent
|
||||||
|
|
||||||
htmlDirectory = 'htmlcov'
|
htmlDirectory = 'htmlcov'
|
||||||
xmlFile = './coverage.xml'
|
xmlFile = './coverage.xml'
|
||||||
@@ -93,34 +94,36 @@ jobs:
|
|||||||
|
|
||||||
# Read output paths from 'pyproject.toml' file
|
# Read output paths from 'pyproject.toml' file
|
||||||
if coverageRC == "pyproject.toml":
|
if coverageRC == "pyproject.toml":
|
||||||
pyProjectFile = Path("pyproject.toml")
|
pyProjectFile = Path("pyproject.toml")
|
||||||
if pyProjectFile.exists():
|
if pyProjectFile.exists():
|
||||||
with pyProjectFile.open("rb") as file:
|
with pyProjectFile.open("rb") as file:
|
||||||
pyProjectSettings = tomli_load(file)
|
pyProjectSettings = tomli_load(file)
|
||||||
|
|
||||||
htmlDirectory = pyProjectSettings["tool"]["coverage"]["html"]["directory"]
|
htmlDirectory = pyProjectSettings["tool"]["coverage"]["html"]["directory"]
|
||||||
xmlFile = pyProjectSettings["tool"]["coverage"]["xml"]["output"]
|
xmlFile = pyProjectSettings["tool"]["coverage"]["xml"]["output"]
|
||||||
else:
|
else:
|
||||||
print(f"File '{pyProjectFile}' not found and no ' .coveragerc' file specified.")
|
print(f"File '{pyProjectFile}' not found and no ' .coveragerc' file specified.")
|
||||||
|
|
||||||
# Read output paths from '.coveragerc' file
|
# Read output paths from '.coveragerc' file
|
||||||
elif len(coverageRC) > 0:
|
elif len(coverageRC) > 0:
|
||||||
coverageRCFile = Path(coverageRC)
|
coverageRCFile = Path(coverageRC)
|
||||||
if coverageRCFile.exists():
|
if coverageRCFile.exists():
|
||||||
with coverageRCFile.open("rb") as file:
|
with coverageRCFile.open("rb") as file:
|
||||||
coverageRCSettings = tomli_load(file)
|
coverageRCSettings = tomli_load(file)
|
||||||
|
|
||||||
htmlDirectory = coverageRCSettings["html"]["directory"]
|
htmlDirectory = coverageRCSettings["html"]["directory"]
|
||||||
xmlFile = coverageRCSettings["xml"]["output"]
|
xmlFile = coverageRCSettings["xml"]["output"]
|
||||||
else:
|
else:
|
||||||
print(f"File '{coverageRCFile}' not found.")
|
print(f"File '{coverageRCFile}' not found.")
|
||||||
|
|
||||||
# Write jobs to special file
|
# Write jobs to special file
|
||||||
github_output = Path(getenv("GITHUB_OUTPUT"))
|
github_output = Path(getenv("GITHUB_OUTPUT"))
|
||||||
print(f"GITHUB_OUTPUT: {github_output}")
|
print(f"GITHUB_OUTPUT: {github_output}")
|
||||||
with github_output.open("a+") as f:
|
with github_output.open("a+", encoding="utf-8") as f:
|
||||||
f.write(f"coverage_report_html_directory={htmlDirectory}\n")
|
f.write(dedent(f"""\
|
||||||
f.write(f"coverage_report_xml={xmlFile}\n")
|
coverage_report_html_directory={htmlDirectory}
|
||||||
|
coverage_report_xml={xmlFile}
|
||||||
|
"""))
|
||||||
|
|
||||||
print(f"DEBUG:\n html={htmlDirectory}\n xml={xmlFile}")
|
print(f"DEBUG:\n html={htmlDirectory}\n xml={xmlFile}")
|
||||||
|
|
||||||
@@ -155,7 +158,7 @@ jobs:
|
|||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
uses: codecov/codecov-action@v3
|
uses: codecov/codecov-action@v3
|
||||||
with:
|
with:
|
||||||
file: ${{ steps.getVariables.outputs.coverage_report_xml }}
|
files: ${{ steps.getVariables.outputs.coverage_report_xml }}
|
||||||
flags: unittests
|
flags: unittests
|
||||||
env_vars: PYTHON
|
env_vars: PYTHON
|
||||||
|
|
||||||
|
|||||||
12
.github/workflows/Parameters.yml
vendored
12
.github/workflows/Parameters.yml
vendored
@@ -246,11 +246,13 @@ jobs:
|
|||||||
# Write jobs to special file
|
# Write jobs to special file
|
||||||
github_output = Path(getenv("GITHUB_OUTPUT"))
|
github_output = Path(getenv("GITHUB_OUTPUT"))
|
||||||
print(f"GITHUB_OUTPUT: {github_output}")
|
print(f"GITHUB_OUTPUT: {github_output}")
|
||||||
with github_output.open("a+") as f:
|
with github_output.open("a+", encoding="utf-8") as f:
|
||||||
f.write(f"python_version={python_version}\n")
|
f.write(dedent(f"""\
|
||||||
f.write(f"python_jobs={json_dumps(jobs)}\n")
|
python_version={python_version}
|
||||||
f.write(f"artifact_names={json_dumps(artifact_names)}\n")
|
python_jobs={json_dumps(jobs)}
|
||||||
f.write(f"params={json_dumps(params)}\n")
|
artifact_names={json_dumps(artifact_names)}
|
||||||
|
params={json_dumps(params)}
|
||||||
|
"""))
|
||||||
|
|
||||||
- name: Verify out parameters
|
- name: Verify out parameters
|
||||||
id: verify
|
id: verify
|
||||||
|
|||||||
2
.github/workflows/StaticTypeCheck.yml
vendored
2
.github/workflows/StaticTypeCheck.yml
vendored
@@ -94,7 +94,7 @@ jobs:
|
|||||||
- name: 📤 Upload 'Static Typing Report' JUnit artifact
|
- name: 📤 Upload 'Static Typing Report' JUnit artifact
|
||||||
if: ${{ inputs.junit_artifact != '' }}
|
if: ${{ inputs.junit_artifact != '' }}
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: ${{ inputs.junit_artifact }}
|
name: ${{ inputs.junit_artifact }}
|
||||||
path: ${{ inputs.junit_report }}
|
path: ${{ inputs.junit_report }}
|
||||||
|
|||||||
@@ -37,6 +37,6 @@ inputs:
|
|||||||
default: POST
|
default: POST
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'node12'
|
using: 'node16'
|
||||||
main: 'main.js'
|
main: 'main.js'
|
||||||
post: 'main.js'
|
post: 'main.js'
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
* Unai Martinez-Corral *
|
* Unai Martinez-Corral *
|
||||||
* *
|
* *
|
||||||
* ================================================================================================================== *
|
* ================================================================================================================== *
|
||||||
* Copyright 2021 Unai Martinez-Corral <unai.martinezcorral@ehu.eus> *
|
* Copyright 2021-2022 Unai Martinez-Corral <unai.martinezcorral@ehu.eus> *
|
||||||
|
* Copyright 2022 Unai Martinez-Corral <umartinezcorral@antmicro.com> *
|
||||||
* *
|
* *
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); *
|
* Licensed under the Apache License, Version 2.0 (the "License"); *
|
||||||
* you may not use this file except in compliance with the License. *
|
* you may not use this file except in compliance with the License. *
|
||||||
@@ -25,12 +26,10 @@
|
|||||||
* * https://github.com/actions/runner/issues/1478 *
|
* * https://github.com/actions/runner/issues/1478 *
|
||||||
* ================================================================================================================== */
|
* ================================================================================================================== */
|
||||||
const { spawn } = require("child_process");
|
const { spawn } = require("child_process");
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
function run(cmdline) {
|
function run(cmd) {
|
||||||
var args = cmdline.split(" ");
|
const subprocess = spawn(cmd, { stdio: "inherit", shell: true });
|
||||||
const cmd = args.shift();
|
|
||||||
|
|
||||||
const subprocess = spawn(cmd, args, { stdio: "inherit" });
|
|
||||||
subprocess.on("exit", (exitCode) => {
|
subprocess.on("exit", (exitCode) => {
|
||||||
process.exitCode = exitCode;
|
process.exitCode = exitCode;
|
||||||
});
|
});
|
||||||
@@ -41,6 +40,6 @@ const key = process.env.INPUT_KEY.toUpperCase();
|
|||||||
if ( process.env[`STATE_${key}`] !== undefined ) { // Are we in the 'post' step?
|
if ( process.env[`STATE_${key}`] !== undefined ) { // Are we in the 'post' step?
|
||||||
run(process.env.INPUT_POST);
|
run(process.env.INPUT_POST);
|
||||||
} else { // Otherwise, this is the main step
|
} else { // Otherwise, this is the main step
|
||||||
console.log(`::save-state name=${key}::true`);
|
fs.appendFileSync(process.env.GITHUB_STATE, `${key}=true`);
|
||||||
run(process.env.INPUT_MAIN);
|
run(process.env.INPUT_MAIN);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user