mirror of
https://github.com/kairos-io/immucore.git
synced 2025-08-02 06:52:03 +00:00
Improvements on earthly targets and CI (#165)
This commit is contained in:
parent
399a7185e9
commit
8773c5b6ad
20
.github/workflows/unit-tests.yaml
vendored
20
.github/workflows/unit-tests.yaml
vendored
@ -17,9 +17,9 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
- uses: earthly/actions-setup@v1
|
||||||
- name: Run Lint checks
|
- name: Run Lint checks
|
||||||
run: |
|
run: earthly +lint
|
||||||
./earthly.sh +lint
|
|
||||||
unit-tests:
|
unit-tests:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@ -27,13 +27,23 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
- uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cache/go-build
|
||||||
|
~/go/pkg/mod
|
||||||
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-go-
|
||||||
- name: Install Go
|
- name: Install Go
|
||||||
uses: actions/setup-go@v4
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: '^1.20'
|
go-version-file: 'go.mod'
|
||||||
|
- uses: earthly/actions-setup@v1
|
||||||
|
- name: Build
|
||||||
|
run: earthly +build
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: |
|
run: earthly +test
|
||||||
./earthly.sh +test
|
|
||||||
- name: Codecov
|
- name: Codecov
|
||||||
uses: codecov/codecov-action@v3
|
uses: codecov/codecov-action@v3
|
||||||
with:
|
with:
|
||||||
|
@ -17,4 +17,7 @@ linters:
|
|||||||
- staticcheck
|
- staticcheck
|
||||||
- typecheck
|
- typecheck
|
||||||
- godot
|
- godot
|
||||||
- misspell
|
- misspell
|
||||||
|
- zerologlint
|
||||||
|
- ginkgolinter
|
||||||
|
- gocheckcompilerdirectives
|
||||||
|
30
Earthfile
30
Earthfile
@ -1,14 +1,7 @@
|
|||||||
VERSION 0.6
|
VERSION 0.6
|
||||||
# Note the base image needs to have dracut.
|
|
||||||
# TODO: This needs to come from pre-built kernels in c3os repos, immucore included.
|
|
||||||
# Framework images should use our initrd
|
|
||||||
ARG FLAVOR=core-opensuse-leap
|
|
||||||
ARG BASE_IMAGE=quay.io/kairos/$FLAVOR
|
|
||||||
# renovate: datasource=docker depName=quay.io/kairos/osbuilder-tools versioning=semver-coerced
|
# renovate: datasource=docker depName=quay.io/kairos/osbuilder-tools versioning=semver-coerced
|
||||||
ARG OSBUILDER_VERSION=v0.8.6
|
ARG OSBUILDER_VERSION=v0.8.6
|
||||||
ARG OSBUILDER_IMAGE=quay.io/kairos/osbuilder-tools:$OSBUILDER_VERSION
|
ARG OSBUILDER_IMAGE=quay.io/kairos/osbuilder-tools:$OSBUILDER_VERSION
|
||||||
ARG ISO_NAME=$FLAVOR-immucore
|
|
||||||
|
|
||||||
# renovate: datasource=docker depName=golang
|
# renovate: datasource=docker depName=golang
|
||||||
ARG GO_VERSION=1.20
|
ARG GO_VERSION=1.20
|
||||||
# renovate: datasource=docker depName=golangci/golangci-lint
|
# renovate: datasource=docker depName=golangci/golangci-lint
|
||||||
@ -21,7 +14,7 @@ version:
|
|||||||
RUN --no-cache echo $(git describe --tags | sed 's/\(.*\)-.*/\1/') > VERSION
|
RUN --no-cache echo $(git describe --tags | sed 's/\(.*\)-.*/\1/') > VERSION
|
||||||
RUN --no-cache echo $(git describe --always --dirty) > COMMIT
|
RUN --no-cache echo $(git describe --always --dirty) > COMMIT
|
||||||
ARG VERSION=$(cat VERSION)
|
ARG VERSION=$(cat VERSION)
|
||||||
ARG COMMIT=$(cat COMMMIT)
|
ARG COMMIT=$(cat COMMIT)
|
||||||
SAVE ARTIFACT COMMIT COMMIT
|
SAVE ARTIFACT COMMIT COMMIT
|
||||||
SAVE ARTIFACT VERSION VERSION
|
SAVE ARTIFACT VERSION VERSION
|
||||||
|
|
||||||
@ -32,16 +25,6 @@ golang-image:
|
|||||||
COPY go.mod go.sum ./
|
COPY go.mod go.sum ./
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
|
|
||||||
go-deps:
|
|
||||||
ARG GO_VERSION
|
|
||||||
FROM golang:$GO_VERSION
|
|
||||||
WORKDIR /build
|
|
||||||
COPY go.mod go.sum ./
|
|
||||||
RUN go mod download
|
|
||||||
RUN apt-get update
|
|
||||||
SAVE ARTIFACT go.mod AS LOCAL go.mod
|
|
||||||
SAVE ARTIFACT go.sum AS LOCAL go.sum
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
FROM +golang-image
|
FROM +golang-image
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
@ -55,7 +38,7 @@ lint:
|
|||||||
FROM golangci/golangci-lint:$GOLINT_VERSION
|
FROM golangci/golangci-lint:$GOLINT_VERSION
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN golangci-lint run
|
RUN golangci-lint run -v
|
||||||
|
|
||||||
build-immucore:
|
build-immucore:
|
||||||
FROM +golang-image
|
FROM +golang-image
|
||||||
@ -73,13 +56,12 @@ build-immucore:
|
|||||||
RUN CGO_ENABLED=0 go build -o immucore -ldflags "${LDFLAGS}"
|
RUN CGO_ENABLED=0 go build -o immucore -ldflags "${LDFLAGS}"
|
||||||
SAVE ARTIFACT /work/immucore immucore AS LOCAL build/immucore-$VERSION
|
SAVE ARTIFACT /work/immucore immucore AS LOCAL build/immucore-$VERSION
|
||||||
|
|
||||||
build-immucore-image:
|
# Alias for ease of use
|
||||||
FROM +build-immucore
|
build:
|
||||||
COPY +build-immucore/immucore /usr/bin/immucore
|
BUILD +build-immucore
|
||||||
SAVE IMAGE immucore:latest
|
|
||||||
|
|
||||||
dracut-artifacts:
|
dracut-artifacts:
|
||||||
FROM $BASE_IMAGE
|
FROM scratch
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
COPY --dir dracut/28immucore .
|
COPY --dir dracut/28immucore .
|
||||||
COPY dracut/10-immucore.conf .
|
COPY dracut/10-immucore.conf .
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
docker run --privileged -v /var/run/docker.sock:/var/run/docker.sock --rm -t -v $(pwd):/workspace -v earthly-tmp:/tmp/earthly:rw earthly/earthly:v0.7.1 --allow-privileged $@
|
|
Loading…
Reference in New Issue
Block a user