Skip to content

Commit

Permalink
Update CI configs to v0.10.7
Browse files Browse the repository at this point in the history
Update lint scripts and CI configs.
  • Loading branch information
pionbot authored and Sean-Der committed Jun 14, 2023
1 parent 6138672 commit 37af8d4
Show file tree
Hide file tree
Showing 16 changed files with 193 additions and 71 deletions.
4 changes: 4 additions & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
# SPDX-License-Identifier: MIT

.goassets
31 changes: 31 additions & 0 deletions .github/fetch-scripts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh

#
# DO NOT EDIT THIS FILE
#
# It is automatically copied from https://github.com/pion/.goassets repository.
#
# If you want to update the shared CI config, send a PR to
# https://github.com/pion/.goassets instead of this repository.
#
# SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
# SPDX-License-Identifier: MIT

set -eu

SCRIPT_PATH="$(realpath "$(dirname "$0")")"
GOASSETS_PATH="${SCRIPT_PATH}/.goassets"

GOASSETS_REF=${GOASSETS_REF:-master}

if [ -d "${GOASSETS_PATH}" ]; then
if ! git -C "${GOASSETS_PATH}" diff --exit-code; then
echo "${GOASSETS_PATH} has uncommitted changes" >&2
exit 1
fi
git -C "${GOASSETS_PATH}" fetch origin
git -C "${GOASSETS_PATH}" checkout ${GOASSETS_REF}
git -C "${GOASSETS_PATH}" reset --hard origin/${GOASSETS_REF}
else
git clone -b ${GOASSETS_REF} https://github.com/pion/.goassets.git "${GOASSETS_PATH}"
fi
2 changes: 2 additions & 0 deletions .github/install-hooks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
# If you want to update the shared CI config, send a PR to
# https://github.com/pion/.goassets instead of this repository.
#
# SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
# SPDX-License-Identifier: MIT

SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )

Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#
# DO NOT EDIT THIS FILE
#
# It is automatically copied from https://github.com/pion/.goassets repository.
# If this repository should have package specific CI config,
# remove the repository name from .goassets/.github/workflows/assets-sync.yml.
#
# If you want to update the shared CI config, send a PR to
# https://github.com/pion/.goassets instead of this repository.
#
# SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
# SPDX-License-Identifier: MIT

name: CodeQL

on:
workflow_dispatch:
schedule:
- cron: '23 5 * * 0'
pull_request:
branches:
- master
paths:
- '**.go'

jobs:
analyze:
uses: pion/.goassets/.github/workflows/codeql-analysis.reusable.yml@master
2 changes: 2 additions & 0 deletions .github/workflows/generate-authors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
# If you want to update the shared CI config, send a PR to
# https://github.com/pion/.goassets instead of this repository.
#
# SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
# SPDX-License-Identifier: MIT

name: generate-authors

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
# If you want to update the shared CI config, send a PR to
# https://github.com/pion/.goassets instead of this repository.
#
# SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
# SPDX-License-Identifier: MIT

name: Lint
on:
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# DO NOT EDIT THIS FILE
#
# It is automatically copied from https://github.com/pion/.goassets repository.
# If this repository should have package specific CI config,
# remove the repository name from .goassets/.github/workflows/assets-sync.yml.
#
# If you want to update the shared CI config, send a PR to
# https://github.com/pion/.goassets instead of this repository.
#
# SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
# SPDX-License-Identifier: MIT

name: Release
on:
push:
tags:
- 'v*'

jobs:
release:
uses: pion/.goassets/.github/workflows/release.reusable.yml@master
with:
go-version: '1.20' # auto-update/latest-go-version
24 changes: 24 additions & 0 deletions .github/workflows/renovate-go-sum-fix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# DO NOT EDIT THIS FILE
#
# It is automatically copied from https://github.com/pion/.goassets repository.
# If this repository should have package specific CI config,
# remove the repository name from .goassets/.github/workflows/assets-sync.yml.
#
# If you want to update the shared CI config, send a PR to
# https://github.com/pion/.goassets instead of this repository.
#
# SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
# SPDX-License-Identifier: MIT

