-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
127 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
name: CI | ||
|
||
concurrency: | ||
group: ci-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
schedule: | ||
- cron: "0 10 * * *" # ~2am PST | ||
workflow_dispatch: | ||
inputs: | ||
debug_enabled: | ||
type: boolean | ||
description: "Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)" | ||
required: false | ||
default: false | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
ORG: githedgehog | ||
|
||
jobs: | ||
dockers: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
# - name: Set up QEMU | ||
# uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Context for Buildx | ||
id: buildx-context | ||
run: | | ||
docker context create builders | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
endpoint: builders | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.ORG }}/toolbox | ||
tags: | | ||
type=ref,event=pr | ||
type=raw,value=latest,enable={{is_default_branch}} | ||
- name: Build and push (on master only) Docker image | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
file: Dockerfile | ||
platforms: linux/amd64 | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
- name: Setup tmate session for debug | ||
if: ${{ failure() && github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} | ||
uses: mxschmitt/action-tmate@v3 | ||
timeout-minutes: 30 | ||
with: | ||
limit-access-to-actor: true | ||
|
||
dockers-results: | ||
name: Docker Build/Publish Results | ||
needs: | ||
- dockers | ||
if: ${{ always() }} | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- run: | | ||
result="${{ needs.dockers.result }}" | ||
if [[ $result == "success" || $result == "skipped" ]]; then | ||
exit 0 | ||
else | ||
exit 1 | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM ubuntu:jammy | ||
|
||
RUN --mount=type=bind,source=packages.sh,target=/tmp/packages.sh /tmp/packages.sh |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
set -eux | ||
set -o pipefail | ||
|
||
APT_PACKAGES=( | ||
curl | ||
dhcping | ||
ethtool | ||
iperf3 | ||
iproute2 | ||
iputils-ping | ||
net-tools | ||
openssh-client | ||
socat | ||
tcpdump | ||
wget | ||
) | ||
|
||
apt-get update -y \ | ||
&& DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --yes \ | ||
"${APT_PACKAGES[@]}" \ | ||
&& apt-get clean autoclean \ | ||
&& apt-get autoremove --yes \ | ||
&& rm -rf /var/lib/apt/lists/* |