Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tics tester #12

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 111 additions & 0 deletions .github/workflows/tics.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: TiCS

on:
workflow_dispatch:
push:
branches: [main]
# Running on pull_request_target instead of pull_request because this workflow
# uses secrets, and thus we need to ensure it runs under this project's code base.
pull_request_target:
branches: [main]
schedule:
- cron: '0 10 * * *'

jobs:
set-project:
# This is needed because pull_request_target events will run workflows in
# the context of the base repository (the repository receiving the pull request).
#
# This means that, for such events, we need to explicitly tell the job to
# "action/checkout" the forked repository/ref (aka source of the PR).
name: Set project environment
runs-on: ubuntu-latest
outputs:
ref: ${{ steps.get-ref.outputs.ref }}
repo: ${{ steps.get-repo.outputs.repo }}
steps:
- id: get-ref
run: echo "ref=${{ github.event_name == 'pull_request_target' && github.head_ref || '' }}" >> $GITHUB_OUTPUT

- id: get-repo
run: echo "repo=${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name || '' }}" >> $GITHUB_OUTPUT

tics-static-code-analysis:
runs-on: ubuntu-24.04
name: TiCS Static Code Analysis
needs: [set-project]
permissions:
pull-requests: write
env:
TICS_FILELIST: tics-filelist
TICSPROJECT: chisel
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.set-project.outputs.ref }}
repository: ${{ needs.set-project.outputs.repo }}

- name: Check changed paths in PR
id: changed-paths
if: github.event_name == 'pull_request_target'
uses: dorny/paths-filter@v3
with:
filters: |
any:
- "**/*"
list-files: csv

- id: get-filelist
name: List of files to analyze
run: |
if [[ "${{ github.event_name }}" == "pull_request_target" ]]
then
echo "${{ steps.changed-paths.outputs.any_files }}" | tr "," "\n" > ${TICS_FILELIST}
else
echo "." > ${TICS_FILELIST}
fi

- uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'

- name: Install dependencies
run: |
go install honnef.co/go/tools/cmd/[email protected]
go install github.com/axw/gocov/[email protected]
go install github.com/AlekSi/[email protected]

# We could store a report from the "tests" run, but this is cheap to do and keeps this isolated.
- name: Test and generate coverage report
run: |
go test -coverprofile=coverage.out ./...
gocov convert coverage.out > coverage.json
# The coverage.xml file needs to be in a .coverage folder.
mkdir .coverage
gocov-xml < coverage.json > .coverage/coverage.xml

- name: Run TiCS client analysis
uses: tiobe/tics-github-action@v3
if: github.event_name == 'pull_request_target'
with:
mode: 'client'
project: ${{ env.TICSPROJECT }}
filelist: ${{ env.TICS_FILELIST }}
viewerUrl: 'https://canonical.tiobe.com/tiobeweb/TICS/api/cfg?name=default'
displayUrl: 'https://canonical.tiobe.com/tiobeweb/TICS'
ticsAuthToken: ${{ secrets.TICSAUTHTOKEN }}
installTics: true

- name: Run TiCS server analysis
uses: tiobe/tics-github-action@v3
if: github.event_name != 'pull_request_target'
with:
mode: 'qserver'
codetype: 'PRODUCTION'
project: ${{ env.TICSPROJECT }}
branchdir: .
filelist: ${{ env.TICS_FILELIST }}
viewerUrl: 'https://canonical.tiobe.com/tiobeweb/TICS/api/cfg?name=default'
displayUrl: 'https://canonical.tiobe.com/tiobeweb/TICS'
ticsAuthToken: ${{ secrets.TICSAUTHTOKEN }}
installTics: true
1 change: 1 addition & 0 deletions internal/fsutil/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type createTest struct {
error string
}

// touch
var createTests = []createTest{{
summary: "Create a file and its parent directory",
options: fsutil.CreateOptions{
Expand Down
1 change: 1 addition & 0 deletions internal/fsutil/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ func (s *S) SetUpTest(c *C) {
fsutil.SetLogger(c)
}

// touch
func (s *S) TearDownTest(c *C) {
fsutil.SetDebug(false)
fsutil.SetLogger(nil)
Expand Down
1 change: 1 addition & 0 deletions internal/jsonwall/jsonwall.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
// }
package jsonwall

//touch
import (
"bytes"
"encoding/json"
Expand Down
1 change: 1 addition & 0 deletions internal/pgputil/openpgp.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"golang.org/x/crypto/openpgp/packet"
)

// touch
// DecodeKeys decodes public and private key packets from armored data.
func DecodeKeys(armoredData []byte) (pubKeys []*packet.PublicKey, privKeys []*packet.PrivateKey, err error) {
block, err := armor.Decode(bytes.NewReader(armoredData))
Expand Down
2 changes: 2 additions & 0 deletions internal/strdist/export_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package strdist

var GlobCost = globCost

//touch
1 change: 1 addition & 0 deletions internal/strdist/strdist.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ func (cv CostInt) String() string {
return fmt.Sprint(int64(cv))
}

// touch
const Inhibit = 1<<63 - 1

type Cost struct {
Expand Down
Loading