-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #236 from FabienArcellier/15-github-action-enforce…
…-pr-continuous-integration-rules github action enforce pr continuous integration rules
- Loading branch information
Showing
11 changed files
with
268 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[alfred] | ||
# name = "" # name of a subproject, use the name of the directory if not set | ||
# description = "" # inline documentation for a sub project | ||
# subprojects = [] | ||
|
||
# [alfred.project] | ||
# command = [ "alfred/*.py" ] | ||
# python_path_project_root = true | ||
# python_path_extends = [] | ||
# venv = "src/.." | ||
|
||
# more info about project manifest | ||
# into https://alfred-cli.readthedocs.io/en/latest/project.html#setting-up-a-project-with-alfred-toml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: ci-macos | ||
|
||
on: [ push, pull_request ] | ||
|
||
jobs: | ||
build: | ||
runs-on: macos-latest | ||
strategy: | ||
matrix: | ||
python-version: [ "3.9", "3.10", "3.11", "3.12" ] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "18.x" | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: update package manager & install python3 environment | ||
run: | | ||
sudo pip install poetry | ||
poetry install --with build | ||
- name: install npm environment | ||
run: | | ||
cd ui | ||
npm install | ||
- name: run continuous integration pipeline | ||
run: | | ||
poetry run alfred ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: ci-windows | ||
|
||
on: [ push, pull_request ] | ||
|
||
jobs: | ||
build: | ||
runs-on: windows-latest | ||
strategy: | ||
matrix: | ||
python-version: [ "3.9", "3.10", "3.11", "3.12" ] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "18.x" | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: update package manager & install python3 environment | ||
run: | | ||
pip install poetry | ||
poetry install --with build | ||
- name: install npm environment | ||
run: | | ||
cd ui | ||
npm install | ||
- name: run continuous integration pipeline | ||
run: | | ||
poetry run alfred ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: ci | ||
|
||
on: [ push, pull_request ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [ "3.9", "3.10", "3.11", "3.12" ] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: update package manager & install python3 environment | ||
run: | | ||
sudo pip install poetry | ||
poetry install --with build | ||
- name: install npm environment | ||
run: | | ||
cd ui | ||
npm install | ||
- name: run continuous integration pipeline | ||
run: | | ||
poetry run alfred ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import os.path | ||
import shutil | ||
|
||
import alfred | ||
|
||
|
||
@alfred.command("build", help="build apps package for pypi") | ||
@alfred.option("--ignore-ci", is_flag=True, help="ignore continuous integration pipeline") | ||
def build(ignore_ci: bool = False): | ||
if not ignore_ci: | ||
alfred.invoke_command("ci") | ||
else: | ||
alfred.invoke_command("npm.build") | ||
|
||
alfred.invoke_command("build.app_provisionning") | ||
alfred.invoke_command("build.poetry") | ||
|
||
@alfred.command("build.app_provisionning", help="update app templates using ./apps", hidden=True) | ||
def build_app_provisionning(): | ||
if os.path.isdir('src/streamsync/app_templates'): | ||
shutil.rmtree('src/streamsync/app_templates') | ||
|
||
shutil.copytree( 'apps/default', 'src/streamsync/app_templates/default') | ||
shutil.copytree( 'apps/hello', 'src/streamsync/app_templates/hello') | ||
|
||
@alfred.command("build.poetry", help="build python packages with poetry", hidden=True) | ||
def build_poetry(): | ||
removed_directories = ['dist', 'build'] | ||
for directory in removed_directories: | ||
if os.path.isdir(directory): | ||
shutil.rmtree(directory) | ||
|
||
alfred.run("poetry build") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import os | ||
|
||
import alfred | ||
|
||
|
||
@alfred.command("ci", help="continuous integration pipeline") | ||
def ci(): | ||
alfred.invoke_command("ci.mypy") | ||
alfred.invoke_command("ci.pytest") | ||
alfred.invoke_command("npm.build") | ||
|
||
|
||
@alfred.command("ci.mypy", help="typing checking with mypy on ./src/streamsync") | ||
def ci_mypy(): | ||
alfred.run("mypy ./src/streamsync --exclude app_templates/*") | ||
|
||
|
||
@alfred.command("ci.pytest", help="run pytest on ./tests") | ||
def ci_test(): | ||
os.chdir("tests") | ||
alfred.run("pytest") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import alfred | ||
import os | ||
|
||
@alfred.command("npm.build", help="build ui code") | ||
def npm_build(): | ||
os.chdir("ui") | ||
alfred.run("npm run build") | ||
|
||
@alfred.command("npm.build_custom_components", help="build custom components") | ||
def ui_build_custom(): | ||
os.chdir("ui") | ||
alfred.run("npm run custom.build") |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters