Skip to content

Commit 1fa85b8

Browse files
authored
Merge pull request #15 from philwhineray/master
Replace Travis with Github Actions
2 parents d85da09 + 5dd9b33 commit 1fa85b8

8 files changed

+146
-72
lines changed

.github/workflows/publish.yml

+116
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
on: [ push, pull_request, workflow_dispatch ]
2+
3+
jobs:
4+
prep:
5+
runs-on: ubuntu-latest
6+
name: Prepare build
7+
steps:
8+
- name: Extract tag/branch variables
9+
shell: bash
10+
run: |
11+
echo "##[set-output name=tag;]$(echo ${GITHUB_REF#refs/tags/}|grep -v '/')"
12+
echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/}|grep -v '/')"
13+
id: extract
14+
outputs:
15+
tag: ${{ steps.extract.outputs.tag }}
16+
branch: ${{ steps.extract.outputs.branch }}
17+
18+
build:
19+
runs-on: ubuntu-latest
20+
name: Build packages
21+
needs: prep
22+
steps:
23+
- uses: actions/checkout@v2
24+
- name: Set up build tools
25+
run: ./.github/workflows/setup.sh
26+
- name: Run build
27+
run: |
28+
./setup.sh
29+
for i in build-*.sh
30+
do
31+
./$i || exit 1
32+
done
33+
- name: Create checksums
34+
run: |
35+
cd output/packages
36+
for i in *
37+
do
38+
md5sum -b $i > ../checksums/$i.md5
39+
sha512sum -b $i > ../checksums/$i.sha
40+
done
41+
- name: Upload build artifacts
42+
uses: actions/upload-artifact@v2
43+
with:
44+
name: build-artifacts
45+
path: |
46+
output/packages/*
47+
output/checksums/*
48+
49+
validate_build:
50+
runs-on: ubuntu-latest
51+
name: List build content if not tagged
52+
needs: [ prep, build ]
53+
if: ${{ needs.prep.outputs.tag == '' }}
54+
steps:
55+
- name: Download artifacts
56+
uses: actions/download-artifact@v2
57+
with:
58+
name: build-artifacts
59+
- name: List artifacts
60+
run: ls -lR
61+
62+
publish_tag:
63+
runs-on: ubuntu-latest
64+
name: Publish to github if tag
65+
needs: [ prep, build ]
66+
if: ${{ needs.prep.outputs.tag != '' }}
67+
steps:
68+
- name: Download artifacts
69+
uses: actions/download-artifact@v2
70+
with:
71+
name: build-artifacts
72+
- name: Create Release
73+
id: create_release
74+
uses: actions/create-release@v1
75+
env:
76+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77+
with:
78+
tag_name: ${{ github.ref }}
79+
release_name: Release ${{ github.ref }}
80+
draft: false
81+
- name: Upload packages
82+
uses: actions/github-script@v3
83+
with:
84+
github-token: ${{secrets.GITHUB_TOKEN}}
85+
script: |
86+
const path = require('path');
87+
const fs = require('fs');
88+
const release_id = '${{ steps.create_release.outputs.id }}';
89+
for (let file of await fs.readdirSync('./packages/')) {
90+
console.log('uploadReleaseAsset', file);
91+
await github.repos.uploadReleaseAsset({
92+
owner: context.repo.owner,
93+
repo: context.repo.repo,
94+
release_id: release_id,
95+
name: file,
96+
data: await fs.readFileSync(`./packages/${file}`)
97+
});
98+
}
99+
- name: Upload checksums
100+
uses: actions/github-script@v3
101+
with:
102+
github-token: ${{secrets.GITHUB_TOKEN}}
103+
script: |
104+
const path = require('path');
105+
const fs = require('fs');
106+
const release_id = '${{ steps.create_release.outputs.id }}';
107+
for (let file of await fs.readdirSync('./checksums/')) {
108+
console.log('uploadReleaseAsset', file);
109+
await github.repos.uploadReleaseAsset({
110+
owner: context.repo.owner,
111+
repo: context.repo.repo,
112+
release_id: release_id,
113+
name: file,
114+
data: await fs.readFileSync(`./checksums/${file}`)
115+
});
116+
}

.github/workflows/setup.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
3+
set -e
4+
set -x
5+
6+
sudo apt install ccache

.travis.yml

-28
This file was deleted.

README.md

+17-10
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,11 @@ Current status:
88

99
Package | Architecture | Installs | Runs | Works
1010
------------------------- | ---------------- | ---------- | ------ | -------
11-
FireHOL OpenWRT 18.06 ipk | all | ? | ? | ?
12-
FireHOL CentOS/RHEL 6 rpm | all (noarch) | Y | ? | ?
11+
FireHOL OpenWRT 19.07 ipk | all | ? | ? | ?
1312
FireHOL CentOS/RHEL 7 rpm | all (noarch) | Y | ? | ?
14-
iprange OpenWRT 18.06 ipk | ar71xx | ? | ? | ?
15-
iprange OpenWRT 18.06 ipk | brcm47xx | ? | ? | ?
16-
iprange OpenWRT 18.06 ipk | ipq806x | ? | ? | ?
17-
iprange CentOS/RHEL 6 rpm | amd64 | Y | ? | ?
13+
iprange OpenWRT 19.07 ipk | ar71xx | ? | ? | ?
14+
iprange OpenWRT 19.07 ipk | brcm47xx | ? | ? | ?
15+
iprange OpenWRT 19.07 ipk | ipq806x | ? | ? | ?
1816
iprange CentOS/RHEL 7 rpm | amd64 | Y | ? | ?
1917

2018
Basically: I run the builds but don't check them personally. I update this
@@ -23,9 +21,18 @@ table when people report success/failure.
2321
It is all something of a best-effort basis, so pull requests to add new
2422
packaging formats, architectures, or updated versions are always welcome.
2523

24+
# Old packages
25+
26+
I couldn't get the CentOS/RHEL 6 packages build to work with Github
27+
actions. For the last built RPMs, see
28+
[here](https://github.com/firehol/packages/releases/tag/2020-03-19-1724).
29+
30+
Last builds for OpenWRT 18.06 are
31+
[here](https://github.com/firehol/packages/releases/tag/2020-02-18-0552).
32+
2633
# Releases
2734

28-
Everything gets built by Travis-CI; tags are created after a package
35+
Everything gets built by Github Actions; tags are created after a package
2936
update or new output is added which automatically puts all the
3037
binaries into github releases:
3138

@@ -36,7 +43,7 @@ git tag YYYY-MM-DD-hhmm
3643
git push --tags
3744
~~~~
3845

39-
# Building outside Travis
46+
# Building outside Github
4047

4148
Clone the repository and run the common setup script:
4249

@@ -57,8 +64,8 @@ Provided everything works, the outputs all go to `outputs/packages`.
5764
If something goes wrong you most likely need to install a
5865
[dependency](#dependencies) on your build host.
5966

60-
Travis runs each `build-*.sh` script in order and provided everything
61-
builds OK, it builds checksums in `outputs/checksums`.
67+
Github Actions runs each `build-*.sh` script in order and provided
68+
everything builds OK, it builds checksums in `outputs/checksums`.
6269

6370
## Dependencies
6471

build-redhat.sh

+3-13
Original file line numberDiff line numberDiff line change
@@ -19,40 +19,32 @@ fi
1919

2020
FIREHOL_MD5=`cut -f1 -d' ' < build/firehol.md5`
2121
IPRANGE_MD5=`cut -f1 -d' ' < build/iprange.md5`
22-
NETDATA_MD5=`cut -f1 -d' ' < build/netdata.md5`
2322

24-
for v in 6 7
23+
for v in 7
2524
do
2625
mkdir -p build/el${v}
2726
cd build/el${v}
2827

29-
sudo rm -rf firehol/rpmbuild iprange/rpmbuild netdata/rpmbuild
30-
rm -rf firehol iprange netdata
28+
sudo rm -rf firehol/rpmbuild iprange/rpmbuild
29+
rm -rf firehol iprange
3130
cp -rp ../../redhat/*.sh .
3231
cp -rp ../../redhat/firehol .
3332
cp -rp ../../redhat/iprange .
34-
cp -rp ../../redhat/netdata .
3533

3634
mkdir -p firehol/rpmbuild/SOURCES
3735
mkdir -p iprange/rpmbuild/SOURCES
38-
mkdir -p netdata/rpmbuild/SOURCES
3936

4037
cp ../firehol-$FIREHOL_VERSION.tar.bz2 firehol/rpmbuild/SOURCES
4138
cp firehol/*.service firehol/rpmbuild/SOURCES
4239
cp firehol/*.init firehol/rpmbuild/SOURCES
4340
cp ../iprange-$IPRANGE_VERSION.tar.bz2 iprange/rpmbuild/SOURCES
44-
cp ../netdata-$NETDATA_VERSION.tar.bz2 netdata/rpmbuild/SOURCES
4541

4642
sed -i -e "s;<<VER>>;$FIREHOL_VERSION;" -e "s;<<URL>>;$FIREHOL_URL;" -e "s;<<MD5>>;$FIREHOL_MD5;" -e "/Release:/s/%.*/$RPM_FIREHOL_RELEASE%{?dist}/" firehol/firehol.spec
4743
tar xfj ../iprange-$IPRANGE_VERSION.tar.bz2 iprange-$IPRANGE_VERSION/iprange.spec
4844
mv iprange-$IPRANGE_VERSION/iprange.spec iprange/iprange.spec
4945
rmdir iprange-$IPRANGE_VERSION
5046
sed -i -e "s;_sbindir;_bindir;" -e '/^%files/a\
5147
%{_mandir}/man1/iprange.1.gz' -e "/Release:/s/%.*/$RPM_IPRANGE_RELEASE%{?dist}/" -e "/BuildRoot:/d" iprange/iprange.spec
52-
tar xfj ../netdata-$NETDATA_VERSION.tar.bz2 netdata-$NETDATA_VERSION/netdata.spec
53-
mv netdata-$NETDATA_VERSION/netdata.spec netdata/netdata.spec
54-
rmdir netdata-$NETDATA_VERSION
55-
sed -i -e "/^Recommends/d" -e "s/\.xz/\.bz2/" netdata/netdata.spec
5648

