Skip to content

Commit

Permalink
ci: add TiCS static code analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
cjdcordeiro committed Jan 17, 2025
1 parent c76dbed commit 9810f4d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 62 deletions.
30 changes: 0 additions & 30 deletions .github/actions/build-chisel/action.yml

This file was deleted.

19 changes: 17 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,28 @@ jobs:
with:
go-version-file: 'go.mod'

- uses: ./.github/actions/build-chisel/
name: Build Chisel for linux/${{ matrix.arch }}
- name: Build Chisel for linux/${{ matrix.arch }}
id: build
env:
GOOS: "linux"
GOARCH: ${{ matrix.arch }}
CGO_ENABLED: "0"
run: |
echo "Generating version file"
go generate ./cmd/
echo "Building for $GOOS $GOARCH"
go build -trimpath -ldflags='-s -w' ./cmd/chisel
# Get version via "chisel version" to ensure it matches that exactly
CHISEL_VERSION=$(GOOS=linux GOARCH=amd64 go run ./cmd/chisel version)
echo "Version: $CHISEL_VERSION"
# Version should not be "unknown"
[ "$CHISEL_VERSION" != "unknown" ] || exit 1
# Share variables with subsequent steps
echo "CHISEL_VERSION=${CHISEL_VERSION}" >>$GITHUB_OUTPUT
- name: Test if is executable
run: test -x ./chisel
Expand Down
34 changes: 5 additions & 29 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
name: Tests

on:
workflow_call:
inputs:
repository:
description: 'Repository name (with owner) to clone'
required: true
type: string
ref:
description: 'The branch, tag or SHA to checkout'
required: true
type: string
outputs:
test-coverage-file:
description: 'The name of the coverage report file'
value: ${{ jobs.unit-tests.outputs.test-coverage-file }}
test-coverage-artifact:
description: 'The name used to upload the coverage file as a GH artifact'
value: ${{ jobs.unit-tests.outputs.test-coverage-artifact }}
workflow_dispatch:
push:
paths-ignore:
Expand All @@ -31,16 +14,9 @@ jobs:
name: Unit Tests
env:
TEST_COVERAGE_FILE: test-coverage.out
TEST_COVERAGE_ARTIFACT: chisel-test-coverage
TEST_COVERAGE_HTML_FILE: test-coverage.html
outputs:
test-coverage-file: ${{ env.TEST_COVERAGE_FILE }}
test-coverage-artifact: ${{ env.TEST_COVERAGE_ARTIFACT }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'workflow_call' && inputs.ref || '' }}
repository: ${{ github.event_name == 'workflow_call' && inputs.repository || '' }}
- uses: actions/checkout@v3

- uses: actions/setup-go@v3
with:
Expand All @@ -60,13 +36,13 @@ jobs:
-o=${TEST_COVERAGE_HTML_FILE}
fi
- name: Upload test coverage
uses: actions/upload-artifact@v4
- name: Upload HTML test coverage
uses: actions/upload-artifact@v3
if: always()
continue-on-error: true
with:
name: ${{ env.TEST_COVERAGE_ARTIFACT }}
path: ./test-coverage*
name: chisel-test-coverage.html
path: ./*.html

real-archive-tests:
# Do not change to newer releases as "fips" may not be available there.
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/tics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ jobs:
codetype: 'TESTCODE'
project: ${{ env.TICSPROJECT }}
filelist: ${{ env.TICS_FILELIST }}
branchname: ${{ github.head_ref }}
viewerUrl: 'https://canonical.tiobe.com/tiobeweb/TICS/api/cfg?name=default'
displayUrl: 'https://canonical.tiobe.com/tiobeweb/TICS'
ticsAuthToken: ${{ secrets.TICSAUTHTOKEN }}
Expand Down

0 comments on commit 9810f4d

Please sign in to comment.