-
Notifications
You must be signed in to change notification settings - Fork 111
executable file
·135 lines (134 loc) · 4.26 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
---
name: "CI"
on: # yamllint disable
push:
branches:
- "develop"
- "main"
pull_request:
release:
types: [published]
schedule:
- cron: "20 3 * * 1"
jobs:
lint:
runs-on: "ubuntu-20.04"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
- name: "Install invoke"
run: "pip install -U pip && pip install invoke"
- name: "Linting"
run: "invoke lint"
test:
runs-on: "ubuntu-20.04"
strategy:
fail-fast: true
matrix:
python-version: ["3.7", "3.8", "3.9"]
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
- name: "Install invoke"
run: "pip install -U pip && pip install invoke"
- name: "Tests"
run: "invoke unit"
needs:
- "lint"
integration:
runs-on: "ubuntu-20.04"
strategy:
fail-fast: false
matrix:
# Need to check what is needed for the integration step
# python-version: ["3.7", "3.8", "3.9"]
# ansible-release: ["base", "core"]
include:
- python-version: "3.8"
ansible-release: "base" # Ansible 2.10
- python-version: "3.8"
ansible-release: "2.11"
- python-version: "3.8"
ansible-release: "core"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
- name: "Install invoke"
run: "pip install -U pip && pip install invoke"
- name: "Install poetry"
if: "${{ matrix.ansible-release == '2.11' }}"
run: "pip install poetry==1.4.2"
- name: "Remove ansible-base"
if: "${{ matrix.ansible-release == '2.11' }}"
run: "poetry remove ansible-base"
- name: "Add ansible-core"
if: "${{ matrix.ansible-release == '2.11' }}"
run: "poetry add ansible-core@~2.11"
- name: "Install poetry"
if: "${{ matrix.ansible-release == '2.9' }}"
run: "pip install poetry==1.4.2"
- name: "Remove ansible-base"
if: "${{ matrix.ansible-release == '2.9' }}"
run: "poetry remove ansible-base"
- name: "Add Ansible 2.9"
if: "${{ matrix.ansible-release == '2.9' }}"
run: "poetry add ansible@~2.9"
- name: "Install poetry"
if: "${{ matrix.ansible-release == '2.12' }}"
run: "pip install poetry==1.4.2"
- name: "Remove ansible-base"
if: "${{ matrix.ansible-release == '2.12' }}"
run: "poetry remove ansible-base"
- name: "Add Ansible 2.12"
if: "${{ matrix.ansible-release == '2.12' }}"
run: "poetry add ansible-core@~2.12 --python ^${{ matrix.python-version }}"
- name: "Start containers"
run: "invoke start"
- name: "Tests"
run: "invoke integration"
needs:
- "test"
publish_github:
name: "Publish to GitHub"
runs-on: "ubuntu-20.04"
if: "startsWith(github.ref, 'refs/tags/v')"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
- name: "Set up Python"
uses: "actions/setup-python@v2"
with:
python-version: "3.9"
- name: "Install Python Packages"
run: "pip install ansible-core"
- name: "Build the collection"
run: "ansible-galaxy collection build --output-path build"
- name: "Upload binaries to release"
uses: "svenstaro/upload-release-action@v2"
with:
repo_token: "${{ secrets.NTC_GITHUB_TOKEN }}"
file: "build/*"
tag: "${{ github.ref }}"
overwrite: true
file_glob: true
needs:
- "integration"
publish_galaxy:
name: "Publish to Ansible Galaxy"
runs-on: "ubuntu-20.04"
if: "startsWith(github.ref, 'refs/tags/v')"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
- name: "Set up Python"
uses: "actions/setup-python@v2"
with:
python-version: "3.9"
- name: "Install Python Packages"
run: "pip install ansible-core"
- name: "Build the collection"
run: "ansible-galaxy collection build --output-path build"
- name: "Publish the collection"
run: "ansible-galaxy collection publish build/* --api-key=${{ secrets.GALAXY_API_TOKEN }}"
needs:
- "integration"