Compare commits

...

35 Commits

Author SHA1 Message Date
umarcor
9230b4c574 v0.4.7 2024-05-15 17:09:46 +02:00
umarcor
0c1e72cfd6 with-post-step: use Node.js 20 instead of Node.js 16 2024-05-15 17:03:49 +02:00
umarcor
adef08d3bd v0.4.6 2023-02-26 17:44:46 +01:00
umarcor
191a6471ed releaser: fix creating a release with no assets 2023-02-26 15:42:43 +01:00
Patrick Lehmann
3ae8451cc0 Merge pull request #61 from antoineco/fix-eol
Append EOL after value in GITHUB_STATE
2023-01-27 20:05:35 +01:00
Antoine Cotten
f4951ec52e fix: append EOL after value in GITHUB_STATE 2023-01-27 18:49:49 +01:00
Unai Martinez-Corral
cc576ce25a v0.4.5 (#58) 2022-11-08 02:24:19 +00:00
Unai Martinez-Corral
decf16ff8f with-post-step: update copyright header 2022-11-08 03:21:27 +01:00
Unai Martinez-Corral
9faa1459c9 with-post-step: use option 'shell: true' by default and do not split args
This fixes a breaking change introduced in #46.
'exec' executes commands on the shell by default, while 'spawn' does not.
2022-11-08 03:15:19 +01:00
Unai Martinez-Corral
eb1108c0f0 v0.4.4 (#57) 2022-11-08 00:04:43 +00:00
Unai Martinez-Corral
47ef801713 update codecov/codecov-action to v3 2022-11-07 23:41:59 +00:00
Unai Martinez-Corral
27272d362c update codecov/codecov-action to v2 2022-11-07 23:29:06 +00:00
Unai Martinez-Corral
b12b2d65be update geekyeggo/delete-artifact to v2 2022-11-07 23:25:55 +00:00
Unai Martinez-Corral
bc41308f30 update actions/download-artifact to v3 2022-11-07 22:52:28 +00:00
Unai Martinez-Corral
bbcfd70907 update actions/upload-artifact to v3 2022-11-07 22:52:28 +00:00
Unai Martinez-Corral
c2c2516ec8 update actions/setup-python to v4 2022-11-07 22:52:28 +00:00
Unai Martinez-Corral
57a0827b14 update actions/checkout to v3 2022-11-07 22:52:28 +00:00
Unai Martinez-Corral
17bc23954a set-output is deprecated
https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
2022-11-07 22:52:28 +00:00
Unai Martinez-Corral
97fd0e5927 with-post-step: save-state is deprecated
https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
2022-11-07 22:52:09 +00:00
Unai Martinez-Corral
60dd89651a with-post-step: use Node.js 16 instead of Node.js 12
https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/
2022-11-07 22:14:56 +00:00
Patrick Lehmann
8d0bd87229 Merge remote-tracking branch 'github/main' into dev 2022-10-25 22:42:37 +02:00
Unai Martinez-Corral
31f02bb75b releaser: sort globbed files (#52) 2022-07-20 12:46:13 +01:00
Boyd Kane
c11c7295f6 Sort globbed files for releases
This change simply sorts the list of files after the glob has been resolved. This is useful because these files are often destined for a release, and having to scroll through hundreds of files which aren't sorted is *painful*.

I'm happy to convert this into an option that can be specified in the yaml if you'd prefer?
2022-07-16 13:56:14 +02:00
Patrick Lehmann
09205eccb8 Added also @umarcor to assignees and reviewers for dependabot. 2022-07-14 11:19:37 +02:00
Patrick Lehmann
72f3e4c148 Python version in MinGW64 was bumped from 3.9 to 3.10. 2022-07-14 11:14:06 +02:00
umarcor
d340857eb3 merge main into dev 2022-07-06 17:42:33 +02:00
Unai Martinez-Corral
c8b411bb64 ci: add dependabot configuration file (#43) 2022-06-28 12:56:07 +01:00
Unai Martinez-Corral
895a8764b3 with-post-step: print 'live' logs from subprocess (#46) 2022-06-28 12:54:13 +01:00
dogbert911
2305ab2027 Fix linter 2022-03-31 22:02:40 +03:00
dogbert911
37a055c776 'online' logs from subprocess 2022-03-31 21:25:35 +03:00
umarcor
f0ad308283 v0.4.3 2022-03-02 23:50:16 +01:00
umarcor
562b28ee34 readme: add light screenshot (#42) 2022-03-02 23:49:41 +01:00
Patrick Lehmann
00c43821dd Add dependabot to check for GH action updates. 2022-03-02 18:54:12 +01:00
Unai Martinez-Corral
8cfda1f21a Package: support with and without isolation mode (#39)
# New Features

* Added a 3rd overload for parameter `requirements` in job template `Package`:
  1. When `requirements` is empty  
     → build Python package with `build` in isolation mode. (old behavior)
  1. When `requirements` is `no-isolation`  
     → build Python package with `build` in non-isolation mode. (intended behavior since last release, but it had side-effects)
  1. When `requirements` is any other string  
     → build Python package with `setuptools` using the given `requirements.txt` file to install build dependencies.

# Bug Fixes

* Restore old behavior (run `build` in isolation mode using `venv`).
2022-03-01 22:32:13 +00:00
Patrick Lehmann
457870d760 Support with and without isolation mode. 2022-02-27 17:33:44 +01:00
21 changed files with 122 additions and 67 deletions

18
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,18 @@
version: 2
updates:
# Maintain GitHub Action runners
- package-ecosystem: "github-actions"
directory: "/"
target-branch: dev
commit-message:
prefix: "[Dependabot]"
labels:
- Dependencies
assignees:
- Paebbels
- Umarcor
reviewers:
- Paebbels
- Umarcor
schedule:
interval: "daily" # Checks on Monday trough Friday.

View File

@@ -1,8 +1,16 @@
# New Features
* tbd
# Changes
* tbd
# Bug Fixes
* tbd
----------
# Related PRs:
* tbd

View File

@@ -45,12 +45,12 @@ jobs:
- name: 🗑️ Delete package Artifacts
if: ${{ ! startsWith(github.ref, 'refs/tags') }}
uses: geekyeggo/delete-artifact@v1
uses: geekyeggo/delete-artifact@v2
with:
name: ${{ inputs.package }}
- name: 🗑️ Delete remaining Artifacts
if: ${{ inputs.remaining != '' }}
uses: geekyeggo/delete-artifact@v1
uses: geekyeggo/delete-artifact@v2
with:
name: ${{ inputs.remaining }}

View File

@@ -38,7 +38,7 @@ jobs:
steps:
- name: ⏬ Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: 🛳️ Build documentation
uses: buildthedocs/btd@v0
@@ -46,7 +46,7 @@ jobs:
skip-deploy: true
- name: 📤 Upload 'documentation' artifacts
uses: actions/upload-artifact@master
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.artifact }}
path: doc/_build/html

View File

@@ -62,10 +62,10 @@ jobs:
steps:
- name: ⏬ Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: 🐍 Setup Python ${{ inputs.python_version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python_version }}
@@ -79,6 +79,7 @@ jobs:
id: getVariables
shell: python
run: |
from os import environ
from pathlib import Path
from tomli import load as tomli_load
@@ -110,8 +111,11 @@ jobs:
else:
print(f"File '{coverageRCFile}' not found.")
print(f"::set-output name=coverage_report_html_directory::{htmlDirectory}")
print(f"::set-output name=coverage_report_xml::{xmlFile}")
with open(environ['GITHUB_OUTPUT'], 'a', encoding='utf-8') as gho:
gho.write(f"""\
coverage_report_html_directory={htmlDirectory}
coverage_report_xml={xmlFile}
""")
print(f"DEBUG:\n html={htmlDirectory}\n xml={xmlFile}")
- name: Collect coverage
@@ -130,7 +134,7 @@ jobs:
- name: 📤 Upload 'Coverage Report' artifact
continue-on-error: true
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.artifact }}
path: ${{ steps.getVariables.outputs.coverage_report_html_directory }}
@@ -139,9 +143,9 @@ jobs:
- name: 📊 Publish coverage at CodeCov
continue-on-error: true
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
with:
file: ${{ steps.getVariables.outputs.coverage_report_xml }}
files: ${{ steps.getVariables.outputs.coverage_report_xml }}
flags: unittests
env_vars: PYTHON

View File

@@ -48,10 +48,10 @@ jobs:
steps:
- name: ⏬ Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: 🐍 Setup Python ${{ inputs.python_version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python_version }}
@@ -66,29 +66,43 @@ jobs:
- name: 🔨 [build] Build Python package (source distribution)
if: inputs.requirements == ''
run: python -m build --no-isolation --sdist
run: python -m build --sdist
- name: 🔨 [build] Build Python package (binary distribution - wheel)
if: inputs.requirements == ''
run: python -m build --wheel
# build (not isolated)
- name: 🔧 [build] Install dependencies for packaging and release
if: inputs.requirements == 'no-isolation'
run: python -m pip install build
- name: 🔨 [build] Build Python package (source distribution)
if: inputs.requirements == 'no-isolation'
run: python -m build --no-isolation --sdist
- name: 🔨 [build] Build Python package (binary distribution - wheel)
if: inputs.requirements == 'no-isolation'
run: python -m build --no-isolation --wheel
# setuptools
- name: 🔧 [setuptools] Install dependencies for packaging and release
if: inputs.requirements != ''
if: inputs.requirements != '' && inputs.requirements != 'no-isolation'
run: python -m pip install ${{ inputs.requirements }}
- name: 🔨 [setuptools] Build Python package (source distribution)
if: inputs.requirements != ''
if: inputs.requirements != '' && inputs.requirements != 'no-isolation'
run: python setup.py sdist
- name: 🔨 [setuptools] Build Python package (binary distribution - wheel)
if: inputs.requirements != ''
if: inputs.requirements != '' && inputs.requirements != 'no-isolation'
run: python setup.py bdist_wheel
- name: 📤 Upload wheel artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.artifact }}
path: dist/

View File

@@ -65,6 +65,8 @@ jobs:
id: params
shell: python
run: |
from os import environ
name = '${{ inputs.name }}'
params = {
'python_version': '${{ inputs.python_version }}',
@@ -76,7 +78,9 @@ jobs:
'doc': f'{name}-doc',
}
}
print(f'::set-output name=params::{params!s}')
with open(environ['GITHUB_OUTPUT'], 'a', encoding='utf-8') as gho:
gho.write(f"params={params!s}\n")
print("Parameters:")
print(params)
@@ -112,8 +116,9 @@ jobs:
'python': '3.11.0-alpha.3' if version == '3.11' else version
}
for system in systems
for version in (versions if system != 'msys2' else ['3.9'])
for version in (versions if system != 'msys2' else ['3.10'])
]
print(f'::set-output name=python_jobs::{jobs!s}')
with open(environ['GITHUB_OUTPUT'], 'a', encoding='utf-8') as gho:
gho.write(f"python_jobs={jobs!s}\n")
print("Python jobs:")
print(jobs)

