Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add fetch depth param to Azure template #1570

Merged
merged 5 commits into from
May 28, 2021
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
3 changes: 2 additions & 1 deletion azure-pipelines/run-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
steps:
- template: templates/default.yml
parameters:
fetchDepth: 1
fetchRefdata: true
useMamba: true

Expand All @@ -41,7 +42,7 @@ jobs:
source activate tardis
pip install pytest-azurepipelines
pytest tardis --tardis-refdata=$(refdata.dir) --cov=tardis --cov-report=xml --cov-report=html
displayName: 'TARDIS test'
displayName: 'Run tests'

- bash: bash <(curl -s https://codecov.io/bash)
displayName: 'Upload to codecov.io'
22 changes: 13 additions & 9 deletions azure-pipelines/templates/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
# http://tardis-sn.github.io/tardis/development/continuous_integration.html

parameters:
- name: fetchDepth
type: number
default: 0

- name: fetchRefdata
type: boolean
default: false
Expand All @@ -16,18 +20,18 @@ parameters:

steps:
- bash: echo "##vso[task.setvariable variable=shellopts]errexit"
displayName: 'Set BASH exit on error'
displayName: 'Force BASH exit on error'
condition: eq(variables['Agent.OS'], 'Linux')

- bash: |
echo "##vso[task.setvariable variable=tardis.dir]$(Build.SourcesDirectory)/tardis"
echo "##vso[task.setvariable variable=refdata.dir]$(Build.SourcesDirectory)/tardis-refdata"
displayName: 'Set source directories'
displayName: 'Set environment variables'

- ${{ if eq(parameters.useMamba, false) }}:
- bash: |
echo "##vso[task.setvariable variable=package.manager]conda"
displayName: 'Set package manager'
displayName: 'Set environment variables'

- ${{ if eq(parameters.useMamba, true) }}:
- bash: |
Expand All @@ -36,12 +40,12 @@ steps:

- checkout: self
path: s/tardis
displayName: 'Fetch main repository'
fetchDepth: ${{ parameters.fetchDepth }}

- ${{ if eq(parameters.fetchRefdata, true) }}:
- checkout: git://TARDIS/tardis-refdata
lfs: true
displayName: 'Fetch reference data repository'
displayName: 'Fetch reference data'

- bash: echo "##vso[task.prependpath]$CONDA/bin"
displayName: 'Add conda to PATH'
Expand All @@ -52,17 +56,17 @@ steps:

- ${{ if eq(parameters.useMamba, true) }}:
- bash: conda install mamba -c conda-forge -y
displayName: 'Install package manager'
displayName: 'Install Mamba'

- ${{ if eq(parameters.skipInstall, false) }}:
- bash: |
cd $(tardis.dir)
$(package.manager) env create -f tardis_env3.yml
displayName: 'Install conda environment'
displayName: 'Setup environment'

- ${{ if eq(parameters.skipInstall, false) }}:
- bash: |
cd $(tardis.dir)
source activate tardis
python setup.py build_ext --inplace
displayName: 'Build C extensions'
python setup.py install
displayName: 'Install package'
15 changes: 8 additions & 7 deletions docs/development/continuous_integration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -233,16 +233,17 @@ to start a new pipeline use::
steps:
- template: templates/default.yml
parameters:
fetchRefdata: true
useMamba: true

**List of template parameters:**

- ``fetchRefdata``: fetch the ``tardis-refdata`` repository from Azure Repos
(default is *false*).
- ``useMamba``: use the ``mamba`` package manager instead of ``conda``
(default is *false*).
- ``skipInstall``: does not create the TARDIS environment
(default is *false*).
- ``fetchDepth`` (*int*): the depth of commits to fetch from ``tardis`` repository,
default is ``0`` (no limit).
- ``fetchRefdata`` (*bool*): fetch the ``tardis-refdata`` repository from Azure Repos,
default is ``false``.
- ``useMamba`` (*bool*): use the ``mamba`` package manager instead of ``conda``,
default is ``false``.
- ``skipInstall`` (*bool*): does not create the TARDIS environment, default is ``false``.

**List of predefined custom variables:**

Expand Down