diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 8a5d2d90..75c0ab87 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -46,7 +46,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/security-build.yml b/.github/workflows/security-build.yml deleted file mode 100644 index a4def677..00000000 --- a/.github/workflows/security-build.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Security Build -on: - push: - branches: - - main # or the name of your main branch - workflow_dispatch: {} - pull_request: - types: [opened, synchronize, reopened] - -jobs: - sonarcloud: - name: SonarCloud - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - - name: SonarCloud Scan - uses: SonarSource/sonarcloud-github-action@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.github/workflows/test-e2e.yml b/.github/workflows/test-e2e.yml index fad10c79..670ce8b3 100644 --- a/.github/workflows/test-e2e.yml +++ b/.github/workflows/test-e2e.yml @@ -20,7 +20,7 @@ jobs: uses: actions/checkout@v4 - name: Install Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v5 with: go-version: ${{ matrix.go-version }} env: diff --git a/.github/workflows/test-resequence.yml b/.github/workflows/test-resequence.yml index 3e34cd63..9ac51af0 100644 --- a/.github/workflows/test-resequence.yml +++ b/.github/workflows/test-resequence.yml @@ -94,7 +94,7 @@ jobs: - name: Upload logs if: always() - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: logs_${{ github.run_id }} path: ./kurtosis-cdk/ci_logs diff --git a/.github/workflows/test-unit.yml b/.github/workflows/test-unit.yml new file mode 100644 index 00000000..66cfc010 --- /dev/null +++ b/.github/workflows/test-unit.yml @@ -0,0 +1,40 @@ +name: Test Unit and SonarCloud analysis + +on: + push: + branches: + - main + - develop + - 'release/**' + pull_request: + workflow_dispatch: {} + +jobs: + test-unit: + strategy: + fail-fast: false + matrix: + go-version: [1.22.4] + goarch: ["amd64"] + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + + - name: Install Go + uses: actions/setup-go@v5 + with: + go-version: ${{ matrix.go-version }} + env: + GOARCH: ${{ matrix.goarch }} + + - name: Test + run: make test-unit + + - name: Analyze with SonarCloud + uses: sonarsource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/test-unittest.yml b/.github/workflows/test-unittest.yml deleted file mode 100644 index 156a0144..00000000 --- a/.github/workflows/test-unittest.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Test Unittest -on: - push: - branches: - - '**' - workflow_dispatch: {} - - -jobs: - test-unittest: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Install Go - uses: actions/setup-go@v3 - - - name: Launch unittest - run: make test \ No newline at end of file diff --git a/Makefile b/Makefile index 256509bc..fa71f98a 100644 --- a/Makefile +++ b/Makefile @@ -80,9 +80,9 @@ build-docker-nc: ## Builds a docker image with the cdk binary - but without buil stop: ## Stops all services docker-compose down -.PHONY: test -test: - trap '$(STOP)' EXIT; MallocNanoZone=0 go test -count=1 -short -race -p 1 -covermode=atomic -coverprofile=../coverage.out -coverpkg ./... -timeout 200s ./... +.PHONY: test-unit +test-unit: + trap '$(STOP)' EXIT; MallocNanoZone=0 go test -count=1 -short -race -p 1 -covermode=atomic -coverprofile=coverage.out -coverpkg ./... -timeout 200s ./... .PHONY: test-seq_sender test-seq_sender: