Skip to content

Commit

Permalink
ci: add unit tests to azure pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
jooola committed Sep 25, 2023
1 parent 4ae557c commit 055fa84
Show file tree
Hide file tree
Showing 6 changed files with 130 additions and 67 deletions.
176 changes: 110 additions & 66 deletions .azure-pipelines/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,137 +36,181 @@ pool: Standard

stages:
### Sanity
- stage: Ansible_devel
- stage: Sanity_devel
displayName: Sanity devel
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
targets:
- name: Sanity
test: "devel/sanity/1"
- name: Ansible Devel
test: devel/sanity/1

- stage: Ansible_2_16
- stage: Sanity_2_16
displayName: Sanity 2.16
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
targets:
- name: Sanity
test: "2.16/sanity/1"
- stage: Ansible_2_15
- name: Ansible 2.16
test: 2.16/sanity/1

- stage: Sanity_2_15
displayName: Sanity 2.15
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
targets:
- name: Sanity
test: "2.15/sanity/1"
- stage: Ansible_2_14
- name: Ansible 2.15
test: 2.15/sanity/1

- stage: Sanity_2_14
displayName: Sanity 2.14
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
targets:
- name: Sanity
test: "2.14/sanity/1"
- stage: Ansible_2_13
- name: Ansible 2.14
test: 2.14/sanity/1

- stage: Sanity_2_13
displayName: Sanity 2.13
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
targets:
- name: Sanity
test: "2.13/sanity/1"
- name: Ansible 2.13
test: 2.13/sanity/1

### Units
- stage: Units_devel
displayName: Units devel
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
targets:
- name: Python 3.10
test: devel/units/3.10

- stage: Units_2_16
displayName: Units 2.16
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
targets:
- name: Python 3.10
test: 2.16/units/3.10

- stage: Units_2_15
displayName: Units 2.15
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
targets:
- name: Python 3.9
test: 2.15/units/3.9

- stage: Units_2_14
displayName: Units 2.14
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
targets:
- name: Python 3.9
test: 2.14/units/3.9

- stage: Units_2_13
displayName: Units 2.13
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
targets:
- name: Python 3.8
test: 2.13/units/3.8

## Integration tests (remote)
- stage: Hetzner_devel
displayName: Hetzner devel
## Integration
- stage: Integration_devel
displayName: Integration devel
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
groups:
- 1
- 2
- 3
groups: [1, 2, 3]
targets:
- name: hcloud
test: "devel/hcloud/3.10"
- name: Python 3.10
test: devel/integration/3.10

- stage: Hetzner_2_16
displayName: Hetzner 2.16
- stage: Integration_2_16
displayName: Integration 2.16
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
groups:
- 1
- 2
- 3
groups: [1, 2, 3]
targets:
- name: hcloud
test: "2.16/hcloud/3.10"
- name: Python 3.10
test: 2.16/integration/3.10

- stage: Hetzner_2_15
displayName: Hetzner 2.15
- stage: Integration_2_15
displayName: Integration 2.15
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
groups:
- 1
- 2
- 3
groups: [1, 2, 3]
targets:
- name: hcloud
test: "2.15/hcloud/3.9"
- name: Python 3.9
test: 2.15/integration/3.9

- stage: Hetzner_2_14
displayName: Hetzner 2.14
- stage: Integration_2_14
displayName: Integration 2.14
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
groups:
- 1
- 2
- 3
groups: [1, 2, 3]
targets:
- name: hcloud
test: "2.14/hcloud/3.9"
- name: Python 3.9
test: 2.14/integration/3.9

- stage: Hetzner_2_13
displayName: Hetzner 2.13
- stage: Integration_2_13
displayName: Integration 2.13
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
groups:
- 1
- 2
- 3
groups: [1, 2, 3]
targets:
- name: hcloud
test: "2.13/hcloud/3.9"
- name: Python 3.8
test: 2.13/integration/3.8

### Finally
- stage: Summary
condition: succeededOrFailed()
dependsOn:
- Ansible_devel
- Ansible_2_16
- Ansible_2_15
- Ansible_2_14
- Ansible_2_13
- Hetzner_devel
- Hetzner_2_16
- Hetzner_2_15
- Hetzner_2_14
- Hetzner_2_13
- Sanity_devel
- Sanity_2_16
- Sanity_2_15
- Sanity_2_14
- Sanity_2_13
- Units_devel
- Units_2_16
- Units_2_15
- Units_2_14
- Units_2_13
- Integration_devel
- Integration_2_16
- Integration_2_15
- Integration_2_14
- Integration_2_13
jobs:
- template: templates/coverage.yml
File renamed without changes.
2 changes: 2 additions & 0 deletions tests/unit/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
python-dateutil
requests
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/utils/shippable/shippable.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ else
fi

# STAR: HACK install dependencies
retry pip install -r tests/integration/requirements.txt -c tests/integration/constraints.txt
retry pip install -r tests/integration/requirements.txt -c tests/constraints.txt
retry ansible-galaxy -vvv collection install -r tests/requirements.yml

retry pip install rstcheck
Expand Down
17 changes: 17 additions & 0 deletions tests/utils/shippable/units.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

set -o pipefail -eux

declare -a args
IFS='/:' read -ra args <<< "$1"

python_version="${args[1]}"

ansible-test env --timeout 30 --color -v

# shellcheck disable=SC2086
ansible-test units --color -v \
--docker default \
--python "$python_version" \
${COVERAGE:+"$COVERAGE"} \
${CHANGED:+"$CHANGED"}

0 comments on commit 055fa84

Please sign in to comment.