Skip to content

Commit

Permalink
Use nhatthm/gh-actions (#270)
Browse files Browse the repository at this point in the history
  • Loading branch information
nhatthm authored Jan 19, 2024
1 parent 52eabef commit 661c65e
Show file tree
Hide file tree
Showing 11 changed files with 218 additions and 293 deletions.
44 changes: 7 additions & 37 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ on:
schedule:
- cron: '33 10 * * 6'

env:
GO_VERSION: 1.21.x

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand All @@ -45,40 +42,13 @@ jobs:
# Learn more about CodeQL language support at https://git.io/codeql-language-support

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

- name: Set up Go
uses: actions/setup-go@v5
if: ${{ matrix.language == 'go' }}
- name: Setup
uses: nhatthm/gh-actions/find-go-version@master
with:
go-version: ${{ env.GO_VERSION }}
go-version-file: ""

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
- name: Run CodeQL
uses: nhatthm/gh-actions/codeql@master
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.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# 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@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
language: ${{ matrix.language }}
go-version: ${{ env.GO_LATEST_VERSION }}
29 changes: 13 additions & 16 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ on:
branches:
- master

env:
GO_VERSION: 1.21.x

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand All @@ -22,32 +19,32 @@ jobs:
module: [ ".", "tests/suite", "tests/mssql", "tests/mysql", "tests/postgres" ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout code
uses: nhatthm/gh-actions/checkout@master

- name: Setup
uses: nhatthm/gh-actions/find-go-version@master

- name: Install Go
uses: actions/setup-go@v5
uses: nhatthm/gh-actions/setup-go@master
with:
go-version: ${{ env.GO_VERSION }}

- id: vars
run: |
make $GITHUB_OUTPUT
go-version: ${{ env.GO_LATEST_VERSION }}

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
- name: Lint
uses: nhatthm/gh-actions/golangci-lint@master
with:
version: ${{ steps.vars.outputs.GOLANGCI_LINT_VERSION }}
working-directory: ${{ matrix.module }}
args: --timeout=5m

lint-gherkin:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout code
uses: nhatthm/gh-actions/checkout@master

- name: gherkin-lint
uses: nhatthm/gherkin-lint[email protected]
- name: Lint
uses: nhatthm/gh-actions/gherkin-lint@master
with:
feature_files: tests/features/*
config_file: tests/.gherkin-lintrc
31 changes: 11 additions & 20 deletions .github/workflows/pr-tidy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,37 +17,27 @@ jobs:
runs-on: ubuntu-latest
if: ${{ startsWith(github.head_ref, 'dependabot/go_modules/') }}
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

- name: Checkout code
uses: actions/checkout@v4
uses: nhatthm/gh-actions/checkout@master
with:
token: ${{ secrets.PUSH_TOKEN }}
ref: ${{ github.head_ref }}

- name: Go cache
uses: actions/cache@v4
- name: Find Go version
uses: nhatthm/gh-actions/find-go-version@master

- name: Install Go
uses: nhatthm/gh-actions/setup-go@master
with:
# In order:
# * Module download cache
# * Build cache (Linux)
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-cache-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ env.GO_VERSION }}-cache
go-version: ${{ env.GO_VERSION }}

- name: Tidy
run: |
make tidy
- name: setup-gpg
- name: Setup GPG
id: setup-gpg
uses: crazy-max/ghaction-import-gpg@v6
uses: nhatthm/gh-actions/import-gpg@master
with:
gpg_private_key: ${{ secrets.PUSH_PRIVATE_KEY }}
passphrase: ${{ secrets.PUSH_SECRET }}
Expand All @@ -56,7 +46,8 @@ jobs:
git_commit_gpgsign: true
git_tag_gpgsign: false

- uses: EndBug/add-and-commit@v9
- name: Add and Commit
uses: nhatthm/gh-actions/git-add-and-commit@master
with:
message: "go mod tidy"
push: true
Expand Down
Loading

0 comments on commit 661c65e

Please sign in to comment.