View File

@@ -52,13 +52,13 @@ jobs:
steps:
- name: 📥 Download artifacts '${{ inputs.artifact }}' from 'Package' job
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: ${{ inputs.artifact }}
path: dist/
- name: 🐍 Setup Python ${{ inputs.python_version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python_version }}

View File

@@ -39,10 +39,10 @@ jobs:
steps:
- name: ⏬ Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Download Artifacts
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
path: artifacts

View File

@@ -48,24 +48,24 @@ jobs:
steps:
- name: ⏬ Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: 📥 Download artifacts '${{ inputs.doc }}' from 'BuildTheDocs' job
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: ${{ inputs.doc }}
path: public
- name: 📥 Download artifacts '${{ inputs.coverage }}' from 'Coverage' job
if: ${{ inputs.coverage != '' }}
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: ${{ inputs.coverage }}
path: public/coverage
- name: 📥 Download artifacts '${{ inputs.typing }}' from 'StaticTypeCheck' job
if: ${{ inputs.typing != '' }}
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: ${{ inputs.typing }}
path: public/typing

View File

@@ -39,9 +39,11 @@ jobs:
RELEASE_VERSION=${GIT_TAG#v}
RELEASE_DATETIME="$(date --utc '+%d.%m.%Y - %H:%M:%S')"
# write to step outputs
echo ::set-output name=gitTag::${GIT_TAG}
echo ::set-output name=version::${RELEASE_VERSION}
echo ::set-output name=datetime::${RELEASE_DATETIME}
cat >> "$GITHUB_OUTPUT" << EOF
gitTag=${GIT_TAG}
version=${RELEASE_VERSION}
datetime=${RELEASE_DATETIME}
EOF
- name: 📑 Create Release Page
id: createReleasePage

View File

@@ -57,10 +57,10 @@ jobs:
steps:
- name: ⏬ Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: 🐍 Setup Python ${{ inputs.python_version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python_version }}
@@ -76,7 +76,7 @@ jobs:
- name: 📤 Upload 'Static Typing Report' artifact
if: ${{ inputs.artifact != '' }}
continue-on-error: true
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.artifact }}
path: ${{ inputs.report }}

