-
-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (92 loc) · 2.44 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
---
name: CI
"on":
pull_request:
push:
schedule:
- cron: "11 12 * * 2"
workflow_dispatch:
defaults:
run:
working-directory: metabrainz.solr
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: metabrainz.solr
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install dependencies
run: pip3 install yamllint ansible ansible-lint jmespath
- name: Run lint
run: |
yamllint .
ansible-lint
test:
name: Test (py${{ matrix.python }} ansible${{ matrix.ansible }} ${{ matrix.distro }})
runs-on: ubuntu-latest
needs:
- lint
strategy:
fail-fast: false
matrix:
python:
- "3.10"
- "3.11"
- "3.12"
ansible:
- 8
- 9
- 10
distro:
- ubuntu2004
- ubuntu2204
- ubuntu2404
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: metabrainz.solr
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Generate test-requirements.txt
run: |
cat <<EOF > test-requirements.txt
ansible==${{ matrix.ansible }}.*
docker
molecule-plugins[docker]
jmespath
# https://github.com/docker/docker-py/issues/3256
requests==2.31.0
EOF
echo "REQS_HASH=$(sha256sum test-requirements.txt | awk '{ print $1 }')" >> "$GITHUB_ENV"
- name: Cache pip directory
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-py${{ matrix.python }}-ansible${{ matrix.ansible }}-${{ env.REQS_HASH }}
- name: Cache local archive directory
uses: actions/cache@v4
with:
path: |
~/.cache/ansible/solr
~/.cache/ansible/zookeeper
key: archives
- name: Install test dependencies
run: pip3 install -r test-requirements.txt
- name: Run pip freeze
run: pip3 freeze --all
- name: Run tests
run: molecule test
env:
ANSIBLE_FORCE_COLOR: 1
PY_COLORS: 1
MOLECULE_DISTRO: ${{ matrix.distro }}