Skip to content

Commit

Permalink
Replace Travis with Github Actions
Browse files Browse the repository at this point in the history
Drop centos 6
Drop netdata builds: they have separate infrastructure now
  • Loading branch information
philwhineray committed Jan 1, 2021
1 parent d85da09 commit 5dd9b33
Show file tree
Hide file tree
Showing 8 changed files with 146 additions and 72 deletions.
116 changes: 116 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
on: [ push, pull_request, workflow_dispatch ]

jobs:
prep:
runs-on: ubuntu-latest
name: Prepare build
steps:
- name: Extract tag/branch variables
shell: bash
run: |
echo "##[set-output name=tag;]$(echo ${GITHUB_REF#refs/tags/}|grep -v '/')"
echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/}|grep -v '/')"
id: extract
outputs:
tag: ${{ steps.extract.outputs.tag }}
branch: ${{ steps.extract.outputs.branch }}

build:
runs-on: ubuntu-latest
name: Build packages
needs: prep
steps:
- uses: actions/checkout@v2
- name: Set up build tools
run: ./.github/workflows/setup.sh
- name: Run build
run: |
./setup.sh
for i in build-*.sh
do
./$i || exit 1
done
- name: Create checksums
run: |
cd output/packages
for i in *
do
md5sum -b $i > ../checksums/$i.md5
sha512sum -b $i > ../checksums/$i.sha
done
- name: Upload build artifacts
uses: actions/upload-artifact@v2
with:
name: build-artifacts
path: |
output/packages/*
output/checksums/*
validate_build:
runs-on: ubuntu-latest
name: List build content if not tagged
needs: [ prep, build ]
if: ${{ needs.prep.outputs.tag == '' }}
steps:
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: build-artifacts
- name: List artifacts
run: ls -lR

publish_tag:
runs-on: ubuntu-latest
name: Publish to github if tag
needs: [ prep, build ]
if: ${{ needs.prep.outputs.tag != '' }}
steps:
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: build-artifacts
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
- name: Upload packages
uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const path = require('path');
const fs = require('fs');
const release_id = '${{ steps.create_release.outputs.id }}';
for (let file of await fs.readdirSync('./packages/')) {
console.log('uploadReleaseAsset', file);
await github.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release_id,
name: file,
data: await fs.readFileSync(`./packages/${file}`)
});
}
- name: Upload checksums
uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const path = require('path');
const fs = require('fs');
const release_id = '${{ steps.create_release.outputs.id }}';
for (let file of await fs.readdirSync('./checksums/')) {
console.log('uploadReleaseAsset', file);
await github.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release_id,
name: file,
data: await fs.readFileSync(`./checksums/${file}`)
});
}
6 changes: 6 additions & 0 deletions .github/workflows/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

set -e
set -x

sudo apt install ccache
28 changes: 0 additions & 28 deletions .travis.yml

This file was deleted.

27 changes: 17 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ Current status:

Package | Architecture | Installs | Runs | Works
------------------------- | ---------------- | ---------- | ------ | -------
FireHOL OpenWRT 18.06 ipk | all | ? | ? | ?
FireHOL CentOS/RHEL 6 rpm | all (noarch) | Y | ? | ?
FireHOL OpenWRT 19.07 ipk | all | ? | ? | ?
FireHOL CentOS/RHEL 7 rpm | all (noarch) | Y | ? | ?
iprange OpenWRT 18.06 ipk | ar71xx | ? | ? | ?
iprange OpenWRT 18.06 ipk | brcm47xx | ? | ? | ?
iprange OpenWRT 18.06 ipk | ipq806x | ? | ? | ?
iprange CentOS/RHEL 6 rpm | amd64 | Y | ? | ?
iprange OpenWRT 19.07 ipk | ar71xx | ? | ? | ?
iprange OpenWRT 19.07 ipk | brcm47xx | ? | ? | ?
iprange OpenWRT 19.07 ipk | ipq806x | ? | ? | ?
iprange CentOS/RHEL 7 rpm | amd64 | Y | ? | ?

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

# Old packages

I couldn't get the CentOS/RHEL 6 packages build to work with Github
actions. For the last built RPMs, see
[here](https://github.com/firehol/packages/releases/tag/2020-03-19-1724).

Last builds for OpenWRT 18.06 are
[here](https://github.com/firehol/packages/releases/tag/2020-02-18-0552).

# Releases

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

Expand All @@ -36,7 +43,7 @@ git tag YYYY-MM-DD-hhmm
git push --tags
~~~~

# Building outside Travis
# Building outside Github

Clone the repository and run the common setup script:

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

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

## Dependencies

Expand Down
16 changes: 3 additions & 13 deletions build-redhat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,40 +19,32 @@ fi

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

for v in 6 7
for v in 7
do
mkdir -p build/el${v}
cd build/el${v}

sudo rm -rf firehol/rpmbuild iprange/rpmbuild netdata/rpmbuild
rm -rf firehol iprange netdata
sudo rm -rf firehol/rpmbuild iprange/rpmbuild
rm -rf firehol iprange
cp -rp ../../redhat/*.sh .
cp -rp ../../redhat/firehol .
cp -rp ../../redhat/iprange .
cp -rp ../../redhat/netdata .

mkdir -p firehol/rpmbuild/SOURCES
mkdir -p iprange/rpmbuild/SOURCES
mkdir -p netdata/rpmbuild/SOURCES

cp ../firehol-$FIREHOL_VERSION.tar.bz2 firehol/rpmbuild/SOURCES
cp firehol/*.service firehol/rpmbuild/SOURCES
cp firehol/*.init firehol/rpmbuild/SOURCES
cp ../iprange-$IPRANGE_VERSION.tar.bz2 iprange/rpmbuild/SOURCES
cp ../netdata-$NETDATA_VERSION.tar.bz2 netdata/rpmbuild/SOURCES

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
tar xfj ../iprange-$IPRANGE_VERSION.tar.bz2 iprange-$IPRANGE_VERSION/iprange.spec
mv iprange-$IPRANGE_VERSION/iprange.spec iprange/iprange.spec
rmdir iprange-$IPRANGE_VERSION
sed -i -e "s;_sbindir;_bindir;" -e '/^%files/a\
%{_mandir}/man1/iprange.1.gz' -e "/Release:/s/%.*/$RPM_IPRANGE_RELEASE%{?dist}/" -e "/BuildRoot:/d" iprange/iprange.spec
tar xfj ../netdata-$NETDATA_VERSION.tar.bz2 netdata-$NETDATA_VERSION/netdata.spec
mv netdata-$NETDATA_VERSION/netdata.spec netdata/netdata.spec
rmdir netdata-$NETDATA_VERSION
sed -i -e "/^Recommends/d" -e "s/\.xz/\.bz2/" netdata/netdata.spec

