Skip to content

Commit

Permalink
Migrate from Travis CI to Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
yangzhaofeng committed Feb 5, 2023
1 parent 7a3ea3a commit 293b1a2
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 33 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build

on:
push:
branches: [ '*' ]
pull_request:
branches: [ '*' ]

workflow_dispatch:
schedule:
- cron: '30 4 * * *'

jobs:
build:
runs-on: ubuntu-latest
env:
BGPTOOLS_VERSION: 0.0.3
GO111MODULE: on
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v2
with:
go-version: 1.16
- run: sudo apt-get install -y bgpdump build-essential git
- uses: actions/cache@v3
with:
key: ${{ runner.os }}-build-dependencies
path: |
~/go/bin
- run: ./dependency.sh
- run: ./generate.sh
- run: ./stat.sh
- run: ./guard.sh
- name: Checkout ip-lists branch
uses: actions/checkout@v3
if: github.event_name == 'schedule' && github.ref == 'refs/heads/master'
with:
ref: ip-lists
path: ip-lists
- run: ./upload.sh
if: github.event_name == 'schedule' && github.ref == 'refs/heads/master'
24 changes: 0 additions & 24 deletions .travis.yml

This file was deleted.

5 changes: 1 addition & 4 deletions dependency.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
set -e

cidr-merger --version || {
curl -sL -o ~/bin/gimme https://raw.githubusercontent.com/travis-ci/gimme/master/gimme
chmod +x ~/bin/gimme
eval "$(gimme stable)"
go get github.com/zhanhb/cidr-merger
go install github.com/zhanhb/cidr-merger@v1.1.2
}
asroute 0 < /dev/null || {
git clone https://github.com/yangzhaofeng/aspathanalysis.git
Expand Down
7 changes: 7 additions & 0 deletions guard.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

[[ $(wc -l result/china.txt) < 3000 ]] && exit 1

[[ $(wc -l result/china6.txt) < 1000 ]] && exit 2

exit 0
9 changes: 4 additions & 5 deletions upload.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#!/usr/bin/env bash

git clone -b ip-lists https://${GH_REF} ip-lists
rm ip-lists/*.txt
mv result/* ip-lists
cd ip-lists
git config user.name $GIT_USER_NAME
git config user.email $GIT_USER_EMAIL
git config user.name Github Actions
git config user.email github-actions@github.com
git add .
git commit -m "update $(date +%Y-%m-%d)"
git push -q "https://${GH_TOKEN}@${GH_REF}" ip-lists:ip-lists
git push -q "https://${GH_TOKEN}@${GH_REF}" ip-lists:gh-pages
git push -q

0 comments on commit 293b1a2

Please sign in to comment.