-
Notifications
You must be signed in to change notification settings - Fork 0
153 lines (137 loc) · 3.86 KB
/
continuous-integration.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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: Continuous Integration
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
permissions:
contents: write
pull-requests: write
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
Bot-pyLint:
runs-on: ubuntu-latest
defaults:
run:
working-directory: "ansible-sdv-pipeline"
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.x
uses: actions/setup-python@v3
with:
python-version: 3.x
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint flake8 ansible==10.2.0
pip install -r requirements.txt
- name: Analysing the code with pylint
run: |
pylint $(git ls-files '*.py') --fail-under 5 --fail-on F,E,W,C,R
- name: Checking code styling
run: |
flake8 .
#
Bot-ansible-lint:
runs-on: ubuntu-latest
defaults:
run:
working-directory: "ansible-sdv-pipeline"
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.x
uses: actions/setup-python@v3
with:
python-version: 3.x
- name: Install Ansible-lint
run: |
python -m pip install --upgrade pip
pip install ansible-lint
- name: Running Ansible-lint
run: ansible-lint ./*
#
Bot-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: "18.x"
cache: "npm"
cache-dependency-path: "**/package-lock.json"
- name: Installing dependencies
run: npm ci
- name: Linting the commit message
run: npx commitlint -V --from=HEAD~1
- name: Linting the application code
run: npm run lint-bot
- name: Running unit tests
run: npm run unit-test
Docs-build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: "docs"
steps:
- uses: actions/checkout@v4
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: "18.x"
cache: "npm"
cache-dependency-path: "**/package-lock.json"
- name: Installing dependencies
run: npm ci
- name: Linting the docs code
run: npm run lint
working-directory: "docs"
- name: Setup Pages
uses: actions/configure-pages@v4
with:
static_site_generator: next
- name: Building docs
run: npm run build
- name: Uploading artifacts
if: ${{ github.ref == 'refs/heads/main' }}
uses: actions/upload-pages-artifact@v3
with:
path: ./docs/out
#
Docs-deploy:
if: ${{ github.ref == 'refs/heads/main' }}
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: "docs"
needs: Docs-build
steps:
- name: Publish to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
#
Dependabot-merge:
needs: [Bot-pyLint, Bot-ansible-lint, Bot-test, Docs-build]
runs-on: ubuntu-latest
if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'cicsdev/cics-security-sdv-samples'
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Enable auto-merge for Dependabot PRs
if: steps.metadata.outputs.update-type == 'version-update:semver-patch'
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}