Compare commits
3 Commits
a557f452a7
...
5d197234fd
Author | SHA1 | Date |
---|---|---|
github-actions[bot] | 5d197234fd | |
Oskar | 1cb931d9ef | |
Oskar | df1b532e2a |
|
@ -0,0 +1,45 @@
|
||||||
|
|
||||||
|
name: "CodeQL"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
|
||||||
|
schedule:
|
||||||
|
- cron: '42 7 * * 0'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
analyze:
|
||||||
|
name: Analyze
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
actions: read
|
||||||
|
contents: read
|
||||||
|
security-events: write
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
language: [ 'go' ]
|
||||||
|
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
|
||||||
|
# Learn more:
|
||||||
|
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Clone repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Initialize CodeQL
|
||||||
|
uses: github/codeql-action/init@v1
|
||||||
|
with:
|
||||||
|
languages: ${{ matrix.language }}
|
||||||
|
|
||||||
|
- name: Autobuild
|
||||||
|
uses: github/codeql-action/autobuild@v1
|
||||||
|
|
||||||
|
- name: Perform CodeQL Analysis
|
||||||
|
uses: github/codeql-action/analyze@v1
|
|
@ -0,0 +1,12 @@
|
||||||
|
package common
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestCheckUptime(T *testing.T) {
|
||||||
|
uptime := Uptime(time.Date(2016, 6, 2, 1, 1, 1, 1, time.UTC))
|
||||||
|
fmt.Println(uptime)
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package stats
|
||||||
|
|
||||||
|
import "testing"
|
||||||
|
|
||||||
|
func TestCPU(t *testing.T) {
|
||||||
|
_, err := CPU()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
package stats
|
||||||
|
|
||||||
|
import "testing"
|
||||||
|
|
||||||
|
func TestMemory(t *testing.T) {
|
||||||
|
Memory()
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package utils
|
||||||
|
|
||||||
|
import "testing"
|
||||||
|
|
||||||
|
func TestBytes(t *testing.T) {
|
||||||
|
// 1
|
||||||
|
r := Bytes(53)
|
||||||
|
if r != "53 B" {
|
||||||
|
t.Fatal(r)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2
|
||||||
|
r = Bytes(1522)
|
||||||
|
if r != "1.5 kB" {
|
||||||
|
t.Fatal(r)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue