Merge pull request #403 from mars1024/dev/reserve-after-terminated #836
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: build | |
on: | |
push: | |
branches: | |
- 'main' | |
- 'release-v*' | |
pull_request: | |
branches: | |
- 'main' | |
- 'release-v*' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.after }} | |
cancel-in-progress: true | |
jobs: | |
codecov: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v2.1.3 | |
with: | |
go-version: 1.19.6 | |
- uses: actions/cache@v2 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Test and update codecov | |
run: | | |
make bin/envtest | |
export KUBEBUILDER_ASSETS=$(pwd)/bin/envtest && go test -race -coverprofile=coverage.txt -covermode=atomic ./... | |
- uses: codecov/codecov-action@v1.5.0 | |
with: | |
file: ./coverage.txt | |
flags: unittests | |
fail_ci_if_error: true | |
docker-build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Cache Docker layers | |
uses: actions/cache@v2 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: hybridnetdev/hybridnet | |
tags: | | |
type=ref,event=branch | |
type=ref,event=tag | |
type=ref,event=pr | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
if: ${{ github.event_name != 'pull_request' && github.event.action != 'unassigned' }} | |
- name: Build and push amd64 | |
uses: docker/build-push-action@v2.5.0 | |
with: | |
context: . | |
file: ./Dockerfile.amd64 | |
platforms: linux/amd64 | |
push: false | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |