Skip to content
This repository was archived by the owner on Sep 25, 2024. It is now read-only.

Commit 73df2af

Browse files
Update CI
1 parent 34f4075 commit 73df2af

File tree

4 files changed

+30
-73
lines changed

4 files changed

+30
-73
lines changed

.ansible-lint

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
---
12
exclude_paths:
23
- ./tests/requirements
4+
- .github
35

4-
skip_list:
5-
- yaml
6+
warn_list:
7+
- experimental # all rules tagged as experimental
8+
- fqcn-builtins # Use FQCN for builtin actions.
9+
- yaml # Violations reported by yamllint.

.github/workflows/ci.yml

Lines changed: 21 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,45 @@
11
---
22
name: CI
33

4-
env:
5-
ROLE_NAME: wcm_io_devops.jenkins_pipeline_library
6-
7-
defaults:
8-
run:
9-
working-directory: 'wcm_io_devops.jenkins_pipeline_library'
10-
11-
'on':
12-
pull_request:
4+
on:
135
push:
14-
branches:
15-
- master
6+
branches: [ master ]
7+
pull_request:
8+
branches: [ master ]
169

1710
jobs:
1811

1912
lint:
20-
name: "Lint (${{ matrix.NAME }})"
13+
name: "lint & syntax check"
2114
runs-on: ubuntu-latest
22-
strategy:
23-
matrix:
24-
include:
25-
- NAME: min_ansible_version
26-
ANSIBLE_VERSION: "==2.7.*"
27-
ANSIBLE_LINT_VERSION: "==4.2.*"
28-
- NAME: latest
29-
ANSIBLE_VERSION: ""
30-
ANSIBLE_LINT_VERSION: ""
3115

3216
steps:
33-
- name: Check out the codebase.
17+
- name: Checkout
3418
uses: actions/checkout@v2
35-
with:
36-
path: '${{ env.ROLE_NAME }}'
3719

3820
- name: Cache PIP
3921
uses: actions/cache@v2
4022
with:
4123
path: ~/.cache/pip
42-
key: ${{ runner.os }}-pip-${{ matrix.ANSIBLE_VERSION }}-${{ hashFiles('**/requirements.txt') }}
24+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
4325
restore-keys: |
44-
${{ runner.os }}-pip-${{ matrix.ANSIBLE_VERSION }}-
45-
46-
- name: Create ansible.cfg
47-
run: "printf '[defaults]\nroles_path=./tests/requirements/:../' > ansible.cfg"
26+
${{ runner.os }}-pip-
4827
49-
- name: Set up Python 3.
50-
uses: actions/setup-python@v2
28+
- name: Install role requirements
29+
uses: BSFishy/pip-action@v1
5130
with:
52-
python-version: '3.9.x'
31+
requirements: "requirements.txt"
5332

54-
- name: Install pip tools.
55-
run: |
56-
pip3 install wheel --upgrade
57-
58-
- name: Install test dependencies.
59-
run: >
60-
pip3 install yamllint
61-
ansible${{ matrix.ANSIBLE_VERSION }}
62-
ansible-lint${{ matrix.ANSIBLE_LINT_VERSION }}
63-
--upgrade
64-
65-
- name: Install role requirements.
66-
run: |
67-
pip3 install -r requirements.txt
68-
69-
- name: Install Galaxy requirements.
70-
run: |
71-
ansible-galaxy install -r tests/requirements.yml -p ./tests/requirements
72-
73-
- name: Lint code.
74-
run: |
75-
yamllint .
76-
ansible-lint
33+
- name: Create ansible.cfg
34+
run: "printf '[defaults]\nroles_path=./tests/requirements/:../' > ansible.cfg"
7735

78-
- name: Test syntax.
79-
run: |
80-
ansible-playbook tests/test.yml -i tests/inventory --syntax-check
36+
- name: ansible-lint
37+
uses: ansible-community/ansible-lint-action@v6.2.1
8138

82-
galaxy:
83-
name: "Ansible Galaxy import"
84-
needs:
85-
- lint
86-
if: github.ref == 'refs/heads/master'
87-
runs-on: ubuntu-latest
88-
steps:
89-
- name: Trigger a new import on Galaxy.
90-
uses: robertdebock/galaxy-action@affc5472cd0b08f64a51eafba49b08898c1bbeb8
39+
- name: ansible-playbook syntax check
40+
uses: dawidd6/action-ansible-playbook@v2.5.0
9141
with:
92-
galaxy_api_key: ${{ secrets.GALAXY_API_KEY }}
42+
playbook: tests/test.yml
43+
directory: "."
44+
requirements: tests/requirements.yml
45+
options: --syntax-check -i tests/inventory

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: Trigger a new import on Galaxy.
16-
uses: robertdebock/galaxy-action@affc5472cd0b08f64a51eafba49b08898c1bbeb8
16+
uses: robertdebock/galaxy-action@1.2.1
1717
with:
18-
galaxy_api_key: ${{ secrets.GALAXY_API_KEY }}
18+
galaxy_api_key: ${{ secrets.GALAXY_API_KEY }}

tests/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
- name: test role syntax
33
hosts: test
44
roles:
5-
- wcm_io_devops.jenkins_pipeline_library
5+
- ansible-jenkins-pipeline-library

0 commit comments

Comments
 (0)