-
Notifications
You must be signed in to change notification settings - Fork 0
159 lines (135 loc) · 4.21 KB
/
lint-test.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
154
155
156
157
158
159
---
# Lint the code base and launch unit test at each push or pull request
name: Lint and test
on: # yamllint disable-line rule:truthy
push:
workflow_dispatch:
jobs:
linters:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install pre-commit
run: pip install pre-commit
- uses: ouzi-dev/commit-status-updater@v2
with:
name: lint
status: pending
- name: Run pre-commit
run: pre-commit run -a --hook-stage manual
- name: Archive results
if: ${{ always() }}
continue-on-error: true
uses: actions/upload-artifact@v3
with:
name: linter-reports
path: |
megalinter-reports/**
- name: Create Pull Request
if: ${{ failure() }}
uses: peter-evans/create-pull-request@v4
with:
branch: update/pre-commit-fixes
title: lint fixes
commit-message: Auto-update lint fixes
body: |
some auto fixes have been generated during pre-commit run
labels: updates
- uses: ouzi-dev/commit-status-updater@v2
if: always()
with:
name: lint
status: ${{ job.status }}
tests:
needs: linters
runs-on: ubuntu-22.04
strategy:
fail-fast: true
matrix:
vendor:
- ubuntu
- alpine
bashTarVersion:
- '4.4'
- '5.0'
- '5.1'
include:
- vendor: ubuntu
bashImage: ubuntu:20.04
options: -j 30
- vendor: alpine
bashImage: bash
options: -j 30
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: ouzi-dev/commit-status-updater@v2
with:
name: build bash-tools-${{matrix.vendor}}-${{matrix.bashTarVersion}}
status: pending
- name: run unit tests
run: |
set -exo pipefail
./bin/installRequirements
chmod -R 777 logs
# shellcheck disable=SC2266
USER_ID=1000 \
GROUP_ID=1000 \
./bin/test \
-vvv \
--vendor "${{matrix.vendor}}" \
--bash-version "${{matrix.bashTarVersion}}" \
--bash-base-image "${{matrix.bashImage}}" \
--branch-name "${BRANCH}" \
${{matrix.options}} --report-formatter junit -o logs -r src --ci
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v3
with:
name: Test Results ${{matrix.vendor}} ${{matrix.bashTarVersion}}
path: logs/report.xml
- uses: ouzi-dev/commit-status-updater@v2
if: always()
with:
name: build bash-tools-${{matrix.vendor}}-${{matrix.bashTarVersion}}
status: ${{ job.status }}
publishTestResults:
name: 'Publish Tests Results'
if: ${{ always() }}
needs: [linters, tests]
runs-on: ubuntu-latest
permissions:
checks: write
# needed by ouzi-dev/commit-status-updater@v2
statuses: write
# only needed unless run with comment_mode: off
pull-requests: write
steps:
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Checkstyle aggregation
uses: lcollins/[email protected]
with:
path: 'artifacts/**/*.xml'
# run this action to get the workflow conclusion
# You can get the conclusion via env (env.WORKFLOW_CONCLUSION)
- uses: technote-space/workflow-conclusion-action@v3
# run other action with the workflow conclusion
- uses: ouzi-dev/commit-status-updater@v2
with:
name: build
# neutral, success, skipped, cancelled, timed_out, action_required, failure
status: ${{ env.WORKFLOW_CONCLUSION }}