forked from HostByBelle/ip-db-test-data
-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (87 loc) · 4.31 KB
/
build.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
name: Build Test Data
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: 24 0 * * * # Daily at midnight UTC
env:
TEST_IPV6: false
jobs:
build-data:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
echo "NOW=$(date '+%D')" >> ${GITHUB_ENV}
echo "RELEASE_DATE=$(date '+%D %T')" >> ${GITHUB_ENV}
mkdir data
mkdir test-data
- name: Start the Results File
run: |
echo -e "# Built on: ${{ env.RELEASE_DATE }}" >> results.md
# Cache key is valid for 1 day & is to make repeat tests more efficient
- name: Cache Testing Data
uses: actions/cache@v4
id: cache-test-data
with:
path: ./data
key: testing-data-${{ env.NOW }}-${{ github.ref_name }}
- name: Download Test Data
if: steps.cache-test-data.outputs.cache-hit != 'true'
working-directory: ./data
run: |
curl --show-error --output feed.xml --location "https://www.pingdom.com/rss/probe_servers.xml"
curl --show-error --output hetrix.txt --location "https://hetrixtools.com/resources/uptime-monitor-ips.txt"
curl --show-error --output updown.json --location "https://updown.io/api/nodes"
curl --show-error --output statuscake.json --location "https://app.statuscake.com/Workfloor/Locations.php?format=json"
curl --show-error --output aws-ranges.json --location "https://ip-ranges.amazonaws.com/ip-ranges.json"
curl --show-error --output oracle-ranges.json --location "https://docs.oracle.com/en-us/iaas/tools/public_ip_ranges.json"
curl --show-error --output linode-geofeed.csv --location "https://geoip.linode.com/"
curl --show-error --output digitalocean-geofeed.csv --location "https://digitalocean.com/geo/google.csv"
curl --show-error --output vultr-geofeed.csv --location "https://geofeed.constant.com/"
curl --show-error --output starlink-geofeed.csv --location "https://geoip.starlinkisp.net/feed.csv"
curl --show-error --output google-geofeed.csv --location "https://www.gstatic.com/ipranges/cloud_geofeed"
#curl --show-error --output geolocatemuch-geofeed.csv --location "https://geolocatemuch.com/geofeeds/validated-all.csv"
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "pypy3.10"
- name: Install Python Requirements
working-directory: ./scripts
run: |
pypy -m ensurepip
pip install -r requirements.txt
- name: Parse Data
run: |
python ./scripts/parse-pingdom.py ./data/feed.xml ./test-data/IPv4.json ip
python ./scripts/parse-pingdom.py ./data/feed.xml ./test-data/IPv6.json ipv6
python ./scripts/parse-hetrix.py ./data/hetrix.txt ./test-data/IPv4.json
python ./scripts/parse-updown.py ./data/updown.json ./test-data/IPv4.json ip
python ./scripts/parse-updown.py ./data/updown.json ./test-data/IPv6.json ipv6
python ./scripts/parse-statuscake.py ./data/statuscake.json ./test-data/IPv4.json ip
python ./scripts/parse-statuscake.py ./data/statuscake.json ./test-data/IPv6.json ipv6
python ./scripts/parse-aws.py ./data/aws-ranges.json ./test-data/IPv4.json ip
python ./scripts/parse-aws.py ./data/aws-ranges.json ./test-data/IPv6.json ipv6
python ./scripts/parse-oracle.py ./data/oracle-ranges.json ./test-data/IPv4.json
- name: Parse Data (Geofeeds)
run: |
find ./data -type f -name "*-geofeed.csv" -print | while read -r file; do
python ./scripts/parse-geofeed.py $file ./test-data/IPv4.json ip
python ./scripts/parse-geofeed.py $file ./test-data/IPv6.json ipv6
done
- name: Deduplicate and Process
run: |
echo -e "\n## IPv4 Processing Result\n" >> results.md
python ./scripts/process.py ./test-data/IPv4.json >> results.md
echo -e "\n## IPv6 Processing Result\n" >> results.md
python ./scripts/process.py ./test-data/IPv6.json >> results.md
- name: Upload Test Data
uses: actions/upload-artifact@v4
with:
name: test-data
path: |
./test-data/IPv6.json
./test-data/IPv4.json
./results.md