Skip to content

Commit 293b1a2

Browse files
committed
Migrate from Travis CI to Github Actions
1 parent 7a3ea3a commit 293b1a2

File tree

5 files changed

+53
-33
lines changed

5 files changed

+53
-33
lines changed

.github/workflows/build.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [ '*' ]
6+
pull_request:
7+
branches: [ '*' ]
8+
9+
workflow_dispatch:
10+
schedule:
11+
- cron: '30 4 * * *'
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
env:
17+
BGPTOOLS_VERSION: 0.0.3
18+
GO111MODULE: on
19+
steps:
20+
- uses: actions/checkout@v3
21+
- uses: actions/setup-go@v2
22+
with:
23+
go-version: 1.16
24+
- run: sudo apt-get install -y bgpdump build-essential git
25+
- uses: actions/cache@v3
26+
with:
27+
key: ${{ runner.os }}-build-dependencies
28+
path: |
29+
~/go/bin
30+
- run: ./dependency.sh
31+
- run: ./generate.sh
32+
- run: ./stat.sh
33+
- run: ./guard.sh
34+
- name: Checkout ip-lists branch
35+
uses: actions/checkout@v3
36+
if: github.event_name == 'schedule' && github.ref == 'refs/heads/master'
37+
with:
38+
ref: ip-lists
39+
path: ip-lists
40+
- run: ./upload.sh
41+
if: github.event_name == 'schedule' && github.ref == 'refs/heads/master'

.travis.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

dependency.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
set -e
44

55
cidr-merger --version || {
6-
curl -sL -o ~/bin/gimme https://raw.githubusercontent.com/travis-ci/gimme/master/gimme
7-
chmod +x ~/bin/gimme
8-
eval "$(gimme stable)"
9-
go get github.com/zhanhb/cidr-merger
6+
go install github.com/zhanhb/[email protected]
107
}
118
asroute 0 < /dev/null || {
129
git clone https://github.com/yangzhaofeng/aspathanalysis.git

guard.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
[[ $(wc -l result/china.txt) < 3000 ]] && exit 1
4+
5+
[[ $(wc -l result/china6.txt) < 1000 ]] && exit 2
6+
7+
exit 0

upload.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
#!/usr/bin/env bash
22

3-
git clone -b ip-lists https://${GH_REF} ip-lists
3+
rm ip-lists/*.txt
44
mv result/* ip-lists
55
cd ip-lists
6-
git config user.name $GIT_USER_NAME
7-
git config user.email $GIT_USER_EMAIL
6+
git config user.name Github Actions
7+
git config user.email [email protected]
88
git add .
99
git commit -m "update $(date +%Y-%m-%d)"
10-
git push -q "https://${GH_TOKEN}@${GH_REF}" ip-lists:ip-lists
11-
git push -q "https://${GH_TOKEN}@${GH_REF}" ip-lists:gh-pages
10+
git push -q
1211

0 commit comments

Comments
 (0)