Files
ubicloud/.github/workflows/cli-ci.yml
Enes Cakir 0b150aaaf3 Unify clover workflow environment setup at workflows
We currently set up PostgreSQL, Ruby, Clover, and databases separately
in each workflow using the same steps. To simplify and standardize this,
we’re extracting these steps into a shared action.

Notably, we install PostgreSQL directly on the system instead of using a
Docker container for three main reasons:

  1. Reusable workflows don’t support GitHub Action's `services`
     feature.
  2. macOS runners are free for open source projects and help us catch
     platform-specific issues. However, they don’t come with Docker due
     to licensing restrictions, making container-based setups more
     difficult.
  3. Our controlplane tests have been taking longer. To support running
     tests in parallel, we need more flexible database configurations
     than what the default Docker setup allows.

This change should reduce duplication, simplify maintenance, and improve
testing flexibility across platforms.
2025-07-04 11:39:23 +03:00

62 lines
1.3 KiB
YAML

name: cli/ubi CI
permissions:
contents: read
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'cli/**'
- 'bin/ubi'
- 'spec/cli_spec.rb'
- '.github/workflows/cli-ci.yml'
- '.github/actions/setup-clover/action.yml'
pull_request:
paths:
- 'cli/**'
- 'bin/ubi'
- 'spec/cli_spec.rb'
- '.github/workflows/cli-ci.yml'
- '.github/actions/setup-clover/action.yml'
jobs:
cli-ci:
strategy:
fail-fast: false
matrix:
runs-on: [ubicloud, ubicloud-arm]
name: cli/ubi CI - ${{matrix.runs-on}}
runs-on: ${{matrix.runs-on}}
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Clover
uses: ./.github/actions/setup-clover
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'cli/go.mod'
- name: Build cli/ubi
run: bundle exec rake ubi
- name: Run cli/ubi tests
env:
UBI_CMD: ./cli/ubi
run: bundle exec rspec spec/cli_spec.rb
- name: Run go fmt and check it makes no changes
run: "cd cli && go fmt && git diff --stat --exit-code"
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v8
with:
version: v2.1.5
working-directory: cli