Skip to content

Commit 9810f4d

Browse files
committed
ci: add TiCS static code analysis
1 parent c76dbed commit 9810f4d

File tree

4 files changed

+22
-62
lines changed

4 files changed

+22
-62
lines changed

.github/actions/build-chisel/action.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,28 @@ jobs:
5151
with:
5252
go-version-file: 'go.mod'
5353

54-
- uses: ./.github/actions/build-chisel/
55-
name: Build Chisel for linux/${{ matrix.arch }}
54+
- name: Build Chisel for linux/${{ matrix.arch }}
5655
id: build
5756
env:
5857
GOOS: "linux"
5958
GOARCH: ${{ matrix.arch }}
6059
CGO_ENABLED: "0"
60+
run: |
61+
echo "Generating version file"
62+
go generate ./cmd/
63+
64+
echo "Building for $GOOS $GOARCH"
65+
go build -trimpath -ldflags='-s -w' ./cmd/chisel
66+
67+
# Get version via "chisel version" to ensure it matches that exactly
68+
CHISEL_VERSION=$(GOOS=linux GOARCH=amd64 go run ./cmd/chisel version)
69+
echo "Version: $CHISEL_VERSION"
70+
71+
# Version should not be "unknown"
72+
[ "$CHISEL_VERSION" != "unknown" ] || exit 1
73+
74+
# Share variables with subsequent steps
75+
echo "CHISEL_VERSION=${CHISEL_VERSION}" >>$GITHUB_OUTPUT
6176
6277
- name: Test if is executable
6378
run: test -x ./chisel

.github/workflows/tests.yaml

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,6 @@
11
name: Tests
22

33
on:
4-
workflow_call:
5-
inputs:
6-
repository:
7-
description: 'Repository name (with owner) to clone'
8-
required: true
9-
type: string
10-
ref:
11-
description: 'The branch, tag or SHA to checkout'
12-
required: true
13-
type: string
14-
outputs:
15-
test-coverage-file:
16-
description: 'The name of the coverage report file'
17-
value: ${{ jobs.unit-tests.outputs.test-coverage-file }}
18-
test-coverage-artifact:
19-
description: 'The name used to upload the coverage file as a GH artifact'
20-
value: ${{ jobs.unit-tests.outputs.test-coverage-artifact }}
214
workflow_dispatch:
225
push:
236
paths-ignore:
@@ -31,16 +14,9 @@ jobs:
3114
name: Unit Tests
3215
env:
3316
TEST_COVERAGE_FILE: test-coverage.out
34-
TEST_COVERAGE_ARTIFACT: chisel-test-coverage
3517
TEST_COVERAGE_HTML_FILE: test-coverage.html
36-
outputs:
37-
test-coverage-file: ${{ env.TEST_COVERAGE_FILE }}
38-
test-coverage-artifact: ${{ env.TEST_COVERAGE_ARTIFACT }}
3918
steps:
40-
- uses: actions/checkout@v4
41-
with:
42-
ref: ${{ github.event_name == 'workflow_call' && inputs.ref || '' }}
43-
repository: ${{ github.event_name == 'workflow_call' && inputs.repository || '' }}
19+
- uses: actions/checkout@v3
4420

4521
- uses: actions/setup-go@v3
4622
with:
@@ -60,13 +36,13 @@ jobs:
6036
-o=${TEST_COVERAGE_HTML_FILE}
6137
fi
6238
63-
- name: Upload test coverage
64-
uses: actions/upload-artifact@v4
39+
- name: Upload HTML test coverage
40+
uses: actions/upload-artifact@v3
6541
if: always()
6642
continue-on-error: true
6743
with:
68-
name: ${{ env.TEST_COVERAGE_ARTIFACT }}
69-
path: ./test-coverage*
44+
name: chisel-test-coverage.html
45+
path: ./*.html
7046

7147
real-archive-tests:
7248
# Do not change to newer releases as "fips" may not be available there.

.github/workflows/tics.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ jobs:
9292
codetype: 'TESTCODE'
9393
project: ${{ env.TICSPROJECT }}
9494
filelist: ${{ env.TICS_FILELIST }}
95-
branchname: ${{ github.head_ref }}
9695
viewerUrl: 'https://canonical.tiobe.com/tiobeweb/TICS/api/cfg?name=default'
9796
displayUrl: 'https://canonical.tiobe.com/tiobeweb/TICS'
9897
ticsAuthToken: ${{ secrets.TICSAUTHTOKEN }}

0 commit comments

Comments
 (0)