View File

@@ -45,7 +45,7 @@ jobs:
env:
DOCKER_BUILDKIT: 1
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Build container image
run: docker build -t ghcr.io/pytooling/releaser -f releaser/Dockerfile releaser
@@ -62,7 +62,7 @@ jobs:
Composite:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- run: echo "Build some tool and generate some (versioned) artifacts" > artifact-$(date -u +"%Y-%m-%dT%H-%M-%SZ").txt
@@ -122,7 +122,7 @@ jobs:
- Composite
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- run: echo "Build some tool and generate some (versioned) artifacts" > artifact-$(date -u +"%Y-%m-%dT%H-%M-%SZ").txt

View File

@@ -76,7 +76,7 @@ jobs:
steps:
- name: ⏬ Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: '🟦 Setup MSYS2'
if: matrix.system == 'msys2'
@@ -88,7 +88,7 @@ jobs:
- name: 🐍 Setup Python ${{ matrix.python }}
if: matrix.system != 'msys2'
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
@@ -124,7 +124,7 @@ jobs:
- name: 📤 Upload 'TestReport.xml' artifact
if: inputs.artifact != ''
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.artifact }}-${{ matrix.system }}-${{ matrix.python }}
path: TestReport.xml

View File

@@ -39,10 +39,10 @@ jobs:
steps:
- name: ⏬ Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: 🐍 Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python_version }}