if ! sudo docker inspect firehol-package-centos${v} > /dev/null 2>&1
then
Expand Down Expand Up @@ -80,8 +72,6 @@ do
/bin/bash /fh-build/centos${v}/iprange/docker-build.sh
sudo docker run -v `pwd`:/fh-build/centos${v}:rw firehol-package-centos${v} \
/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"
sudo docker run -v `pwd`:/fh-build/centos${v}:rw firehol-package-centos${v} \
/bin/bash /fh-build/centos${v}/netdata/docker-build.sh
cd ../..
done

Expand Down
8 changes: 1 addition & 7 deletions build-x86_64-static.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,12 @@ cd build/x86_64-static

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

sudo rm -rf iprange netdata
sudo rm -rf iprange

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

tar xfj ../netdata-$NETDATA_VERSION.tar.bz2
mv netdata-$NETDATA_VERSION netdata
cp -rp ../../x86_64-static/netdata/*.sh netdata

if ! sudo docker inspect firehol-package-x86_64-static > /dev/null 2>&1
then
# To run interactively:
Expand All @@ -42,8 +38,6 @@ then
fi
sudo docker run -v `pwd`:/fh-build/x86_64-static:rw firehol-package-x86_64-static \
/bin/sh /fh-build/x86_64-static/iprange/docker-build.sh
sudo docker run -v `pwd`:/fh-build/x86_64-static:rw firehol-package-x86_64-static \
/bin/sh /fh-build/x86_64-static/netdata/docker-build.sh
cd ../..

if [ "$USER" ]
Expand Down
10 changes: 3 additions & 7 deletions package.conf
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
# This file is sourced by other scripts and details the versions we build

FIREHOL_VERSION=3.1.6
FIREHOL_VERSION=3.1.7
RPM_FIREHOL_RELEASE="1"
FIREHOL_URL=https://github.com/firehol/firehol/releases/download/v$FIREHOL_VERSION

IPRANGE_VERSION=1.0.4
IPRANGE_URL=https://github.com/firehol/iprange/releases/download/v$IPRANGE_VERSION

NETDATA_VERSION=1.10.0
NETDATA_URL=https://github.com/firehol/netdata/releases/download/v$NETDATA_VERSION

RPM_IPRANGE_RELEASE="2"
RPM_FIREHOL_RELEASE="2"
IPRANGE_URL=https://github.com/firehol/iprange/releases/download/v$IPRANGE_VERSION
7 changes: 0 additions & 7 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,8 @@ then
wget -O "iprange.md5" $IPRANGE_URL/iprange-$IPRANGE_VERSION.tar.bz2.md5
fi

if [ ! -f netdata.md5 ]
then
wget $NETDATA_URL/netdata-$NETDATA_VERSION.tar.bz2
wget -O "netdata.md5" $NETDATA_URL/netdata-$NETDATA_VERSION.tar.bz2.md5
fi

md5sum -c firehol.md5
md5sum -c iprange.md5
md5sum -c netdata.md5

cd ..
rm -rf output
Expand Down

0 comments on commit 5dd9b33

Please sign in to comment.