I merged #3047, but it seems to have broken the CI. The golangci/golangci-lint-action@v7 requires using golangci-lint v2, but v2 raises the following error. I didn't notice it because cli-ci didn't run on that PR. Thanks to the previous commit, cli-ci will run when there are changes. Error: cli/ubi.go:74:23: Error return value of `resp.Body.Close` is not checked (errcheck) defer resp.Body.Close() ^ 1 issues: * errcheck: 1
92 lines
2.5 KiB
YAML
92 lines
2.5 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'
|
|
pull_request:
|
|
paths:
|
|
- 'cli/**'
|
|
- 'bin/ubi'
|
|
- 'spec/cli_spec.rb'
|
|
- '.github/workflows/cli-ci.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}}
|
|
|
|
env:
|
|
DB_USER: clover
|
|
DB_PASSWORD: nonempty
|
|
DB_NAME: clover_test
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:15.8
|
|
env:
|
|
POSTGRES_USER: ${{ env.DB_USER }}
|
|
POSTGRES_PASSWORD: ${{ env.DB_PASSWORD }}
|
|
POSTGRES_DB: ${{ env.DB_NAME }}
|
|
ports:
|
|
- 5432:5432
|
|
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
|
|
|
steps:
|
|
- name: Perform superuser-only actions, then remove superuser
|
|
run: |
|
|
psql "postgres://${{ env.DB_USER }}:${{ env.DB_PASSWORD }}@localhost:5432/${{ env.DB_NAME }}" \
|
|
-c "CREATE EXTENSION citext; CREATE EXTENSION btree_gist; CREATE ROLE clover_password PASSWORD '${{ env.DB_PASSWORD }}' LOGIN; ALTER ROLE ${{ env.DB_USER }} NOSUPERUSER"
|
|
|
|
- name: Check out code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: 'cli/go.mod'
|
|
|
|
- name: Set up Ruby
|
|
uses: ruby/setup-ruby@v1
|
|
with:
|
|
ruby-version: .tool-versions
|
|
bundler-cache: true
|
|
|
|
- name: Apply migrations
|
|
env:
|
|
CLOVER_DATABASE_URL: postgres://${{ env.DB_USER }}:${{ env.DB_PASSWORD }}@localhost:5432/${{ env.DB_NAME }}
|
|
run: bundle exec rake _test_up
|
|
|
|
- name: Build cli/ubi
|
|
run: bundle exec rake ubi
|
|
|
|
- name: Run cli/ubi tests
|
|
env:
|
|
CLOVER_DATABASE_URL: postgres://${{ env.DB_USER }}:${{ env.DB_PASSWORD }}@localhost:5432/${{ env.DB_NAME }}
|
|
CLOVER_SESSION_SECRET: kbaf1V3biZ+R2QqFahgDLB5/lSomwxQusA4PwROUkFS1srn0xM/I47IdLW7HjbQoxWri6/aVgtkqTLFiP65h9g==
|
|
CLOVER_COLUMN_ENCRYPTION_KEY: TtlY0+hd4lvedPkNbu5qsj5H7giPKJSRX9KDBrvid7c=
|
|
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@v6
|
|
with:
|
|
version: v1.64
|
|
working-directory: cli
|