mirror of
https://github.com/kairos-io/immucore.git
synced 2025-04-28 03:21:10 +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
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: earthly/actions-setup@v1
|
||||
- name: Run Lint checks
|
||||
run: |
|
||||
./earthly.sh +lint
|
||||
run: earthly +lint
|
||||
unit-tests:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
@ -27,13 +27,23 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
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
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: '^1.20'
|
||||
go-version-file: 'go.mod'
|
||||
- uses: earthly/actions-setup@v1
|
||||
- name: Build
|
||||
run: earthly +build
|
||||
- name: Run tests
|
||||
run: |
|
||||
./earthly.sh +test
|
||||
run: earthly +test
|
||||
- name: Codecov
|
||||
uses: codecov/codecov-action@v3
|
||||
with:
|
||||
|
@ -17,4 +17,7 @@ linters:
|
||||
- staticcheck
|
||||
- typecheck
|
||||
- godot
|
||||
- misspell
|
||||
- misspell
|
||||
- zerologlint
|
||||
- ginkgolinter
|
||||
- gocheckcompilerdirectives
|
||||
|
30
Earthfile
30
Earthfile
@ -1,14 +1,7 @@
|
||||
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
|
||||
ARG OSBUILDER_VERSION=v0.8.6
|
||||
ARG OSBUILDER_IMAGE=quay.io/kairos/osbuilder-tools:$OSBUILDER_VERSION
|
||||
ARG ISO_NAME=$FLAVOR-immucore
|
||||
|
||||
# renovate: datasource=docker depName=golang
|
||||
ARG GO_VERSION=1.20
|
||||
# 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 --always --dirty) > COMMIT
|
||||
ARG VERSION=$(cat VERSION)
|
||||
ARG COMMIT=$(cat COMMMIT)
|
||||
ARG COMMIT=$(cat COMMIT)
|
||||
SAVE ARTIFACT COMMIT COMMIT
|
||||
SAVE ARTIFACT VERSION VERSION
|
||||
|
||||
@ -32,16 +25,6 @@ golang-image:
|
||||
COPY go.mod go.sum ./
|
||||
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:
|
||||
FROM +golang-image
|
||||
WORKDIR /build
|
||||
@ -55,7 +38,7 @@ lint:
|
||||
FROM golangci/golangci-lint:$GOLINT_VERSION
|
||||
WORKDIR /build
|
||||
COPY . .
|
||||
RUN golangci-lint run
|
||||
RUN golangci-lint run -v
|
||||
|
||||
build-immucore:
|
||||
FROM +golang-image
|
||||
@ -73,13 +56,12 @@ build-immucore:
|
||||
RUN CGO_ENABLED=0 go build -o immucore -ldflags "${LDFLAGS}"
|
||||
SAVE ARTIFACT /work/immucore immucore AS LOCAL build/immucore-$VERSION
|
||||
|
||||
build-immucore-image:
|
||||
FROM +build-immucore
|
||||
COPY +build-immucore/immucore /usr/bin/immucore
|
||||
SAVE IMAGE immucore:latest
|
||||
# Alias for ease of use
|
||||
build:
|
||||
BUILD +build-immucore
|
||||
|
||||
dracut-artifacts:
|
||||
FROM $BASE_IMAGE
|
||||
FROM scratch
|
||||
WORKDIR /build
|
||||
COPY --dir dracut/28immucore .
|
||||
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