5749
if ! sudo docker inspect firehol-package-centos${v} > /dev/null 2>&1
5850
then
@@ -80,8 +72,6 @@ do
8072
/bin/bash /fh-build/centos${v}/iprange/docker-build.sh
8173
sudo docker run -v `pwd`:/fh-build/centos${v}:rw firehol-package-centos${v} \
8274
/bin/bash -c "yum install -y /fh-build/centos${v}/iprange/rpmbuild/RPMS/x86_64/iprange-$IPRANGE_VERSION-$RPM_IPRANGE_RELEASE.el${v}.x86_64.rpm && /bin/bash /fh-build/centos${v}/firehol/docker-build.sh"
83-
sudo docker run -v `pwd`:/fh-build/centos${v}:rw firehol-package-centos${v} \
84-
/bin/bash /fh-build/centos${v}/netdata/docker-build.sh
8575
cd ../..
8676
done
8777

build-x86_64-static.sh

+1-7
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,12 @@ cd build/x86_64-static
1717

1818
cp -rp ../../x86_64-static/*.sh .
1919

20-
sudo rm -rf iprange netdata
20+
sudo rm -rf iprange
2121

2222
tar xfj ../iprange-$IPRANGE_VERSION.tar.bz2
2323
mv iprange-$IPRANGE_VERSION iprange
2424
cp -rp ../../x86_64-static/iprange/*.sh iprange
2525

26-
tar xfj ../netdata-$NETDATA_VERSION.tar.bz2
27-
mv netdata-$NETDATA_VERSION netdata
28-
cp -rp ../../x86_64-static/netdata/*.sh netdata
29-
3026
if ! sudo docker inspect firehol-package-x86_64-static > /dev/null 2>&1
3127
then
3228
# To run interactively:
@@ -42,8 +38,6 @@ then
4238
fi
4339
sudo docker run -v `pwd`:/fh-build/x86_64-static:rw firehol-package-x86_64-static \
4440
/bin/sh /fh-build/x86_64-static/iprange/docker-build.sh
45-
sudo docker run -v `pwd`:/fh-build/x86_64-static:rw firehol-package-x86_64-static \
46-
/bin/sh /fh-build/x86_64-static/netdata/docker-build.sh
4741
cd ../..
4842

4943
if [ "$USER" ]

package.conf

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
# This file is sourced by other scripts and details the versions we build
22

3-
FIREHOL_VERSION=3.1.6
3+
FIREHOL_VERSION=3.1.7
4+
RPM_FIREHOL_RELEASE="1"
45
FIREHOL_URL=https://github.com/firehol/firehol/releases/download/v$FIREHOL_VERSION
56

67
IPRANGE_VERSION=1.0.4
7-
IPRANGE_URL=https://github.com/firehol/iprange/releases/download/v$IPRANGE_VERSION
8-
9-
NETDATA_VERSION=1.10.0
10-
NETDATA_URL=https://github.com/firehol/netdata/releases/download/v$NETDATA_VERSION
11-
128
RPM_IPRANGE_RELEASE="2"
13-
RPM_FIREHOL_RELEASE="2"
9+
IPRANGE_URL=https://github.com/firehol/iprange/releases/download/v$IPRANGE_VERSION

setup.sh

-7
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,8 @@ then
1919
wget -O "iprange.md5" $IPRANGE_URL/iprange-$IPRANGE_VERSION.tar.bz2.md5
2020
fi
2121

22-
if [ ! -f netdata.md5 ]
23-
then
24-
wget $NETDATA_URL/netdata-$NETDATA_VERSION.tar.bz2
25-
wget -O "netdata.md5" $NETDATA_URL/netdata-$NETDATA_VERSION.tar.bz2.md5
26-
fi
27-
2822
md5sum -c firehol.md5
2923
md5sum -c iprange.md5
30-
md5sum -c netdata.md5
3124

3225
cd ..
3326
rm -rf output

0 commit comments

Comments
 (0)