Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Do not edit this file.
# This file is generated automatically by executing tox -e generate-workflows

name: CI

on:
push:
branches:
- 'main'
pull_request:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
misc:
uses: ./.github/workflows/misc.yml
lint:
uses: ./.github/workflows/lint.yml
tests:
uses: ./.github/workflows/test.yml

check:
if: always()
needs:
- misc
- lint
- tests
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Do not edit this file.
# This file is generated automatically by executing tox -e generate-workflows

name: Core Contrib Test 0
name: Core Contrib Test

on:
workflow_call:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/generate_workflows.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from pathlib import Path

from generate_workflows_lib import (
generate_ci_workflow,
generate_contrib_workflow,
generate_lint_workflow,
generate_misc_workflow,
Expand All @@ -14,3 +15,4 @@
generate_lint_workflow(tox_ini_path, workflows_directory_path)
generate_misc_workflow(tox_ini_path, workflows_directory_path)
generate_contrib_workflow(workflows_directory_path)
generate_ci_workflow(workflows_directory_path)
Original file line number Diff line number Diff line change
Expand Up @@ -172,25 +172,18 @@ def get_misc_job_datas(tox_envs: list) -> list:


def _generate_workflow(
job_datas: list, name: str, workflow_directory_path: Path, max_jobs=250
):
# Github seems to limit the amount of jobs in a workflow file, that is why
# they are split in groups of 250 per workflow file.
for file_number, job_datas in enumerate(
[
job_datas[index : index + max_jobs]
for index in range(0, len(job_datas), max_jobs)
]
):
with open(
workflow_directory_path.joinpath(f"{name}_{file_number}.yml"), "w"
) as test_yml_file:
test_yml_file.write(
Environment(loader=FileSystemLoader(Path(__file__).parent))
.get_template(f"{name}.yml.j2")
.render(job_datas=job_datas, file_number=file_number)
job_datas: list, name: str, workflow_directory_path: Path
) -> None:
env = Environment(loader=FileSystemLoader(Path(__file__).parent))
with open(
workflow_directory_path.joinpath(f"{name}.yml"), "w"
) as yml_file:
yml_file.write(
env.get_template(f"{name}.yml.j2").render(
job_datas=job_datas,
)
test_yml_file.write("\n")
)
yml_file.write("\n")


def generate_test_workflow(
Expand Down Expand Up @@ -235,3 +228,15 @@ def generate_misc_workflow(
"misc",
workflow_directory_path,
)


def generate_ci_workflow(
workflow_directory_path: Path,
) -> None:
with open(workflow_directory_path.joinpath("ci.yml"), "w") as ci_yml_file:
ci_yml_file.write(
Environment(loader=FileSystemLoader(Path(__file__).parent))
.get_template("ci.yml.j2")
.render()
)
ci_yml_file.write("\n")
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Do not edit this file.
# This file is generated automatically by executing tox -e generate-workflows

name: CI

on:
push:
branches:
- 'main'
pull_request:

permissions:
contents: read

concurrency:
group: ${% raw %}{{ github.workflow }}-${{ github.head_ref || github.run_id }}{% endraw %}
cancel-in-progress: true

jobs:
misc:
uses: ./.github/workflows/misc.yml
lint:
uses: ./.github/workflows/lint.yml
tests:
uses: ./.github/workflows/test.yml

check:
if: always()
needs:
- misc
- lint
- tests
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${% raw %}{{ toJSON(needs) }}{% endraw %}
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
# Do not edit this file.
# This file is generated automatically by executing tox -e generate-workflows

name: Lint {{ file_number }}
name: Lint

on:
push:
branches:
- 'main'
pull_request:
workflow_call:

permissions:
contents: read

concurrency:
group: ${% raw %}{{ github.workflow }}-${{ github.head_ref || github.run_id }}{% endraw %}
cancel-in-progress: true

env:
# Set the SHA to the branch name if the PR has a label 'prepare-release' or 'backport' otherwise, set it to 'main'
# For PRs you can change the inner fallback ('main')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
# Do not edit this file.
# This file is generated automatically by executing tox -e generate-workflows

name: Misc {{ file_number }}
name: Misc

on:
push:
branches:
- 'main'
pull_request:
workflow_call:

permissions:
contents: read

concurrency:
group: ${% raw %}{{ github.workflow }}-${{ github.head_ref || github.run_id }}{% endraw %}
cancel-in-progress: true

env:
# Set the SHA to the branch name if the PR has a label 'prepare-release' or 'backport' otherwise, set it to 'main'
# For PRs you can change the inner fallback ('main')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
# Do not edit this file.
# This file is generated automatically by executing tox -e generate-workflows

name: Test {{ file_number }}
name: Test

on:
push:
branches:
- 'main'
pull_request:
workflow_call:

permissions:
contents: read

concurrency:
group: ${% raw %}{{ github.workflow }}-${{ github.head_ref || github.run_id }}{% endraw %}
cancel-in-progress: true

env:
# Set the SHA to the branch name if the PR has a label 'prepare-release' or 'backport' otherwise, set it to 'main'
# For PRs you can change the inner fallback ('main')
Expand Down
11 changes: 2 additions & 9 deletions .github/workflows/lint_0.yml → .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
# Do not edit this file.
# This file is generated automatically by executing tox -e generate-workflows

name: Lint 0
name: Lint

on:
push:
branches:
- 'main'
pull_request:
workflow_call:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

env:
# Set the SHA to the branch name if the PR has a label 'prepare-release' or 'backport' otherwise, set it to 'main'
# For PRs you can change the inner fallback ('main')
Expand Down
11 changes: 2 additions & 9 deletions .github/workflows/misc_0.yml → .github/workflows/misc.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
# Do not edit this file.
# This file is generated automatically by executing tox -e generate-workflows

name: Misc 0
name: Misc

on:
push:
branches:
- 'main'
pull_request:
workflow_call:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

env:
# Set the SHA to the branch name if the PR has a label 'prepare-release' or 'backport' otherwise, set it to 'main'
# For PRs you can change the inner fallback ('main')
Expand Down
Loading
Loading