View File

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 74 KiB

BIN
ExamplePipeline_light.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

View File

@@ -88,9 +88,11 @@ This repository provides 10+ Reusable Workflows based on the CI pipelines of the
By combining them, Python packages can be continuously tested and released along with Sphinx documentation sites, to GitHub Releases, GitHub Pages and PyPI.
Optionally, coverage and static type check reports can be gathered.
[![](ExamplePipeline.png)](ExamplePipeline.png)
[![](ExamplePipeline_dark.png)](ExamplePipeline_dark.png)
As shown in the screenshot above, the expected order is:
[![](ExamplePipeline_light.png)](ExamplePipeline_light.png)
As shown in the screenshots above, the expected order is:
- Global:
- [Parameters](.github/workflows/Parameters.yml): a workaround for the limitations to handle global variables in

View File

@@ -52,7 +52,7 @@ def GetListOfArtifacts(argv, files):
if len(argv) > 1:
args += argv[1:]
if len(args) == 1 and args[0].lower() == "none":
print("! Skipping 'files' because it's set to 'none")
print("! Skipping 'files' because it's set to 'none'.")
return []
elif len(args) == 0:
stdout.flush()
@@ -63,14 +63,14 @@ def GetListOfArtifacts(argv, files):
print(f" glob({item!s}):")
for fname in [fname for fname in glob(item, recursive=True) if not Path(fname).is_dir()]:
if Path(fname).stat().st_size == 0:
print(f" - ! Skipping empty file {fname!s}")
print(f" - ! Skipping empty file {fname!s}.")
continue
print(f" - {fname!s}")
flist.append(fname)
if len(flist) < 1:
stdout.flush()
raise (Exception("Empty list of files to upload/update!"))
return flist
return sorted(flist)
def GetGitHubAPIHandler(token):
@@ -101,7 +101,7 @@ def CheckRefSemVer(gh_ref, tag, snapshots):
return (tag, env_tag, False)
elif snapshots:
# is semver compilant prerelease tag, thus a snapshot (we skip it)
print("! Skipping snapshot prerelease")
print("! Skipping snapshot prerelease.")
sys_exit()
return (tag, env_tag, True)
@@ -179,12 +179,15 @@ if paramRM:
asset.delete_asset()
stdout.flush()
print("· Cleanup and/or upload artifacts")
env = environ.copy()
env["GITHUB_TOKEN"] = paramToken
cmd = ["gh", "release", "upload", "--repo", paramRepo, "--clobber", tag] + files
print(f" > {' '.join(cmd)}")
check_call(cmd, env=env)
stdout.flush()
if len(files) > 0:
print("· Upload assets")
env = environ.copy()
env["GITHUB_TOKEN"] = paramToken
cmd = ["gh", "release", "upload", "--repo", paramRepo, "--clobber", tag] + files
print(f" > {' '.join(cmd)}")
check_call(cmd, env=env)
stdout.flush()
else:
print("! Skipping uploading assets because the file list is empty.")
UpdateReference(gh_release, tag, paramSHA if env_tag is None else None, is_prerelease, is_draft)

