Skip to content

Commit

Permalink
Update repo to serve as Go library
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Eduardo Arango Gutierrez <[email protected]>
  • Loading branch information
ArangoGutierrez committed Feb 26, 2025
1 parent 747a1d6 commit 9d20317
Show file tree
Hide file tree
Showing 15 changed files with 255 additions and 267 deletions.
7 changes: 5 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ updates:
schedule:
interval: "daily"

# A dependabot rule to bump the runner version
- package-ecosystem: "docker"
target-branch: main
directory: "/images/gh_runner"
directories:
# Golang version
- "/deployments/devel"
schedule:
interval: "daily"
labels:
- dependencies
49 changes: 49 additions & 0 deletions .github/workflows/basic-checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Copyright 2025 NVIDIA CORPORATION
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: "basic checks"

on:
workflow_call:
outputs:
version:
description: "The short SHA to use as a version string"
value: ${{ jobs.variables.outputs.version }}
golang_version:
description: "The golang version for this project"
value: ${{ jobs.variables.outputs.golang_version }}
pull_request:
types:
- opened
- synchronize
branches:
- main
- release-*

jobs:
variables:
uses: ./.github/workflows/variables.yaml

golang:
needs:
- variables
uses: ./.github/workflows/golang.yaml
with:
golang_version: ${{ needs.variables.outputs.golang_version }}

code-scanning:
needs:
- variables
uses: ./.github/workflows/code_scanning.yaml
with:
golang_version: ${{ needs.variables.outputs.golang_version }}
25 changes: 25 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2025 NVIDIA CORPORATION
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: CI Pipeline

on:
push:
branches:
- "pull-request/[0-9]+"
- main
- release-*

jobs:
basic:
uses: ./.github/workflows/basic-checks.yaml
51 changes: 51 additions & 0 deletions .github/workflows/code_scanning.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Copyright 2025 NVIDIA CORPORATION
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: "CodeQL"

on:
workflow_call:
inputs:
golang_version:
required: true
type: string

jobs:
analyze:
name: Analyze Go code with CodeQL
runs-on: ubuntu-latest
timeout-minutes: 360
permissions:
security-events: write
packages: read
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ inputs.golang_version }}

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: go

- name: Fetch Dependencies
run: go mod download

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:go"
49 changes: 10 additions & 39 deletions .github/workflows/golang.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,23 @@
name: Golang

on:
push:
branches:
- "pull-request/[0-9]+"
- main
- release-*
workflow_call:
inputs:
golang_version:
required: true
type: string

jobs:
check:
runs-on: linux-amd64-cpu4
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Get Golang version
id: vars
run: |
GOLANG_VERSION=$( grep "GOLANG_VERSION ?=" versions.mk )
echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION ?= }" >> $GITHUB_ENV
- uses: actions/checkout@v4
name: Checkout code

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GOLANG_VERSION }}
go-version: ${{ inputs.golang_versions }}

- name: Lint
uses: golangci/golangci-lint-action@v6
Expand All @@ -47,28 +41,5 @@ jobs:
skip-cache: true

- name: Check golang modules
run: make check-vendor

- name: Check workflow status
run: |
if [ "${{ job.status }}" = "success" ]; then
STATUS_MESSAGE=":green-check-mark: On repository ${{ github.repository }} the Workflow ${{ github.workflow }} has completed successfully."
else
STATUS_MESSAGE=":red_target: On repository ${{ github.repository }} the Workflow ${{ github.workflow }} has failed."
fi
echo "STATUS_MESSAGE=$STATUS_MESSAGE" >> $GITHUB_ENV
- name: Send Slack alert notification
id: slack
if: github.event_name == 'push'
uses: slackapi/[email protected]
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
SUMMARY_URL: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
with:
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
#slack-message: "GitHub build result: ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
slack-message: |
${{ env.STATUS_MESSAGE }}
Details: ${{ env.SUMMARY_URL }}
make check-modules
157 changes: 0 additions & 157 deletions .github/workflows/image.yaml

This file was deleted.

Loading

0 comments on commit 9d20317

Please sign in to comment.