CI #92
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: CI | |
on: | |
pull_request: | |
push: | |
schedule: | |
# Monday 06:30 UTC | |
- cron: "30 6 * * 1" | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build Bird configuration | |
runs-on: ubuntu-latest | |
env: | |
BUILDDIR: '/opt/routefilters' | |
STAGEDIR: '/opt/router-staging' | |
steps: | |
- name: Check out the code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install package dependencies | |
run: | | |
sudo apt update | |
sudo apt -y install bgpq3 bird2 | |
- name: Install Python dependencies | |
run: | | |
pip3 install -r requirements.txt | |
- name: Test peers.yaml (YAML syntax) | |
run: | | |
yamllint -d "{ extends: default, rules: { line-length: { max: 120 } } }" tests/peers.yaml | |
- name: Prepare build and staging directories | |
run: | | |
mkdir -p ${BUILDDIR} | |
mkdir -p ${STAGEDIR} | |
- name: Use example blobs/vars for building | |
run: | | |
ln -s blobs_example blobs | |
ln -s vars_example vars | |
- name: Create dummy RPKI ROA tables | |
run: | | |
sudo mkdir -m 750 -p /var/lib/rpki-client | |
sudo chown -R `whoami` /var/lib/rpki-client | |
cat <<EOF >/var/lib/rpki-client/bird | |
define force_roa_table_update = 1683397799; | |
roa4 table ROAS4; | |
roa6 table ROAS6; | |
protocol static { | |
roa4 { table ROAS4; }; | |
} | |
protocol static { | |
roa6 { table ROAS6; }; | |
} | |
EOF | |
- name: Build configuration | |
run: | | |
./generate-peer-config.sh | |
./update-routers.sh check | |
env: | |
PEERINGDB_API_KEY: ${{ secrets.PEERINGDB_API_KEY }} | |
PEERINGS_FILE: ${{ github.workspace }}/tests/peers.yaml | |
- name: Compress generated artifacts | |
run: >- | |
tar -cpf /tmp/kees-config_as-built-`date -u '+%Y%m%d-%H%M%S%z'`.tar | |
${{ env.BUILDDIR }}/ | |
${{ env.STAGEDIR }}/ | |
- name: Store generated configuration as artifact | |
if: always() # Also store for failed builds | |
uses: actions/upload-artifact@v3 | |
with: | |
name: kees-config_as-built | |
path: /tmp/kees-config_as-built-*.tar |