Skip to content

Commit

Permalink
Merge pull request #25 from banzaicloud/improve-ci
Browse files Browse the repository at this point in the history
Improve CI
  • Loading branch information
sagikazarmark committed Apr 27, 2023
2 parents eb35016 + 6192355 commit 22c6d83
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 37 deletions.
2 changes: 2 additions & 0 deletions .github/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[{*.yml,*.yaml}]
indent_size = 2
12 changes: 12 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2

updates:
- package-ecosystem: gomod
directory: /
schedule:
interval: daily

- package-ecosystem: github-actions
directory: /
schedule:
interval: daily
47 changes: 47 additions & 0 deletions .github/workflows/analysis-scorecard.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: OpenSSF Scorecard

on:
branch_protection_rule:
push:
branches: [ main ]
schedule:
- cron: '30 0 * * 5'

permissions:
contents: read

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

permissions:
actions: read
contents: read
id-token: write
security-events: write

steps:
- name: Checkout repository
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
persist-credentials: false

- name: Run analysis
uses: ossf/scorecard-action@80e868c13c90f172d68d1f4501dee99e2479f7af # v2.1.3
with:
results_file: results.sarif
results_format: sarif
publish_results: true

- name: Upload results as artifact
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: OpenSSF Scorecard results
path: results.sarif
retention-days: 5

- name: Upload results to GitHub Security tab
uses: github/codeql-action/upload-sarif@b2c19fb9a2a485599ccf4ed5d65527d94bc57226 # v2.3.0
with:
sarif_file: results.sarif
98 changes: 64 additions & 34 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,65 @@ name: CI

on:
push:
branches:
- 'main'
tags:
- "v[0-9].[0-9]+.[0-9]+*"
branches: [ main ]
tags: [ "v[0-9].[0-9]+.[0-9]+*" ]
pull_request:
branches:
- 'main'

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
go: ['1.18', '1.19', '1.20']

steps:
- name: Checkout repository
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2

- name: Set up Go
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: ${{ matrix.go }}

- name: Test
run: make test

integration-test:
name: Integration test
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2

- name: Set up Go
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: '1.20'

- name: Run integration tests
run: make integration-test

lint:
name: Lint
runs-on: ubuntu-latest
defaults:
run:
shell: bash

steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2

- name: Install Golang
uses: actions/setup-go@v3
- name: Set up Go
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: '~1.18'
cache: true
go-version: '1.20'

- name: Run go fmt
run: make fmt
Expand All @@ -40,13 +72,17 @@ jobs:
run: make lint

license:
name: License check
runs-on: ubuntu-latest
defaults:
run:
shell: bash

steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2

- name: Set up Go
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: '1.20'

- name: Update license cache
run: make license-cache
Expand All @@ -58,20 +94,14 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

integration-test:
dependency-review:
name: Dependency review
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Checkout source code
uses: actions/checkout@v3
if: github.event_name == 'pull_request'

- name: Install Golang
uses: actions/setup-go@v3
with:
go-version: '~1.18'
cache: true
steps:
- name: Checkout repository
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2

- name: Run integration tests
run: make integration-test
- name: Dependency Review
uses: actions/dependency-review-action@f46c48ed6d4f1227fb2d9ea62bf6bcbed315589e # v3.0.4
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[![CI](https://github.com/banzaicloud/go-cruise-control/actions/workflows/ci.yaml/badge.svg?branch=main)](https://github.com/banzaicloud/go-cruise-control/actions/workflows/ci.yaml)
![GitHub release (latest by date)](https://img.shields.io/github/v/release/banzaicloud/go-cruise-control)

# go-cruise-control

[![GitHub Workflow Status](https://github.com/banzaicloud/go-cruise-control/actions/workflows/ci.yaml/badge.svg?style=flat-square)](https://github.com/banzaicloud/go-cruise-control/actions/workflows/ci.yaml)
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/banzaicloud/go-cruise-control/badge?style=flat-square)](https://api.securityscorecards.dev/projects/github.com/banzaicloud/go-cruise-control)
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/banzaicloud/go-cruise-control?style=flat-square)](https://github.com/banzaicloud/go-cruise-control/releases/latest)

It's client library (written in Golang) for interacting with
[Linkedin Cruise Control](https://github.com/linkedin/cruise-control) using its HTTP API.

Expand Down

0 comments on commit 22c6d83

Please sign in to comment.