Skip to content

Commit

Permalink
Improve Tests (#162)
Browse files Browse the repository at this point in the history
  • Loading branch information
attiasas authored Nov 3, 2024
1 parent 10e3822 commit 1f67126
Show file tree
Hide file tree
Showing 52 changed files with 1,401 additions and 970 deletions.
1 change: 1 addition & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- [ ] The code has been formatted properly using `go fmt ./...`.
- [ ] All [static analysis checks](https://github.com/jfrog/jfrog-cli-security/actions/workflows/analysis.yml) passed.
- [ ] All [tests](https://github.com/jfrog/jfrog-cli-security/actions/workflows/test.yml) have passed. If this feature is not already covered by the tests, new tests have been added.
- [ ] Updated the [Contributing page](https://github.com/jfrog/jfrog-cli-security/blob/main/CONTRIBUTING.md) / [ReadMe page](https://github.com/jfrog/jfrog-cli-security/blob/main/README.md) / [CI Workflow files](https://github.com/jfrog/jfrog-cli-security/tree/main/.github/workflows) if needed.
- [ ] All changes are detailed at the description. if not already covered at [JFrog Documentation](https://github.com/jfrog/documentation), new documentation have been added.

-----
57 changes: 57 additions & 0 deletions .github/actions/install-and-setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: "Install and Setup Dependencies"
description: "Install needed dependencies for this repository like Go, Node, Java, Python, etc."

runs:
using: "composite"
steps:
# Install dependencies
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.22.x
# - name: Setup Go with cache
# uses: jfrog/.github/actions/install-go-with-cache@main

- name: Install npm
uses: actions/setup-node@v4
with:
node-version: "16"
- name: Setup Pnpm
uses: pnpm/action-setup@v3
with:
version: 8

- name: Install Java
uses: actions/setup-java@v4
with:
java-version: "11"
distribution: "adopt"
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-version: 7.6

- name: Install NuGet
uses: nuget/setup-nuget@v2
with:
nuget-version: 6.11.0
- name: Install dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.x'

- name: Setup Python3
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Setup Pipenv
run: python -m pip install pipenv
shell: ${{ runner.os == 'Windows' && 'powershell' || 'bash' }}
- name: Setup Poetry
run: python -m pip install poetry
shell: ${{ runner.os == 'Windows' && 'powershell' || 'bash' }}
- name: Setup Conan
run: |
python -m pip install conan
conan profile detect
shell: ${{ runner.os == 'Windows' && 'powershell' || 'bash' }}
63 changes: 43 additions & 20 deletions .github/workflows/analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,61 @@ on:
tags-ignore:
- '**'
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.ref }}
cancel-in-progress: true
jobs:
Go-Lint:
name: Lint ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu, windows, macos ]
runs-on: ${{ matrix.os }}-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Setup Go with cache
uses: jfrog/.github/actions/install-go-with-cache@main

- name: Run Go vet
run: go vet -v ./...

Static-Check:
runs-on: ubuntu-latest
steps:
- name: Checkout Source
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v3
with:
go-version: 1.22.x
- name: Setup Go with cache
uses: jfrog/.github/actions/install-go-with-cache@main

- name: Static Code Analysis
uses: golangci/golangci-lint-action@v3
with:
args: |
--timeout 5m --out-${NO_FUTURE}format colored-line-number --enable errcheck,gosimple,govet,ineffassign,staticcheck,typecheck,unused,gocritic,asasalint,asciicheck,errchkjson,exportloopref,forcetypeassert,makezero,nilerr,unparam,unconvert,wastedassign,usestdlibvars
- name: Run Go vet
run: go vet -v ./...

- name: Run golangci linter
uses: jfrog/.github/actions/golangci-lint@main

Go-Sec:
runs-on: ubuntu-latest
steps:
- name: Checkout Source
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v3
with:
go-version: 1.22.x
- name: Setup Go with cache
uses: jfrog/.github/actions/install-go-with-cache@main

- name: Run Go-Sec scanner
uses: jfrog/.github/actions/gosec-scanner@main

# Temporarily set version 2.18.0 to workaround https://github.com/securego/gosec/issues/1046
- name: Run Gosec Security Scanner
uses: securego/[email protected]
with:
args: -exclude G204,G301,G302,G304,G306 -tests -exclude-dir \.*test\.* ./...
Check-Spelling:
name: Spell Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Check spelling
uses: crate-ci/typos@master
18 changes: 0 additions & 18 deletions .github/workflows/removeLabel.yml

This file was deleted.

Loading

0 comments on commit 1f67126

Please sign in to comment.