Skip to content

bring back the code from tinkerbell/dhcp #1660

bring back the code from tinkerbell/dhcp

bring back the code from tinkerbell/dhcp #1660

Workflow file for this run

name: For each commit and PR
on:
push:
branches:
- "*"
tags-ignore:
- "v*"
pull_request:
jobs:
validation:
runs-on: ubuntu-latest
env:
CGO_ENABLED: 0
steps:
- name: Setup Dynamic Env
run: |
echo "MAKEFLAGS=-j$(nproc)" | tee $GITHUB_ENV
- name: Checkout code
uses: actions/checkout@v4
- name: Install nix
uses: cachix/install-nix-action@v24
with:
nix_path: nixpkgs=channel:nixpkgs-unstable
- name: Fetch Deps
run: |
# fixes "write /run/user/1001/355792648: no space left on device" error
sudo mount -o remount,size=3G /run/user/1001 || true
nix-shell --run 'go get -t ./... && go mod tidy'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Generate all files
run: nix-shell --run 'make -j1 gen'
- name: Run all the tests
run: nix-shell --run 'make ci'
- name: upload codecov
run: bash <(curl -s https://codecov.io/bash)
- name: compile binaries
run: nix-shell --run 'make crosscompile'
- name: Figure out Docker Tags
id: docker-image-tag
run: |
echo ::set-output name=tags::quay.io/tinkerbell/smee:latest,quay.io/tinkerbell/smee:sha-${GITHUB_SHA::8}
- name: Login to quay.io
uses: docker/login-action@v3
if: ${{ startsWith(github.ref, 'refs/heads/main') }}
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Build Docker Images
uses: docker/build-push-action@v5
with:
context: ./
file: ./Dockerfile
cache-from: type=registry,ref=quay.io/tinkerbell/smee:latest
platforms: linux/amd64,linux/arm64
tags: ${{ steps.docker-image-tag.outputs.tags }}
# looks just like Build Docker Images except with push:true and this will only run for builds for main
- name: Push Docker Images
uses: docker/build-push-action@v5
if: ${{ startsWith(github.ref, 'refs/heads/main') }}
with:
context: ./
file: ./Dockerfile
cache-from: type=registry,ref=quay.io/tinkerbell/smee:latest
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.docker-image-tag.outputs.tags }}