name: Fix go.sum
on:
push:
branches:
- renovate/*

jobs:
fix:
uses: pion/.goassets/.github/workflows/renovate-go-sum-fix.reusable.yml@master
secrets:
token: ${{ secrets.PIONBOT_PRIVATE_KEY }}
22 changes: 22 additions & 0 deletions .github/workflows/reuse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#
# DO NOT EDIT THIS FILE
#
# It is automatically copied from https://github.com/pion/.goassets repository.
# If this repository should have package specific CI config,
# remove the repository name from .goassets/.github/workflows/assets-sync.yml.
#
# If you want to update the shared CI config, send a PR to
# https://github.com/pion/.goassets instead of this repository.
#
# SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
# SPDX-License-Identifier: MIT

name: REUSE Compliance Check

on:
push:
pull_request:

jobs:
lint:
uses: pion/.goassets/.github/workflows/reuse.reusable.yml@master
60 changes: 7 additions & 53 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
# If you want to update the shared CI config, send a PR to
# https://github.com/pion/.goassets instead of this repository.
#
# SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
# SPDX-License-Identifier: MIT

name: Test
on:
Expand All @@ -22,7 +24,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go: ["1.16", "1.17"]
go: ['1.20', '1.19'] # auto-update/supported-go-version-list
fail-fast: false
name: Go ${{ matrix.go }}
steps:
Expand Down Expand Up @@ -87,7 +89,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go: ["1.16", "1.17"]
go: ['1.20', '1.19'] # auto-update/supported-go-version-list
fail-fast: false
name: Go i386 ${{ matrix.go }}
steps:
Expand Down Expand Up @@ -119,54 +121,6 @@ jobs:
-v ./...
test-wasm:
runs-on: ubuntu-latest
strategy:
fail-fast: false
name: WASM
steps:
- uses: actions/checkout@v3

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '16.x'

- uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache
key: ${{ runner.os }}-wasm-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-wasm-go-
- name: Download Go
run: curl -sSfL https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz | tar -C ~ -xzf -
env:
GO_VERSION: 1.17

- name: Set Go Root
run: echo "GOROOT=${HOME}/go" >> $GITHUB_ENV

- name: Set Go Path
run: echo "GOPATH=${HOME}/go" >> $GITHUB_ENV

- name: Set Go Path
run: echo "GO_JS_WASM_EXEC=${GOROOT}/misc/wasm/go_js_wasm_exec" >> $GITHUB_ENV

- name: Insall NPM modules
run: yarn install

- name: Run Tests
run: |
if [ -f .github/.ci.conf ]; then . .github/.ci.conf; fi
GOOS=js GOARCH=wasm $GOPATH/bin/go test \
-coverprofile=cover.out -covermode=atomic \
-exec="${GO_JS_WASM_EXEC}" \
-v ./...
- uses: codecov/codecov-action@v2
with:
name: codecov-umbrella
fail_ci_if_error: true
flags: wasm
uses: pion/.goassets/.github/workflows/test-wasm.reusable.yml@master
with:
go-version: '1.20' # auto-update/latest-go-version
22 changes: 6 additions & 16 deletions .github/workflows/tidy-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
# If you want to update the shared CI config, send a PR to
# https://github.com/pion/.goassets instead of this repository.
#
# SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
# SPDX-License-Identifier: MIT

name: Go mod tidy
on:
Expand All @@ -19,19 +21,7 @@ on:
- master

jobs:
Check:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
- name: check
run: |
go mod download
go mod tidy
if ! git diff --exit-code
then
echo "Not go mod tidied"
exit 1
fi
tidy:
uses: pion/.goassets/.github/workflows/tidy-check.reusable.yml@master
with:
go-version: '1.20' # auto-update/latest-go-version
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
# SPDX-License-Identifier: MIT

### JetBrains IDE ###
#####################
.idea/
Expand Down
26 changes: 24 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
# SPDX-License-Identifier: MIT

linters-settings:
govet:
check-shadowing: true
Expand All @@ -10,7 +13,15 @@ linters-settings:
modules:
- github.com/pkg/errors:
recommendations:
- errors
- errors
forbidigo:
forbid:
- Fatal(f|ln)?$
- ^fmt.Print(f|ln)?$
- ^log.Print(f|ln)?$
- ^os.Exit$
- ^panic$
- ^print(ln)?$

linters:
enable:
Expand All @@ -30,6 +41,7 @@ linters:
- errorlint # errorlint is a linter for that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13.
- exhaustive # check exhaustiveness of enum switch statements
- exportloopref # checks for pointers to enclosing loop variables
- forbidigo # Forbids identifiers
- forcetypeassert # finds forced type assertions
- gci # Gci control golang package import order and make it always deterministic.
- gochecknoglobals # Checks that no globals are present in Go code
Expand Down Expand Up @@ -76,7 +88,6 @@ linters:
- containedctx # containedctx is a linter that detects struct contained context.Context field
- cyclop # checks function and package cyclomatic complexity
- exhaustivestruct # Checks if all struct's fields are initialized
- forbidigo # Forbids identifiers
- funlen # Tool for detection of long functions
- gocyclo # Computes and checks the cyclomatic complexity of functions
- godot # Check if comments end in a period
Expand Down Expand Up @@ -108,12 +119,23 @@ issues:
- path: _test\.go
linters:
- gocognit
- forbidigo

# Allow complex main function in examples
- path: examples
text: "of func `main` is high"
linters:
- gocognit

# Allow forbidden identifiers in examples
- path: examples
linters:
- forbidigo

# Allow forbidden identifiers in CLI commands
- path: cmd
linters:
- forbidigo

run:
skip-dirs-use-default: false
5 changes: 5 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
# SPDX-License-Identifier: MIT

builds:
- skip: true
7 changes: 7 additions & 0 deletions .reuse/dep5
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: Pion
Source: https://github.com/pion/

Files: README.md AUTHORS.txt renovate.json
Copyright: 2023 The Pion community <https://pion.ly>
License: MIT
2 changes: 2 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#
# It is automatically copied from https://github.com/pion/.goassets repository.
#
# SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
# SPDX-License-Identifier: MIT

coverage:
status:
Expand Down

0 comments on commit 37af8d4

Please sign in to comment.