CI #11073
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: | |
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: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
with: | |
submodules: recursive | |
- name: Install Go | |
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed | |
with: | |
go-version-file: go.mod | |
- name: Enable local IPv6 | |
run: |- | |
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0 | |
sudo ip -6 addr add fd00::1/64 dev eth0 | |
sudo ip addr | |
- name: Run Unit tests | |
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@015f24e6818733317a2da2edd6290ab26238649a | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./coverage.txt | |
flags: unittests | |
build: | |
name: Build | |
timeout-minutes: 20 | |
runs-on: ubuntu-latest | |
needs: [test] | |
steps: | |
- name: Check out code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
with: | |
submodules: recursive | |
- name: Setup Go | |
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed | |
with: | |
go-version-file: go.mod | |
- name: Setup QEMU | |
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db | |
- name: Cache Docker layers | |
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a | |
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@5cd11c3a4ced054e52742c5fd54dca954e0edd85 | |
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@5cd11c3a4ced054e52742c5fd54dca954e0edd85 | |
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: Build Dfdaemon Image | |
uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 | |
with: | |
context: . | |
file: build/images/dfdaemon/Dockerfile | |
push: false | |
tags: dragonflyoss/dfdaemon: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 |