forked from saltstack/salt
-
Notifications
You must be signed in to change notification settings - Fork 2
106 lines (83 loc) · 3.44 KB
/
lint-action.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: Lint
on:
workflow_call:
inputs:
changed-files:
required: true
type: string
description: JSON string containing information about changed files
env:
PIP_INDEX_URL: https://pypi-proxy.saltstack.net/root/local/+simple/
PIP_EXTRA_INDEX_URL: https://pypi.org/simple
PIP_DISABLE_PIP_VERSION_CHECK: "1"
jobs:
Salt:
name: Lint Salt's Source Code
runs-on: ubuntu-latest
if: ${{ contains(fromJSON('["push", "schedule", "workflow_dispatch"]'), github.event_name) || fromJSON(inputs.changed-files)['salt'] || fromJSON(inputs.changed-files)['lint'] }}
container:
image: ghcr.io/saltstack/salt-ci-containers/python:3.9
steps:
- name: Install System Deps
run: |
apt-get update
apt-get install -y enchant-2 git gcc make zlib1g-dev libc-dev libffi-dev g++ libxml2 libxml2-dev libxslt-dev libcurl4-openssl-dev libssl-dev libgnutls28-dev
- name: Add Git Safe Directory
run: |
git config --global --add safe.directory "$(pwd)"
- uses: actions/checkout@v4
- name: Install Nox
run: |
python -m pip install --upgrade pip
pip install nox
- name: Install Python Requirements
run:
nox --install-only --forcecolor -e lint-salt
- name: Lint Changed Files
if: github.event_name == 'pull_request' && fromJSON(inputs.changed-files)['salt'] && ! fromJSON(inputs.changed-files)['lint']
env:
SKIP_REQUIREMENTS_INSTALL: YES
run: |
nox --forcecolor -e lint-salt -- ${{ join(fromJSON(inputs.changed-files)['salt_files'], ' ') }}
- name: Lint ALL Files
if: github.event_name != 'pull_request' || fromJSON(inputs.changed-files)['lint']
env:
SKIP_REQUIREMENTS_INSTALL: YES
run: |
nox --forcecolor -e lint-salt
Tests:
name: Lint Salt's Test Suite
runs-on: ubuntu-latest
if: ${{ contains(fromJSON('["push", "schedule", "workflow_dispatch"]'), github.event_name) || fromJSON(inputs.changed-files)['tests'] || fromJSON(inputs.changed-files)['lint'] }}
container:
image: ghcr.io/saltstack/salt-ci-containers/python:3.8
steps:
- name: Install System Deps
run: |
echo "deb http://deb.debian.org/debian bookworm-backports main" >> /etc/apt/sources.list
apt-get update
apt-get install -y enchant-2 git gcc make zlib1g-dev libc-dev libffi-dev g++ libxml2 libxml2-dev libxslt-dev libcurl4-openssl-dev libssl-dev libgnutls28-dev
- name: Add Git Safe Directory
run: |
git config --global --add safe.directory "$(pwd)"
- uses: actions/checkout@v4
- name: Install Nox
run: |
python -m pip install --upgrade pip
pip install nox
- name: Install Python Requirements
run:
nox --install-only --forcecolor -e lint-tests
- name: Lint Changed Files
if: github.event_name == 'pull_request' && fromJSON(inputs.changed-files)['tests'] && ! fromJSON(inputs.changed-files)['lint']
env:
SKIP_REQUIREMENTS_INSTALL: YES
run: |
nox --forcecolor -e lint-tests -- ${{ join(fromJSON(inputs.changed-files)['tests_files'], ' ') }}
- name: Lint ALL Files
if: github.event_name != 'pull_request' || fromJSON(inputs.changed-files)['lint']
env:
SKIP_REQUIREMENTS_INSTALL: YES
run: |
nox --forcecolor -e lint-tests