Cleanup local dev setup + docs #1008
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 image from pull request | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Ensure Go Version | |
uses: actions/setup-go@v3 | |
with: | |
go-version-file: 'go.mod' | |
- name: Lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
args: -p bugs -p unused --timeout=5m | |
- name: Get Kubebuilder Version | |
id: get-kubebuilder-version | |
run: echo "version=$(make kubebuilder-version-ci)" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Ensure etcd | |
id: Ensure-etcd | |
uses: actions/cache@v2 | |
with: | |
path: ~/go/bin/etcd | |
key: ${{ runner.os }}-kubebuilder-${{ steps.get-kubebuilder-version.outputs.version }}-etcd | |
- name: Ensure kube-apiserver | |
id: ensure-kube-apiserver | |
uses: actions/cache@v2 | |
with: | |
path: ~/go/bin/kube-apiserver | |
key: ${{ runner.os }}-kubebuilder-${{ steps.get-kubebuilder-version.outputs.version }}-kube-apiserver | |
- name: Ensure Kubebuilder Metadata | |
id: ensure-kubebuilder-metadata | |
uses: actions/cache@v2 | |
with: | |
path: ~/.kubebuilder/${{ steps.get-kubebuilder-version.outputs.version }} | |
key: ${{ runner.os }}-kubebuilder-${{ steps.get-kubebuilder-version.outputs.version }} | |
- name: Install Kubebuilder | |
run: make kubebuilder | |
- name: Run tests | |
run: make test | |
- name: Figure out if running fork PR | |
id: fork | |
run: '["${{ secrets.DOCKER_REGISTRY_TOKEN }}" != ""] && echo "is_fork_pr=false" >> $GITHUB_OUTPUT"' | |
- name: Docker Login | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ secrets.DOCKER_REGISTRY }} | |
username: ${{ secrets.DOCKER_REGISTRY_USER }} | |
password: ${{ secrets.DOCKER_REGISTRY_TOKEN }} | |
if: steps.fork.outputs.is_fork_pr == 'false' | |
- name: Build Docker image | |
run: | | |
export DOCKER_TAG=pr-$(echo ${GITHUB_HEAD_REF} | tr '/' '-') | |
make docker-build | |
- name: Push Docker image | |
run: | | |
# pull request images are prefixed with 'pr' to prevent them from overriding released images | |
export DOCKER_TAG=pr-$(echo ${GITHUB_HEAD_REF} | tr '/' '-') | |
make docker-push | |
if: steps.fork.outputs.is_fork_pr == 'false' |