View File

@@ -37,6 +37,6 @@ inputs:
default: POST
runs:
using: 'node12'
using: 'node20'
main: 'main.js'
post: 'main.js'

View File

@@ -3,7 +3,8 @@
* 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"); *
* you may not use this file except in compliance with the License. *
@@ -24,16 +25,14 @@
* * https://github.com/docker/login-action/issues/72 *
* * https://github.com/actions/runner/issues/1478 *
* ================================================================================================================== */
const { exec } = require("child_process");
const { spawn } = require("child_process");
const { appendFileSync } = require("fs");
const { EOL } = require("os");
function run(cmd) {
exec(cmd, (error, stdout, stderr) => {
if ( stdout.length !== 0 ) { console.log(`${stdout}`); }
if ( stderr.length !== 0 ) { console.error(`${stderr}`); }
if (error) {
process.exitCode = error.code;
console.error(`${error}`);
}
const subprocess = spawn(cmd, { stdio: "inherit", shell: true });
subprocess.on("exit", (exitCode) => {
process.exitCode = exitCode;
});
}
@@ -42,6 +41,6 @@ const key = process.env.INPUT_KEY.toUpperCase();
if ( process.env[`STATE_${key}`] !== undefined ) { // Are we in the 'post' step?
run(process.env.INPUT_POST);
} else { // Otherwise, this is the main step
console.log(`::save-state name=${key}::true`);
appendFileSync(process.env.GITHUB_STATE, `${key}=true${EOL}`);
run(process.env.INPUT_MAIN);
}