chore/integration test (#123)

* chore: make prompt optional for delete

* chore: add initial integration test for macos

* fix ci

* fix ci

* chore: add image building to integration

* add integration test status badge to readme

* chore: add kubernetes to integration test
This commit is contained in:
Abiola Ibrahim
2022-01-15 13:15:44 +01:00
committed by GitHub
parent bb73f1c515
commit eb4d179aed
6 changed files with 135 additions and 6 deletions
+17
View File
@@ -0,0 +1,17 @@
name: golangci-lint
on:
push:
tags: [v*]
branches: [main]
pull_request:
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.43.0
args: --timeout 3m0s
+97
View File
@@ -0,0 +1,97 @@
name: Integration
on:
push:
tags: ["v*"]
branches: [main]
pull_request:
branches: [main]
jobs:
docker:
runs-on: macos-11
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Install CLI deps
run: |
brew install kubectl docker coreutils lima
- name: Build and Install Colima
run: make && sudo make install
- name: Start Colima
run: colima start --runtime docker
- name: Delay
run: sleep 5
- name: Validate Docker
run: docker ps && docker info
- name: Build Image
run: docker build integration
- name: Stop
run: colima stop
- name: Kubernetes
run: colima start --runtime docker --with-kubernetes
- name: Delay
run: sleep 5
- name: Validate Kubernetes
run: kubectl cluster-info && kubectl version && kubectl get nodes -o wide
- name: Teardown
run: colima delete -f
containerd:
runs-on: macos-11
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Install CLI deps
run: |
brew install kubectl docker coreutils lima
- name: Build and Install Colima
run: make && sudo make install
- name: Start Colima
run: colima start --runtime containerd
- name: Delay
run: sleep 5
- name: Validate Containerd
run: colima nerdctl ps && colima nerdctl info
- name: Build Image
run: colima nerdctl -- build integration
- name: Stop
run: colima stop
- name: Kubernetes
run: colima start --runtime containerd --with-kubernetes
- name: Delay
run: sleep 5
- name: Validate Kubernetes
run: kubectl cluster-info && kubectl version && kubectl get nodes -o wide
- name: Teardown
run: colima delete -f
+1
View File
@@ -1,6 +1,7 @@
# Colima
[![Go](https://github.com/abiosoft/colima/actions/workflows/go.yml/badge.svg)](https://github.com/abiosoft/colima/actions/workflows/go.yml)
[![Integration](https://github.com/abiosoft/colima/actions/workflows/integration.yml/badge.svg)](https://github.com/abiosoft/colima/actions/workflows/integration.yml)
Container runtimes on macOS (and Linux) with minimal setup.
-6
View File
@@ -4,7 +4,6 @@ import (
"fmt"
"strconv"
"github.com/abiosoft/colima/cli"
"github.com/abiosoft/colima/config"
"github.com/abiosoft/colima/environment"
"github.com/abiosoft/colima/environment/container/kubernetes"
@@ -134,11 +133,6 @@ func (c colimaApp) Stop() error {
}
func (c colimaApp) Delete() error {
y := cli.Prompt("are you sure you want to delete " + config.Profile().DisplayName + " and all settings")
if !y {
return nil
}
log.Println("deleting", config.Profile().DisplayName)
// the order for teardown is:
+15
View File
@@ -1,10 +1,16 @@
package cmd
import (
"github.com/abiosoft/colima/cli"
"github.com/abiosoft/colima/cmd/root"
"github.com/abiosoft/colima/config"
"github.com/spf13/cobra"
)
var deleteCmdArgs struct {
force bool
}
// deleteCmd represents the delete command
var deleteCmd = &cobra.Command{
Use: "delete",
@@ -16,10 +22,19 @@ initial startup of Colima.
If you simply want to reset the Kubernetes cluster, run 'colima kubernetes reset'.`,
RunE: func(cmd *cobra.Command, args []string) error {
if !deleteCmdArgs.force {
y := cli.Prompt("are you sure you want to delete " + config.Profile().DisplayName + " and all settings")
if !y {
return nil
}
}
return newApp().Delete()
},
}
func init() {
root.Cmd().AddCommand(deleteCmd)
deleteCmd.Flags().BoolVarP(&deleteCmdArgs.force, "force", "f", false, "do not prompt for yes/no")
}
+5
View File
@@ -0,0 +1,5 @@
# sample dockerfile to test image building
# without pulling from docker hub
FROM scratch
COPY . /files