mirror of
https://github.com/NLnetLabs/krill.git
synced 2026-09-18 15:37:42 +02:00
121 lines
3.6 KiB
YAML
121 lines
3.6 KiB
YAML
# GitHub Actions workflow for building and testing Krill O/S packages.
|
|
# Uses GitHub Actions caching to avoid rebuilding Rust cargo-deb and
|
|
# Krill dependencies on every run.
|
|
#
|
|
# Note: at the time of writing the GH cache contents expire after a
|
|
# week if not used so the next build may be much slower as it will
|
|
# have to re-download/build/install lots of Rust crates.
|
|
|
|
name: Packaging
|
|
on:
|
|
push:
|
|
paths-ignore:
|
|
- '.dockerignore'
|
|
- '.github/workflow/pkg.yml'
|
|
- 'Changelog.md'
|
|
- 'Dockerfile'
|
|
- 'doc/**'
|
|
- 'docker/**'
|
|
- 'LICENSE'
|
|
- 'README.md'
|
|
- 'tests/e2e/**'
|
|
# Hmm, annoying, do we really have to duplicate this?
|
|
pull_request:
|
|
paths-ignore:
|
|
- '.dockerignore'
|
|
- '.github/workflow/pkg.yml'
|
|
- 'Changelog.md'
|
|
- 'Dockerfile'
|
|
- 'doc/**'
|
|
- 'docker/**'
|
|
- 'LICENSE'
|
|
- 'README.md'
|
|
- 'tests/e2e/**'
|
|
|
|
jobs:
|
|
# Use the cargo-deb Rust create to build a Debian package for installing
|
|
# Krill. See: https://github.com/mmstick/cargo-deb
|
|
deb-pkg:
|
|
env:
|
|
CARGO_DEB_VER: 1.23.1
|
|
name: deb-pkg
|
|
runs-on: [ubuntu-16.04]
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v1
|
|
|
|
- name: Install Rust
|
|
uses: hecrj/setup-rust-action@v1
|
|
with:
|
|
rust-version: stable
|
|
|
|
# Speed up Krill Rust builds by caching unchanged built dependencies.
|
|
# See: https://github.com/actions/cache/blob/master/examples.md#rust---cargo
|
|
- name: Cache Dot Cargo
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
# Speed up cargo-deb installation by only re-downloading it and
|
|
# re-building its dependent crates if we change the version of
|
|
# cargo-deb that we are using.
|
|
- name: Cache Cargo Deb binary
|
|
id: cache-cargo-deb
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: ~/.cargo/bin/cargo-deb
|
|
key: ${{ runner.os }}-${{ env.CARGO_DEB_VER }}-cargo-deb
|
|
|
|
- name: Install Cargo Deb
|
|
if: steps.cache-cargo-deb.outputs.cache-hit != 'true'
|
|
run: |
|
|
cargo install cargo-deb --version=$CARGO_DEB_VER
|
|
|
|
- name: Create the package
|
|
run: |
|
|
cargo deb --verbose
|
|
|
|
# Upload the produced DEB package. The artifact will be available
|
|
# via the GH Actions job summary and build log pages, but only to
|
|
# users logged in to GH with sufficient rights in this project. The
|
|
# uploaded artifact is also downloaded by the next job (see below)
|
|
# to sanity check that it can be installed and results in a working
|
|
# Krill installation.
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: debian-package
|
|
path: target/debian/*.deb
|
|
|
|
# Download and sanity check on target operating systems the packages
|
|
# created by previous jobs (see above).
|
|
# TODO: test on actual VMs or Docker containers, not on GH runner
|
|
# images as GH runners come with lots of software and libraries
|
|
# pre-installed and are not representative of the actual deployment
|
|
# targets nor do GH runners support all targets that we want to test.
|
|
deb-pkg-test:
|
|
name: test
|
|
needs: deb-pkg
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-16.04, ubuntu-18.04, ubuntu-20.04]
|
|
steps:
|
|
- name: Download DEB package
|
|
uses: actions/download-artifact@v2
|
|
|
|
- name: Install DEB package
|
|
run: |
|
|
sudo apt-get -y install ./debian-package/*.deb
|
|
shell: bash
|
|
|
|
- name: Test installed binaries
|
|
run: |
|
|
krillc --version
|
|
krill --version
|
|
shell: bash
|