-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(template): Adding azure-pipelines to template (#317)
- Loading branch information
Showing
12 changed files
with
22,859 additions
and
13 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
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
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 |
---|---|---|
|
@@ -298,4 +298,5 @@ continuos_integration: | |
choices: | ||
- github_actions | ||
- circleci | ||
- azure_pipelines | ||
visible: true |
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
83 changes: 83 additions & 0 deletions
83
src/scicookie/{{cookiecutter.project_slug}}/azure-pipelines.yml
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,83 @@ | ||
# Python package | ||
# Create and test a Python package on multiple Python versions. | ||
# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more: | ||
# https://docs.microsoft.com/azure/devops/pipelines/languages/python | ||
|
||
trigger: | ||
- main | ||
|
||
pool: | ||
vmImage: ubuntu-latest # Adjust if needed | ||
|
||
steps: | ||
{%- if cookiecutter.use_conda == "yes" %} | ||
- script: | | ||
conda env create -f conda/dev.yaml | ||
conda init | ||
source ~/.bashrc | ||
source /usr/share/miniconda/bin/activate | ||
conda activate {{ cookiecutter.project_slug }} | ||
{%- if cookiecutter.build_system == "poetry" %} | ||
poetry install | ||
{%- elif cookiecutter.build_system == "flit" %} | ||
flit install | ||
{%- elif cookiecutter.build_system == "pdm" %} | ||
pdm install | ||
{%- else %} | ||
pip install . | ||
{%- endif %} | ||
{%- if cookiecutter.use_pre_commit == "yes" %} | ||
pre-commit install | ||
{%- endif %} | ||
displayName: "Install dependencies" | ||
{%- else %} | ||
- task: UsePythonVersion@0 | ||
inputs: | ||
versionSpec: "3.10" # Adjust if needed | ||
|
||
- script: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
{%- if cookiecutter.build_system == "poetry" %} | ||
poetry config virtualenvs.create false; | ||
poetry install | ||
{%- elif cookiecutter.build_system == "flit" %} | ||
flit install | ||
{%- elif cookiecutter.build_system == "pdm" %} | ||
pdm install | ||
{%- elif cookiecutter.build_system == "pixi" %} | ||
pixi install | ||
{%- else %} | ||
pip install . | ||
{%- endif %} | ||
{%- if cookiecutter.use_pre_commit == "yes" %} | ||
pre-commit install | ||
{%- endif %} | ||
displayName: "Install dependencies" | ||
{%- endif %} | ||
- script: | | ||
{%- if cookiecutter.use_conda == "yes" %} | ||
source /usr/share/miniconda/bin/activate | ||
conda activate {{ cookiecutter.project_slug }} | ||
{%- endif %} | ||
{%- if cookiecutter.use_makim == "yes" %} | ||
makim tests.unit | ||
{%- elif cookiecutter.use_make == "yes" %} | ||
make test | ||
{%- else %} | ||
# add your command for running tests here | ||
{%- endif %} | ||
displayName: "Tests" | ||
- script: | | ||
{%- if cookiecutter.use_conda == "yes" %} | ||
source /usr/share/miniconda/bin/activate | ||
conda activate {{ cookiecutter.project_slug }} | ||
{%- endif %} | ||
{%- if cookiecutter.use_makim == "yes" %} | ||
makim tests.linter | ||
{%- elif cookiecutter.use_make == "yes" %} | ||
make lint | ||
{%- else %} | ||
# add your command for running the linter here | ||
{%- endif %} | ||
displayName: "Run style checks" |
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 |
---|---|---|
|
@@ -46,4 +46,4 @@ dependencies: | |
- pip: | ||
# distlib issue | ||
- paginate==0.5.6 | ||
{%- endif %} | ||
{%- endif %} |
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 |
---|---|---|
|
@@ -307,4 +307,5 @@ continuos_integration: | |
choices: | ||
- github_actions | ||
- circleci | ||
- azure_pipelines | ||
visible: true |
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 |
---|---|---|
|
@@ -303,4 +303,5 @@ continuos_integration: | |
choices: | ||
- github_actions | ||
- circleci | ||
- azure_pipelines | ||
visible: true |
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 @@ | ||
"""Test Azure Pipelines YAML files.""" | ||
|
||
import json | ||
import sys | ||
|
||
import yaml | ||
|
||
from jsonschema import validate | ||
|
||
print(sys.argv) | ||
args = 3 | ||
if len(sys.argv) != args: | ||
raise Exception( | ||
"Usage: python test_azure_pipelines.py <schema_file> <yaml_file>" | ||
) | ||
|
||
schema_file = sys.argv[1] | ||
yaml_file = sys.argv[2] | ||
|
||
with open(schema_file, "r") as f: | ||
schema = json.load(f) | ||
|
||
with open(yaml_file, "r") as f: | ||
yaml_data = yaml.safe_load(f) | ||
|
||
|
||
validate(instance=yaml_data, schema=schema) | ||
print( | ||
"The file {} is valid according to the schema {}.".format( | ||
yaml_file, schema_file | ||
) | ||
) |
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
Oops, something went wrong.