Skip to content

CI

CI #73

Workflow file for this run

name: CI
on:
push:
branches: [ main ]
tags:
- "*"
pull_request:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
vendor:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19
- name: Vendor
run: |
make vendor
git diff --exit-code
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19
- name: Build
run: make
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19
- name: Build docs
run: |
make gen-docs
git diff --exit-code
linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19
- name: Build kg and kgctl for all Linux Architectures
run: make all-build
darwin:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19
- name: Build kgctl for Darwin amd64
run: make OS=darwin ARCH=amd64
- name: Build kgctl for Darwin arm64
run: make OS=darwin ARCH=arm64
windows:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19
- name: Build kgctl for Windows
run: make OS=windows
unit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19
- name: Run Unit Tests
run: make unit
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19
- name: Lint Code
run: make lint
container:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19
- name: Container
run: make container
push:
if: github.event_name != 'pull_request'
needs:
- vendor
- build
- linux
- darwin
- windows
- unit
- lint
- container
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: all
- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
if: github.event_name != 'pull_request'
run: make manifest
- name: Build and push latest
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
run: make manifest-latest
bump-manifests:
if: startsWith(github.ref, 'refs/tags/v')
needs: [push]
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v3
with:
ref: main
- name: Get version from tag
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Update manifest versions
run: |
sed -i 's|image: ghcr.io/cozystack/cozystack/kilo:v[0-9]*\.[0-9]*\.[0-9]*|image: ghcr.io/cozystack/cozystack/kilo:${{ steps.version.outputs.VERSION }}|g' manifests/*.yaml e2e/*.yaml
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
commit-message: "chore: bump kilo image to ${{ steps.version.outputs.VERSION }}"
signoff: true
title: "chore(manifests): bump kilo image to ${{ steps.version.outputs.VERSION }}"
body: |
Automated PR to update manifest image versions to `${{ steps.version.outputs.VERSION }}`.
branch: "chore/bump-manifests-${{ steps.version.outputs.VERSION }}"