From 3e5d606a65211734e7cded4e1eb4229b58623c9e Mon Sep 17 00:00:00 2001 From: Laurent Demailly Date: Sun, 19 Feb 2023 15:06:50 -0800 Subject: [PATCH] Prep for 1.0, fix up readme and godoc (#1) and add workflows --- .github/dependabot.yml | 16 ++++++++ .github/workflows/codeql.yml | 76 ++++++++++++++++++++++++++++++++++++ README.md | 3 ++ cli.go | 8 ++-- go.mod | 4 +- go.sum | 8 ++-- 6 files changed, 105 insertions(+), 10 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/codeql.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..8c2407e --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,16 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "gomod" + directory: "/" # Location of package manifests + schedule: + interval: "daily" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + # Check for updates to GitHub Actions every week + interval: "weekly" diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..2454797 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,76 @@ +# 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" ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ "main" ] + schedule: + - cron: '22 22 * * 0' + +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' ] + # Use only 'java' to analyze code written in Java, Kotlin or both + # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + 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#, Go, 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}}" diff --git a/README.md b/README.md index 9695b25..95d9721 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +[![Go Reference](https://pkg.go.dev/badge/fortio.org/scli.svg)](https://pkg.go.dev/fortio.org/scli) +[![Go Report Card](https://goreportcard.com/badge/fortio.org/scli)](https://goreportcard.com/report/fortio.org/scli) +[![GitHub Release](https://img.shields.io/github/release/fortio/scli.svg?style=flat)](https://github.com/fortio/scli/releases/) # scli Extends [cli](https://github.com/fortio/cli#cli) to server `main()`s . diff --git a/cli.go b/cli.go index 4078f03..a3ee326 100644 --- a/cli.go +++ b/cli.go @@ -7,7 +7,7 @@ // [ServerMain] allows the setup of a confimap/directory watch for flags // and a config endpoint (uses [fortio.org/dflag]). // Configure using the [cli] package variables (at minimum [MinArgs] unless your -// binary only accepts flags), setup additional [flag]s before calling +// binary only accepts flags), setup additional [flag] before calling // [ServerMain]. package scli // import "fortio.org/scli" @@ -23,9 +23,9 @@ import ( ) // ServerMain extends [cli.Main] and returns true if a config port server has been started -// caller needs to select {} after its own code is ready. -// Will have called ExitFunction (ie exited) if there are usage errors -// (wrong number of arguments, bad flags etc...). +// caller needs to select {} after their own code is ready. +// [cli.ExitFunction] will have been called (ie program will have exited exited) +// if there are usage errors (wrong number of arguments, bad flags etc...). // It sets up (optional) config-dir to watch and listen on config-port for dynamic flag // changes and UI/api. func ServerMain() bool { diff --git a/go.mod b/go.mod index ec8d51e..5d8486e 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,8 @@ module fortio.org/scli go 1.18 require ( - fortio.org/cli v0.6.2 - fortio.org/dflag v1.4.1 + fortio.org/cli v1.0.0 + fortio.org/dflag v1.4.2 fortio.org/fortio v1.50.1 fortio.org/log v1.2.2 ) diff --git a/go.sum b/go.sum index 7a6c224..bfd5c7b 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,8 @@ fortio.org/assert v1.1.3 h1:zXm8xiNiKvq2xG/YQ3sONAg3287XUuklKIDdjyD9pyg= -fortio.org/cli v0.6.2 h1:WY/22DFh8z+qEzZXNKfHsHu5JsJhQbmnlMQSot21ifA= -fortio.org/cli v0.6.2/go.mod h1:O3nVImKwJSvHKbMYWkqMbEagAXCS1xvSv1YbHwkKJjY= -fortio.org/dflag v1.4.1 h1:WDhlHMh3yrQFrvspyN5YEyr8WATdKM2dUJlTxsjCDtI= -fortio.org/dflag v1.4.1/go.mod h1:pTEF7UEj6sHP9rj9gZG2GyhAGrrPJE4c6zOO7zB2yyI= +fortio.org/cli v1.0.0 h1:qUyHr1DiyxFoq5RBPFJ6Hw30NcV/0KYSxmptdiLiW5I= +fortio.org/cli v1.0.0/go.mod h1:O3nVImKwJSvHKbMYWkqMbEagAXCS1xvSv1YbHwkKJjY= +fortio.org/dflag v1.4.2 h1:kkPNgmoGViSqh16Muf3BGt+qxPgsx+yfFGB/bpmiGqM= +fortio.org/dflag v1.4.2/go.mod h1:pTEF7UEj6sHP9rj9gZG2GyhAGrrPJE4c6zOO7zB2yyI= fortio.org/fortio v1.50.1 h1:5FSttAHQsyAsi3dzxDmSByfzDYByrWY/yw53bqOg+Kc= fortio.org/fortio v1.50.1/go.mod h1:TpAo6nixVbTxeIfE8F2c63D3ffouMTa+KDr9eFAYxys= fortio.org/log v1.2.2 h1:vs42JjNwiqbMbacittZjJE9+oi72Za6aekML9gKmILg=