Skip to content

Commit

Permalink
chore: format ci config files
Browse files Browse the repository at this point in the history
  • Loading branch information
soulteary committed Jan 31, 2024
1 parent e5a09cd commit 15f10dd
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 93 deletions.
88 changes: 32 additions & 56 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,74 +1,50 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "main" ]
branches: ["main"]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
branches: ["main"]
schedule:
- cron: '0 0 * * 0'
- cron: "0 0 * * 0"

env:
GO_VERSION: "1.21"

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

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'go' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
language: ["go"]

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
- name: Checkout repository
uses: actions/checkout@v4

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

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}

- name: Autobuild
uses: github/codeql-action/autobuild@v3

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
40 changes: 20 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,60 +4,60 @@ on:
workflow_dispatch:
push:
branches:
- 'main'
- "main"
tags:
- '0.*.*'
- "0.*.*"
env:
GO_VERSION: "1.21"
GO111MODULE: on
DOCKER_CLI_EXPERIMENTAL: "enabled"

jobs:
build:
runs-on: ubuntu-latest
env:
GO111MODULE: on
DOCKER_CLI_EXPERIMENTAL: "enabled"

steps:
-
name: Checkout
uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v3

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

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Cache Go modules

- name: Cache Go modules
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
-
name: Tests
- name: Tests
run: |
go run build/build.go
go mod tidy
go test -v ./...
# Login against a Docker registry except on PR
# https://github.com/docker/login-action

- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Run GoReleaser

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
if: success() && startsWith(github.ref, 'refs/tags/')
with:
version: "v1.21.2"
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34 changes: 17 additions & 17 deletions .github/workflows/scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,29 @@ on:
branches:
- main
paths:
- 'internal/**'
- 'pkg/**'
- 'cmd/**'
- '*.go'
- "internal/**"
- "pkg/**"
- "cmd/**"
- "*.go"
pull_request:
branches:
- main
schedule:
- cron: '0 0 * * 0'
- cron: "0 0 * * 0"

jobs:
scan:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Security Scan
uses: securego/gosec@master
with:
# we let the report trigger content trigger a failure using the GitHub Security features.
args: '-no-fail -fmt sarif -out results.sarif ./...'
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v2
with:
# Path to SARIF file relative to the root of the repository
sarif_file: results.sarif
- name: Check out code into the Go module directory
uses: actions/checkout@v4

- name: Security Scan
uses: securego/gosec@master
with:
args: "-no-fail -fmt sarif -out results.sarif ./..."

- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: results.sarif

0 comments on commit 15f10dd

Please sign in to comment.