Skip to content

Commit

Permalink
Unify CI and make versions (#284)
Browse files Browse the repository at this point in the history
  • Loading branch information
nwneisen authored Dec 4, 2023
1 parent 765c760 commit 52b3182
Show file tree
Hide file tree
Showing 13 changed files with 92 additions and 114 deletions.
2 changes: 2 additions & 0 deletions .github/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
GO_VERSION=1.21.3
HUGO_VERSION=0.114.0
54 changes: 42 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,15 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set up Go
- name: Load environment
uses: c-py/action-dotenv-to-setenv@v4
with:
env-file: .github/.env

- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: '1.21.3'
go-version: ${{ env.GO_VERSION }}

- name: Build
run: make static-linux
Expand All @@ -37,10 +42,15 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set up Go
- name: Load environment
uses: c-py/action-dotenv-to-setenv@v4
with:
env-file: .github/.env

- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: '1.21.3'
go-version: ${{ env.GO_VERSION }}

- name: Build
run: make deb
Expand All @@ -59,10 +69,15 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set up Go
- name: Load environment
uses: c-py/action-dotenv-to-setenv@v4
with:
env-file: .github/.env

- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: '1.21.3'
go-version: ${{ env.GO_VERSION }}

- name: Build
run: make rpm
Expand All @@ -81,10 +96,15 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set up Go
- name: Load environment
uses: c-py/action-dotenv-to-setenv@v4
with:
env-file: .github/.env

- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: '1.21.3'
go-version: ${{ env.GO_VERSION }}

- name: Build
run: make cross-arm
Expand All @@ -102,10 +122,15 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set up Go
- name: Load environment
uses: c-py/action-dotenv-to-setenv@v4
with:
env-file: .github/.env

- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: '1.21.3'
go-version: ${{ env.GO_VERSION }}

- name: Build
run: make cross-win
Expand All @@ -124,10 +149,15 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set up Go
- name: Load environment
uses: c-py/action-dotenv-to-setenv@v4
with:
env-file: .github/.env

- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: '1.21.3'
go-version: ${{ env.GO_VERSION }}

- name: Build
run: make cross-mac
Expand Down
18 changes: 11 additions & 7 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,23 @@ defaults:
jobs:
build:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.114.0
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive

- name: Load environment
uses: c-py/action-dotenv-to-setenv@v4
with:
env-file: .github/.env

- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https:/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
wget -O ${{ runner.temp }}/hugo.deb https:/gohugoio/hugo/releases/download/v${{ env.HUGO_VERSION }}/hugo_extended_${{ env.HUGO_VERSION }}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Install Dart Sass
run: sudo snap install dart-sass
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Pages
id: pages
uses: actions/configure-pages@v3
Expand Down
24 changes: 15 additions & 9 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,22 @@ jobs:
runs-on: ubuntu-20.04
timeout-minutes: 240
steps:
- name: Set up Go 1.21.3
uses: actions/setup-go@v1

- name: Checkout cri-dockerd
uses: actions/checkout@v2
with:
repository: ${{ github.repository }}
path: src/github.com/Mirantis/cri-dockerd

- name: Load environment
uses: c-py/action-dotenv-to-setenv@v4
with:
go-version: 1.21.3
env-file: src/github.com/Mirantis/cri-dockerd/.github/.env

- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
id: go

- name: Setup Go binary path
Expand Down Expand Up @@ -58,12 +70,6 @@ jobs:
# Restart docker daemon.
sudo service docker restart
- name: Checkout cri-dockerd
uses: actions/checkout@v2
with:
repository: ${{ github.repository }}
path: src/github.com/Mirantis/cri-dockerd

- name: Build cri-dockerd
working-directory: src/github.com/Mirantis/cri-dockerd
run: |
Expand Down
22 changes: 13 additions & 9 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,21 @@ jobs:
runs-on: ubuntu-20.04
timeout-minutes: 60
steps:
- name: Checkout cri-dockerd
uses: actions/checkout@v2
with:
repository: ${{ github.repository }}
path: src/github.com/Mirantis/cri-dockerd

- name: Load environment
uses: c-py/action-dotenv-to-setenv@v4
with:
env-file: src/github.com/Mirantis/cri-dockerd/.github/.env

- name: Set up Go 1.21.3
uses: actions/setup-go@v1
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: 1.21.3
go-version: ${{ env.GO_VERSION }}
id: go

- name: Setup environment
Expand Down Expand Up @@ -79,12 +89,6 @@ jobs:
make critest crictl
find $(pwd)/build/bin -type f -exec mv {} /usr/local/bin \;
- name: Checkout cri-dockerd
uses: actions/checkout@v2
with:
repository: ${{ github.repository }}
path: src/github.com/Mirantis/cri-dockerd

- name: Build cri-dockerd
working-directory: src/github.com/Mirantis/cri-dockerd
run: |
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ endif

SHELL=/bin/bash

export VERSION?=$(shell (git describe --abbrev=0 --tags | sed -e 's/v//') || echo $(cat VERSION)-$(git log -1 --pretty='%h'))
export VERSION?=$(shell (git describe --tags | sed -e 's/v//'))
PRERELEASE=`grep -q dev <<< "${VERSION}" && echo "pre" || echo ""`
REVISION?=`git log -1 --pretty='%h'`
export CRI_DOCKERD_LDFLAGS:=-ldflags "${CRI_DOCKERD_LDFLAGS} -s -w -buildid=${REVISION} \
Expand Down
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

4 changes: 2 additions & 2 deletions cmd/version/version.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package version

var (
// Version of the product
Version = "0.3.8"
// Version of the product. This is set during the build. Otherwise, call it a dev version
Version = "dev"
// PreRelease is set during the build
PreRelease = ""
// GitCommit is set during the build
Expand Down
4 changes: 2 additions & 2 deletions packaging/common.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARCH=$(shell uname -m)
GO_VERSION:=1.19.10
GO_VERSION?=$(shell grep GO_VERSION ../.github/.env | grep -v HUGO_VERSION | cut -d '=' -f 2)
PLATFORM=cri-dockerd
SHELL:=/bin/bash
VERSION?=0.3.8-dev
export VERSION?=$(shell (git describe --tags))

export PLATFORM
6 changes: 3 additions & 3 deletions packaging/deb/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include ../common.mk
APP_DIR:=$(realpath $(CURDIR)/../../)
GITCOMMIT?=$(shell cd $(APP_DIR) && git rev-parse --short HEAD)
GO_BASE_IMAGE=golang
GO_IMAGE=$(GO_BASE_IMAGE):$(GO_VERSION)-buster
GO_IMAGE=$(GO_BASE_IMAGE):$(GO_VERSION)-bullseye
DEB_VERSION=$(shell ./gen-deb-ver $(APP_DIR) "$(VERSION)")
CHOWN:=docker run --rm -v $(CURDIR):/v -w /v alpine chown
EPOCH?=0
Expand Down Expand Up @@ -36,10 +36,10 @@ RUN=docker run --rm -i \
SOURCE_FILES=app.tgz cri-docker.service cri-docker.socket
SOURCES=$(addprefix sources/, $(SOURCE_FILES))

DEBIAN_VERSIONS := debian-buster debian-bullseye
DEBIAN_VERSIONS := debian-bullseye
#UBUNTU_VERSIONS := ubuntu-xenial ubuntu-bionic ubuntu-cosmic ubuntu-disco ubuntu-eoan
UBUNTU_VERSIONS := ubuntu-bionic ubuntu-focal ubuntu-jammy
RASPBIAN_VERSIONS := raspbian-buster raspbian-bullseye
RASPBIAN_VERSIONS := raspbian-bullseye
DISTROS := $(DEBIAN_VERSIONS) $(UBUNTU_VERSIONS) $(RASPBIAN_VERSIONS)

.PHONY: help
Expand Down
34 changes: 0 additions & 34 deletions packaging/deb/debian-buster/Dockerfile

This file was deleted.

33 changes: 0 additions & 33 deletions packaging/deb/raspbian-buster/Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion packaging/rpm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include ../common.mk
APP_DIR:=$(realpath $(CURDIR)/../../)
STATIC_VERSION:=$(shell ../static/gen-static-ver $(APP_DIR) $(VERSION))
GO_BASE_IMAGE=golang
GO_IMAGE?=$(GO_BASE_IMAGE):$(GO_VERSION)-buster
GO_IMAGE?=$(GO_BASE_IMAGE):$(GO_VERSION)-bullseye
GEN_RPM_VER=$(shell ./gen-rpm-ver $(APP_DIR) $(VERSION))
CRI_DOCKER_GITCOMMIT?=$(word 3,$(GEN_RPM_VER))
CHOWN=docker run --rm -i -v $(CURDIR):/v -w /v alpine chown
Expand Down

0 comments on commit 52b3182

Please sign in to comment.