Skip to content

Commit fd05c71

Browse files
committed
chore: setup the basic ci/compile/build
Signed-off-by: Paul Bastide <[email protected]>
1 parent 6679ee4 commit fd05c71

File tree

3 files changed

+144
-3
lines changed

3 files changed

+144
-3
lines changed

.github/dependabot.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
---
12
version: 2
23
updates:
3-
- package-ecosystem: "gomod"
4-
directory: "/" # Location of package manifests
4+
- package-ecosystem: gomod
5+
directory: /
56
schedule:
6-
interval: "weekly"
7+
interval: weekly
8+
labels:
9+
- dependencies
10+
- skip-changelog

.github/workflows/publish.yaml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Create Container
2+
3+
# This workflow uses actions that are not certified by GitHub.
4+
# They are provided by a third-party and are governed by
5+
# separate terms of service, privacy policy, and support
6+
# documentation.
7+
8+
on:
9+
push:
10+
branches: [ "main" ]
11+
# Publish semver tags as releases.
12+
tags: [ 'v*.*.*' ]
13+
paths-ignore:
14+
- 'manifests/**'
15+
- 'README.md'
16+
17+
env:
18+
REGISTRY: quay.io
19+
IMAGE_NAME: powercloud/power-dra-driver
20+
21+
jobs:
22+
build:
23+
runs-on: ubuntu-latest
24+
permissions:
25+
contents: read
26+
packages: write
27+
id-token: write
28+
29+
steps:
30+
- name: Checkout repository
31+
uses: actions/checkout@v4
32+
33+
- name: Setup Go 1.23.x
34+
uses: actions/setup-go@v5
35+
with:
36+
go-version: '1.23.x'
37+
# Eventually we should build inline...
38+
39+
- name: Build the binaries
40+
run: |
41+
GOOS=linux GOARCH=ppc64le go build -o bin/power-dev-plugin-ppc64le cmd/power-dev-plugin/main.go
42+
43+
# Install the cosign tool except on PR
44+
# https://github.com/sigstore/cosign-installer
45+
- name: Install cosign
46+
if: github.event_name != 'pull_request'
47+
uses: sigstore/[email protected]
48+
with:
49+
cosign-release: 'v2.4.1'
50+
51+
# Workaround: https://github.com/docker/build-push-action/issues/461
52+
- name: Setup Docker buildx
53+
uses: docker/setup-buildx-action@v3
54+
55+
# Login against a Docker registry except on PR
56+
# https://github.com/docker/login-action
57+
- name: Log into registry ${{ env.REGISTRY }}
58+
if: github.event_name != 'pull_request'
59+
uses: docker/login-action@v3
60+
with:
61+
registry: quay.io
62+
username: ${{ secrets.QUAY_USER }}
63+
password: ${{ secrets.QUAY_TOKEN }}
64+
65+
# Extract metadata (tags, labels) for Docker
66+
# https://github.com/docker/metadata-action
67+
- name: Extract Docker metadata
68+
id: meta
69+
uses: docker/metadata-action@v5
70+
with:
71+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
72+
73+
# Build and push Docker image with Buildx (don't push on PR)
74+
# https://github.com/docker/build-push-action
75+
- name: Build and push Docker image
76+
id: build-and-push
77+
uses: docker/build-push-action@v5
78+
with:
79+
context: .
80+
platforms: linux/ppc64le
81+
file: build/Containerfile-build
82+
push: ${{ github.event_name != 'pull_request' }}
83+
tags: ${{ steps.meta.outputs.tags }}
84+
labels: ${{ steps.meta.outputs.labels }}

Makefile

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# This project applies to ppc64le only
2+
ARCH ?= ppc64le
3+
4+
REGISTRY ?= quay.io/powercloud
5+
REPOSITORY ?= power-dra-driver
6+
TAG ?= main
7+
8+
CONTAINER_RUNTIME ?= $(shell command -v podman 2> /dev/null || echo docker)
9+
10+
########################################################################
11+
# Go Targets
12+
13+
.PHONY: build
14+
build: fmt vet
15+
GOOS=linux GOARCH=$(ARCH) go build -o bin/power-dra-driver cmd/power-dra-driver/main.go
16+
17+
.PHONY: fmt
18+
fmt:
19+
go fmt ./...
20+
21+
.PHONY: vet
22+
vet:
23+
go vet ./...
24+
25+
.PHONY: clean
26+
clean:
27+
rm -f ./bin/power-dra-driver
28+
rm -rf vendor
29+
30+
########################################################################
31+
# Container Targets
32+
33+
.PHONY: image
34+
image: build
35+
$(CONTAINER_RUNTIME) buildx build \
36+
-t $(REGISTRY)/$(REPOSITORY):$(TAG) \
37+
--platform linux/$(ARCH) -f build/Containerfile-build .
38+
39+
.PHONY: push
40+
push:
41+
$(info push Container image...)
42+
$(CONTAINER_RUNTIME) push $(REGISTRY)/$(REPOSITORY):$(TAG)
43+
44+
########################################################################
45+
# Deployment Targets
46+
47+
.PHONY: dep-plugin
48+
dep-plugin:
49+
kustomize build manifests | oc apply -f -
50+
51+
.PHONY: dep-examples
52+
dep-examples:
53+
kustomize build examples | oc apply -f -

0 commit comments

Comments
 (0)