name: Run Docker
on:
  push:
    branches:
    - main
  pull_request:
    branches:
    - main
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - name: Harden Runner
      uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
      with:
        egress-policy: block
        allowed-endpoints: >
          archive.ubuntu.com:80
          auth.docker.io:443
          github.com:443
          production.cloudflare.docker.com:443
          production.cloudfront.docker.com:443
          registry-1.docker.io:443
          registry.npmjs.org:443
          security.ubuntu.com:80
    - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
    - name: Build the container
      run: docker build -f test/Dockerfile . -t sitespeedio/throttle
    - name: Test Throttle
      run: docker run --cap-add=NET_ADMIN sitespeedio/throttle