Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name-template: "$RESOLVED_VERSION"
tag-template: "$RESOLVED_VERSION"
categories:
- title: "Features"
labels:
- "feat"
- "feature"
- "enhancement"
- title: "Bug Fixes"
labels:
- "fix"
- "bugfix"
- "bug"
- title: "Maintenance"
labels:
- "docs"
- "doc"
- "chore"
change-template: "- $TITLE @$AUTHOR (#$NUMBER)"
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
version-template: "v$MAJOR.$MINOR.$PATCH"
version-resolver:
major:
labels:
- "major"
minor:
labels:
- "minor"
patch:
labels:
- "patch"
default: patch
exclude-labels:
- "skip-changelog"
autolabeler:
- label: "chore"
files:
- "*.md"
branch:
- '/docs{0,1}\/.+/'
- label: "bug"
branch:
- '/fix\/.+/'
- '/bug\/.+/'
- '/bugfix\/.+/'
title:
- "/fix/i"
- "/bug/i"
- "/bugfix/i"
- label: "feature"
branch:
- '/feat\/.+/'
- '/feature\/.+/'
- '/enhancement\/.+/'
template: |
## Changes

$CHANGES
53 changes: 53 additions & 0 deletions .github/workflows/golang.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Golang CI
permissions:
contents: read

on:
push:
branches: [main, develop]
paths:
- "**/*.go"
- "go.mod"
- "go.sum"
pull_request:
branches: [main, develop]
paths:
- "**/*.go"
- "go.mod"
- "go.sum"

env:
GO_MODULE: https://github.com/opendefensecloud/solution-arsenal
GO_VERSION: 1.25.7

jobs:
lint:
runs-on: arc-scale-set
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: ${{ env.GO_VERSION }}
- name: golangci-lint
uses: golangci/golangci-lint-action@v9

test:
needs: lint
runs-on: arc-scale-set
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: ${{ env.GO_VERSION }}
- name: test
run: |
make test
- name: Convert coverage to lcov
uses: jandelgado/gcov2lcov-action@v1.2.0
with:
infile: ocm-kit.coverprofile
- name: Coveralls GitHub Action
uses: coverallsapp/github-action@v2.3.7
with:
github-token: ${{ secrets.github_token }}
path-to-lcov: coverage.lcov
18 changes: 18 additions & 0 deletions .github/workflows/issues-add-labels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Label issues
on:
issues:
types:
- reopened
- opened
jobs:
label_issues:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- run: gh issue edit "$NUMBER" --add-label "$LABELS"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
NUMBER: ${{ github.event.issue.number }}
LABELS: needs-triage
19 changes: 19 additions & 0 deletions .github/workflows/issues-add-to-project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Add issues to project

on:
issues:
types:
- opened
pull_request:
types:
- opened

jobs:
add-to-project:
name: Add issue to project
runs-on: ubuntu-latest
steps:
- uses: actions/add-to-project@v1.0.2
with:
project-url: https://github.com/orgs/opendefensecloud/projects/3
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
41 changes: 41 additions & 0 deletions .github/workflows/osv-scanner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: OSV-Scanner

on:
pull_request:
branches: ["main"]
merge_group:
types: [checks_requested]
schedule:
- cron: "12 12 * * 1"
push:
branches: ["main"]

permissions:
# Required to upload SARIF file to CodeQL. See: https://github.com/github/codeql-action/issues/2117
actions: read
# Require writing security events to upload SARIF file to security tab
security-events: write
# Read commit contents
contents: read

jobs:
scan-scheduled:
if: ${{ github.event_name == 'push' || github.event_name == 'schedule' }}
uses: "google/osv-scanner-action/.github/workflows/osv-scanner-reusable.yml@c5996e0193a3df57d695c1b8a1dec2a4c62e8730" # v2.3.3
with:
# Example of specifying custom arguments
scan-args: |-
--include-git-root
--config ./.osv-scanner.toml
-r
./
scan-pr:
if: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }}
uses: "google/osv-scanner-action/.github/workflows/osv-scanner-reusable-pr.yml@c5996e0193a3df57d695c1b8a1dec2a4c62e8730" # v2.3.3
with:
# Example of specifying custom arguments
scan-args: |-
--include-git-root
--config ./.osv-scanner.toml
-r
./
42 changes: 42 additions & 0 deletions .github/workflows/release-drafter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Release Drafter

on:
push:
# branches to consider in the event; optional, defaults to all
branches:
- main

# pull_request event is required only for autolabeler
pull_request:
# Only following types are handled by the action, but one can default to all as well
types: [opened, reopened, synchronize]
# pull_request_target event is required for autolabeler to support PRs from forks
# pull_request_target:
# types: [opened, reopened, synchronize]

permissions:
contents: read

jobs:
update_release_draft:
permissions:
# write permission is required to create a github release
contents: write
# write permission is required for autolabeler
# otherwise, read permission is required at least
pull-requests: write
runs-on: ubuntu-latest
steps:
# (Optional) GitHub Enterprise requires GHE_HOST variable set
#- name: Set GHE_HOST
# run: |
# echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV

# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: release-drafter/release-drafter@v6
# (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
# with:
# config-name: my-config.yml
# disable-autolabeler: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
114 changes: 114 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Release

on:
push:
tags:
- 'v*'

permissions:
contents: write
packages: write

env:
GO_VERSION: '1.25'
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: ${{ env.GO_VERSION }}
cache: true

- name: Run tests
run: go test -race ./...

- name: Build binaries
run: |
VERSION=${GITHUB_REF#refs/tags/}
COMMIT=$(git rev-parse --short HEAD)
BUILD_TIME=$(date -u '+%Y-%m-%dT%H:%M:%SZ')
LDFLAGS="-X main.version=${VERSION} -X main.commit=${COMMIT} -X main.buildTime=${BUILD_TIME}"

# Linux amd64
GOOS=linux GOARCH=amd64 go build -ldflags "${LDFLAGS}" -o bin/ocm-kit-linux-amd64 ./cmd/ocm-kit

# Linux arm64
GOOS=linux GOARCH=arm64 go build -ldflags "${LDFLAGS}" -o bin/ocm-kit-linux-arm64 ./cmd/ocm-kit

# Darwin amd64
GOOS=darwin GOARCH=amd64 go build -ldflags "${LDFLAGS}" -o bin/ocm-kit-darwin-amd64 ./cmd/ocm-kit

# Darwin arm64
GOOS=darwin GOARCH=arm64 go build -ldflags "${LDFLAGS}" -o bin/ocm-kit-darwin-arm64 ./cmd/ocm-kit

- name: Create checksums
run: |
cd bin
sha256sum * > checksums.txt

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
bin/*
generate_release_notes: true
draft: false
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc') }}

docker-release:
name: Docker Release
runs-on: ubuntu-latest
needs: release
strategy:
matrix:
component: [ocm-kit]
steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/${{ matrix.component }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile.${{ matrix.component }}
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,8 @@ deep-docs/

*.coverprofile

test/fixtures/helmdemo-ctf
# OCM ctf from e2e test
ctf

# binary in case cmd/ocm-kit was built
/ocm-kit
Loading
Loading