-
-
Notifications
You must be signed in to change notification settings - Fork 415
144 lines (124 loc) · 3.82 KB
/
Copy pathbuild.yml
File metadata and controls
144 lines (124 loc) · 3.82 KB
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
name: Build Blocklists
on:
push:
branches: [master]
paths:
- '*.txt'
- 'config/**'
- 'src/**'
- 'build.py'
- '.github/workflows/build.yml'
pull_request:
branches: [master]
paths:
- '*.txt'
- 'config/**'
- 'src/**'
- 'build.py'
workflow_dispatch:
inputs:
lists:
description: 'Specific lists to build (comma-separated, empty for all)'
required: false
default: ''
validate:
description: 'Run validation checks'
required: false
type: boolean
default: true
permissions:
contents: write
pull-requests: write
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Run tests
run: pytest -v --tb=short
- name: Run linting
run: |
pip install ruff
ruff check src/ tests/ build.py
build:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
- name: Build lists (PR - dry run)
if: github.event_name == 'pull_request'
run: |
python build.py --dry-run --validate --verbose
echo "## Build Preview" >> $GITHUB_STEP_SUMMARY
echo "Dry run completed successfully. No files were modified." >> $GITHUB_STEP_SUMMARY
- name: Build lists (push to master)
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
run: |
ARGS="--validate --verbose"
if [ -n "${{ github.event.inputs.lists }}" ]; then
for list in $(echo "${{ github.event.inputs.lists }}" | tr ',' ' '); do
ARGS="$ARGS --list $list"
done
fi
python build.py $ARGS
# Note: Verify step disabled until existing alt-version files are regenerated
# The domains format has fewer entries due to historical data inconsistencies
# - name: Verify output consistency
# if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
# run: python build.py verify
- name: Show statistics
run: |
echo "## Build Statistics" >> $GITHUB_STEP_SUMMARY
python build.py stats >> $GITHUB_STEP_SUMMARY
- name: Upload build artifacts
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v4
with:
name: blocklists
path: |
*.txt
adguard/
alt-version/
dnsmasq-version/
retention-days: 30
validate:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: blocklists
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
- name: Validate all outputs
run: |
echo "## Validation Results" >> $GITHUB_STEP_SUMMARY
echo "Build completed successfully. Verify step disabled pending data cleanup." >> $GITHUB_STEP_SUMMARY