CI workflow (dragonflyoss/dragonfly)
The CI workflow from dragonflyoss/dragonfly, explained and optimized by Latchkey.
CI health: A - excellent
Run this on Latchkey for self-healing, caching, and up to 58% lower cost.
Grade your own workflow free or run it on Latchkey →What it does
This is the CI workflow from the dragonflyoss/dragonfly repository, a real project running GitHub Actions. It is shown here with attribution under its Apache-2.0 license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
name: CI
on:
push:
branches: [main, release-*]
paths-ignore: ['**.md', '**.png', '**.jpg', '**.svg', '**/docs/**']
pull_request:
branches: [main, release-*]
paths-ignore: ['**.md', '**.png', '**.jpg', '**.svg', '**/docs/**']
schedule:
- cron: '0 4 * * *'
permissions:
contents: read
jobs:
test:
name: Test
timeout-minutes: 60
runs-on: oracle-vm-24cpu-96gb-x86-64
steps:
- name: Checkout code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
with:
submodules: recursive
- name: Install Go
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16
with:
go-version-file: go.mod
- name: Enable local IPv6
run: |-
sudo apt update && sudo apt install -y iproute2
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0
sudo ip -6 addr add fd00::1/64 dev $(ip -o link show | awk -F': ' '{print $2}' | grep -v lo | head -1)
sudo ip addr
- name: Run Unit tests
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |-
# switch to installed go
sudo ln -sf `which go` `sudo which go`
go version
sudo go version
sudo make test-coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.txt
flags: unittests
build:
name: Build
timeout-minutes: 20
runs-on: oracle-vm-24cpu-96gb-x86-64
needs: [test]
steps:
- name: Check out code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
with:
submodules: recursive
- name: Setup Go
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16
with:
go-version-file: go.mod
- name: Setup QEMU
uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c
- name: Cache Docker layers
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build Scheduler Image
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf
with:
context: .
file: build/images/scheduler/Dockerfile
push: false
tags: dragonflyoss/scheduler:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
- name: Build Manager Image
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf
with:
context: .
file: build/images/manager/Dockerfile
push: false
tags: dragonflyoss/manager:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: CI on: push: branches: [main, release-*] paths-ignore: ['**.md', '**.png', '**.jpg', '**.svg', '**/docs/**'] pull_request: branches: [main, release-*] paths-ignore: ['**.md', '**.png', '**.jpg', '**.svg', '**/docs/**'] schedule: - cron: '0 4 * * *' permissions: contents: read concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: test: name: Test timeout-minutes: 60 runs-on: oracle-vm-24cpu-96gb-x86-64 steps: - name: Checkout code uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 with: submodules: recursive - name: Install Go uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 with: go-version-file: go.mod - name: Enable local IPv6 run: |- sudo apt update && sudo apt install -y iproute2 sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0 sudo ip -6 addr add fd00::1/64 dev $(ip -o link show | awk -F': ' '{print $2}' | grep -v lo | head -1) sudo ip addr - name: Run Unit tests env: DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} run: |- # switch to installed go sudo ln -sf `which go` `sudo which go` go version sudo go version sudo make test-coverage - name: Upload coverage to Codecov uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f with: token: ${{ secrets.CODECOV_TOKEN }} files: ./coverage.txt flags: unittests build: name: Build timeout-minutes: 20 runs-on: oracle-vm-24cpu-96gb-x86-64 needs: [test] steps: - name: Check out code uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 with: submodules: recursive - name: Setup Go uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 with: go-version-file: go.mod - name: Setup QEMU uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 - name: Setup Docker Buildx uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c - name: Cache Docker layers uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae with: path: /tmp/.buildx-cache key: ${{ runner.os }}-buildx-${{ github.sha }} restore-keys: | ${{ runner.os }}-buildx- - name: Build Scheduler Image uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf with: context: . file: build/images/scheduler/Dockerfile push: false tags: dragonflyoss/scheduler:latest cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache-new - name: Build Manager Image uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf with: context: . file: build/images/manager/Dockerfile push: false tags: dragonflyoss/manager:latest cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache-new - name: Move cache run: | rm -rf /tmp/.buildx-cache mv /tmp/.buildx-cache-new /tmp/.buildx-cache
What changed
- Cancel superseded runs when a branch or PR gets a newer push.
What Latchkey heals here
This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:
- Dependency installs
- Container pulls and builds
This workflow runs 2 jobs per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.