Skip to content

Commit 3a6f531

Browse files
pionbotat-wat
authored andcommittedJan 20, 2023
Update CI configs to v0.10.1
Update lint scripts and CI configs.
1 parent d0f27fe commit 3a6f531

20 files changed

+109
-633
lines changed
 

‎.github/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.goassets

‎.github/fetch-scripts.sh

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/sh
2+
3+
#
4+
# DO NOT EDIT THIS FILE
5+
#
6+
# It is automatically copied from https://github.com/pion/.goassets repository.
7+
#
8+
# If you want to update the shared CI config, send a PR to
9+
# https://github.com/pion/.goassets instead of this repository.
10+
#
11+
12+
set -eu
13+
14+
SCRIPT_PATH="$(realpath "$(dirname "$0")")"
15+
GOASSETS_PATH="${SCRIPT_PATH}/.goassets"
16+
17+
GOASSETS_REF=${GOASSETS_REF:-master}
18+
19+
if [ -d "${GOASSETS_PATH}" ]; then
20+
if ! git -C "${GOASSETS_PATH}" diff --exit-code; then
21+
echo "${GOASSETS_PATH} has uncommitted changes" >&2
22+
exit 1
23+
fi
24+
git -C "${GOASSETS_PATH}" fetch origin
25+
git -C "${GOASSETS_PATH}" checkout ${GOASSETS_REF}
26+
git -C "${GOASSETS_PATH}" reset --hard origin/${GOASSETS_REF}
27+
else
28+
git clone -b ${GOASSETS_REF} https://github.com/pion/.goassets.git "${GOASSETS_PATH}"
29+
fi

‎.github/generate-authors.sh

-69
This file was deleted.

‎.github/hooks/commit-msg.sh

-11
This file was deleted.

‎.github/hooks/pre-commit.sh

-13
This file was deleted.

‎.github/hooks/pre-push.sh

-13
This file was deleted.

‎.github/install-hooks.sh

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/bin/sh
22

33
#
44
# DO NOT EDIT THIS FILE
@@ -9,8 +9,10 @@
99
# https://github.com/pion/.goassets instead of this repository.
1010
#
1111

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

14-
cp "${SCRIPT_PATH}/hooks/commit-msg.sh" "${SCRIPT_PATH}/../.git/hooks/commit-msg"
15-
cp "${SCRIPT_PATH}/hooks/pre-commit.sh" "${SCRIPT_PATH}/../.git/hooks/pre-commit"
16-
cp "${SCRIPT_PATH}/hooks/pre-push.sh" "${SCRIPT_PATH}/../.git/hooks/pre-push"
14+
. ${SCRIPT_PATH}/fetch-scripts.sh
15+
16+
cp "${GOASSETS_PATH}/hooks/commit-msg.sh" "${SCRIPT_PATH}/../.git/hooks/commit-msg"
17+
cp "${GOASSETS_PATH}/hooks/pre-commit.sh" "${SCRIPT_PATH}/../.git/hooks/pre-commit"
18+
cp "${GOASSETS_PATH}/hooks/pre-push.sh" "${SCRIPT_PATH}/../.git/hooks/pre-push"

‎.github/lint-commit-message.sh

-64
This file was deleted.

‎.github/lint-disallowed-functions-in-library.sh

-43
This file was deleted.

‎.github/lint-filename.sh

-24
This file was deleted.

‎.github/lint-no-trailing-newline-in-log-messages.sh

-37
This file was deleted.

‎.github/workflows/codeql-analysis.yml

+13-27
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1-
name: "CodeQL"
1+
#
2+
# DO NOT EDIT THIS FILE
3+
#
4+
# It is automatically copied from https://github.com/pion/.goassets repository.
5+
# If this repository should have package specific CI config,
6+
# remove the repository name from .goassets/.github/workflows/assets-sync.yml.
7+
#
8+
# If you want to update the shared CI config, send a PR to
9+
# https://github.com/pion/.goassets instead of this repository.
10+
#
11+
12+
name: CodeQL
213

314
on:
415
workflow_dispatch:
@@ -12,29 +23,4 @@ on:
1223

1324
jobs:
1425
analyze:
15-
name: Analyze
16-
runs-on: ubuntu-latest
17-
permissions:
18-
actions: read
19-
contents: read
20-
security-events: write
21-
22-
steps:
23-
- name: Checkout repo
24-
uses: actions/checkout@v3
25-
26-
# The code in examples/ might intentionally do things like log credentials
27-
# in order to show how the library is used, aid in debugging etc. We
28-
# should ignore those for CodeQL scanning, and only focus on the package
29-
# itself.
30-
- name: Remove example code
31-
run: |
32-
rm -rf examples/
33-
34-
- name: Initialize CodeQL
35-
uses: github/codeql-action/init@v2
36-
with:
37-
languages: 'go'
38-
39-
- name: CodeQL Analysis
40-
uses: github/codeql-action/analyze@v2
26+
uses: pion/.goassets/.github/workflows/codeql-analysis.reusable.yml@master

‎.github/workflows/generate-authors.yml

+5-61
Original file line numberDiff line numberDiff line change
@@ -9,69 +9,13 @@
99
# https://github.com/pion/.goassets instead of this repository.
1010
#
1111

12-
name: generate-authors
12+
name: Generate Authors
1313

1414
on:
1515
pull_request:
1616

1717
jobs:
18-
checksecret:
19-
permissions:
20-
contents: none
21-
runs-on: ubuntu-latest
22-
outputs:
23-
is_PIONBOT_PRIVATE_KEY_set: ${{ steps.checksecret_job.outputs.is_PIONBOT_PRIVATE_KEY_set }}
24-
steps:
25-
- id: checksecret_job
26-
env:
27-
PIONBOT_PRIVATE_KEY: ${{ secrets.PIONBOT_PRIVATE_KEY }}
28-
run: |
29-
echo "is_PIONBOT_PRIVATE_KEY_set: ${{ env.PIONBOT_PRIVATE_KEY != '' }}"
30-
echo "::set-output name=is_PIONBOT_PRIVATE_KEY_set::${{ env.PIONBOT_PRIVATE_KEY != '' }}"
31-
32-
generate-authors:
33-
permissions:
34-
contents: write
35-
needs: [checksecret]
36-
if: needs.checksecret.outputs.is_PIONBOT_PRIVATE_KEY_set == 'true'
37-
runs-on: ubuntu-latest
38-
steps:
39-
- uses: actions/checkout@v3
40-
with:
41-
ref: ${{ github.head_ref }}
42-
fetch-depth: 0
43-
token: ${{ secrets.PIONBOT_PRIVATE_KEY }}
44-
45-
- name: Generate the authors file
46-
run: .github/generate-authors.sh
47-
48-
- name: Add the authors file to git
49-
run: git add AUTHORS.txt
50-
51-
- name: Get last commit message
52-
id: last-commit-message
53-
run: |
54-
COMMIT_MSG=$(git log -1 --pretty=%B)
55-
COMMIT_MSG="${COMMIT_MSG//'%'/'%25'}"
56-
COMMIT_MSG="${COMMIT_MSG//$'\n'/'%0A'}"
57-
COMMIT_MSG="${COMMIT_MSG//$'\r'/'%0D'}"
58-
echo "::set-output name=msg::$COMMIT_MSG"
59-
60-
- name: Get last commit author
61-
id: last-commit-author
62-
run: |
63-
echo "::set-output name=msg::$(git log -1 --pretty='%aN <%ae>')"
64-
65-
- name: Check if AUTHORS.txt file has changed
66-
id: git-status-output
67-
run: |
68-
echo "::set-output name=msg::$(git status -s | wc -l)"
69-
70-
- name: Commit and push
71-
if: ${{ steps.git-status-output.outputs.msg != '0' }}
72-
run: |
73-
git config user.email $(echo "${{ steps.last-commit-author.outputs.msg }}" | sed 's/\(.\+\) <\(\S\+\)>/\2/')
74-
git config user.name $(echo "${{ steps.last-commit-author.outputs.msg }}" | sed 's/\(.\+\) <\(\S\+\)>/\1/')
75-
git add AUTHORS.txt
76-
git commit --amend --no-edit
77-
git push --force https://github.com/${GITHUB_REPOSITORY} $(git symbolic-ref -q --short HEAD)
18+
generate:
19+
uses: pion/.goassets/.github/workflows/generate-authors.reusable.yml@master
20+
secrets:
21+
token: ${{ secrets.PIONBOT_PRIVATE_KEY }}

‎.github/workflows/lint.yaml

+2-45
Original file line numberDiff line numberDiff line change
@@ -12,50 +12,7 @@
1212
name: Lint
1313
on:
1414
pull_request:
15-
types:
16-
- opened
17-
- edited
18-
- synchronize
19-
20-
permissions:
21-
contents: read
2215

2316
jobs:
24-
lint-commit-message:
25-
name: Metadata
26-
runs-on: ubuntu-latest
27-
strategy:
28-
fail-fast: false
29-
steps:
30-
- uses: actions/checkout@v3
31-
with:
32-
fetch-depth: 0
33-
34-
- name: Commit Message
35-
run: .github/lint-commit-message.sh
36-
37-
- name: File names
38-
run: .github/lint-filename.sh
39-
40-
- name: Functions
41-
run: .github/lint-disallowed-functions-in-library.sh
42-
43-
- name: Logging messages should not have trailing newlines
44-
run: .github/lint-no-trailing-newline-in-log-messages.sh
45-
46-
lint-go:
47-
name: Go
48-
permissions:
49-
contents: read
50-
pull-requests: read
51-
runs-on: ubuntu-latest
52-
strategy:
53-
fail-fast: false
54-
steps:
55-
- uses: actions/checkout@v3
56-
57-
- name: golangci-lint
58-
uses: golangci/golangci-lint-action@v3
59-
with:
60-
version: v1.45.2
61-
args: $GOLANGCI_LINT_EXRA_ARGS
17+
lint:
18+
uses: pion/.goassets/.github/workflows/lint.reusable.yml@master

‎.github/workflows/release.yml

+15-18
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,22 @@
1-
name: release
1+
#
2+
# DO NOT EDIT THIS FILE
3+
#
4+
# It is automatically copied from https://github.com/pion/.goassets repository.
5+
# If this repository should have package specific CI config,
6+
# remove the repository name from .goassets/.github/workflows/assets-sync.yml.
7+
#
8+
# If you want to update the shared CI config, send a PR to
9+
# https://github.com/pion/.goassets instead of this repository.
10+
#
11+
12+
name: Release
213
on:
314
push:
415
tags:
516
- 'v*'
617

718
jobs:
819
release:
9-
permissions:
10-
contents: write
11-
runs-on: ubuntu-latest
12-
steps:
13-
- uses: actions/checkout@v3
14-
with:
15-
fetch-depth: 0
16-
- uses: actions/setup-go@v3
17-
with:
18-
go-version: '1.18' # auto-update/latest-go-version
19-
- name: Build and release
20-
uses: goreleaser/goreleaser-action@v4
21-
with:
22-
version: latest
23-
args: release --rm-dist
24-
env:
25-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
uses: pion/.goassets/.github/workflows/release.reusable.yml@master
21+
with:
22+
go-version: '1.19' # auto-update/latest-go-version

‎.github/workflows/renovate-go-mod-fix.yaml

-36
This file was deleted.
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#
2+
# DO NOT EDIT THIS FILE
3+
#
4+
# It is automatically copied from https://github.com/pion/.goassets repository.
5+
# If this repository should have package specific CI config,
6+
# remove the repository name from .goassets/.github/workflows/assets-sync.yml.
7+
#
8+
# If you want to update the shared CI config, send a PR to
9+
# https://github.com/pion/.goassets instead of this repository.
10+
#
11+
12+
name: Fix go.sum
13+
on:
14+
push:
15+
branches:
16+
- renovate/*
17+
18+
jobs:
19+
fix:
20+
uses: pion/.goassets/.github/workflows/renovate-go-sum-fix.reusable.yml@master
21+
secrets:
22+
token: ${{ secrets.PIONBOT_PRIVATE_KEY }}

‎.github/workflows/test.yaml

+10-143
Original file line numberDiff line numberDiff line change
@@ -13,162 +13,29 @@ name: Test
1313
on:
1414
push:
1515
branches:
16-
- master
16+
- master
1717
pull_request:
18-
branches:
19-
- master
20-
21-
permissions:
22-
contents: read
2318

2419
jobs:
2520
test:
26-
runs-on: ubuntu-latest
21+
uses: pion/.goassets/.github/workflows/test.reusable.yml@master
2722
strategy:
2823
matrix:
2924
go: ['1.19', '1.18'] # auto-update/supported-go-version-list
3025
fail-fast: false
31-
name: Go ${{ matrix.go }}
32-
steps:
33-
- uses: actions/checkout@v3
34-
35-
- uses: actions/cache@v3
36-
with:
37-
path: |
38-
~/go/pkg/mod
39-
~/go/bin
40-
~/.cache
41-
key: ${{ runner.os }}-amd64-go-${{ hashFiles('**/go.sum') }}
42-
restore-keys: |
43-
${{ runner.os }}-amd64-go-
44-
45-
- name: Setup Go
46-
uses: actions/setup-go@v3
47-
with:
48-
go-version: ${{ matrix.go }}
49-
50-
- name: Setup go-acc
51-
run: go install github.com/ory/go-acc@latest
52-
53-
- name: Set up gotestfmt
54-
uses: haveyoudebuggedit/gotestfmt-action@v2
55-
with:
56-
token: ${{ secrets.GITHUB_TOKEN }} # Avoid getting rate limited
57-
58-
- name: Run test
59-
run: |
60-
TEST_BENCH_OPTION="-bench=."
61-
if [ -f .github/.ci.conf ]; then . .github/.ci.conf; fi
62-
63-
set -euo pipefail
64-
go-acc -o cover.out ./... -- \
65-
${TEST_BENCH_OPTION} \
66-
-json \
67-
-v -race 2>&1 | grep -v '^go: downloading' | tee /tmp/gotest.log | gotestfmt
68-
69-
- name: Upload test log
70-
uses: actions/upload-artifact@v3
71-
if: always()
72-
with:
73-
name: test-log-${{ matrix.go }}
74-
path: /tmp/gotest.log
75-
if-no-files-found: error
76-
77-
- name: Run TEST_HOOK
78-
run: |
79-
if [ -f .github/.ci.conf ]; then . .github/.ci.conf; fi
80-
if [ -n "${TEST_HOOK}" ]; then ${TEST_HOOK}; fi
81-
82-
- uses: codecov/codecov-action@v3
83-
with:
84-
name: codecov-umbrella
85-
fail_ci_if_error: true
86-
flags: go
26+
with:
27+
go-version: ${{ matrix.go }}
8728

8829
test-i386:
89-
runs-on: ubuntu-latest
30+
uses: pion/.goassets/.github/workflows/test-i386.reusable.yml@master
9031
strategy:
9132
matrix:
9233
go: ['1.19', '1.18'] # auto-update/supported-go-version-list
9334
fail-fast: false
94-
name: Go i386 ${{ matrix.go }}
95-
steps:
96-
- uses: actions/checkout@v3
97-
98-
- uses: actions/cache@v3
99-
with:
100-
path: |
101-
~/go/pkg/mod
102-
~/.cache
103-
key: ${{ runner.os }}-i386-go-${{ hashFiles('**/go.sum') }}
104-
restore-keys: |
105-
${{ runner.os }}-i386-go-
106-
107-
- name: Run test
108-
run: |
109-
mkdir -p $HOME/go/pkg/mod $HOME/.cache
110-
docker run \
111-
-u $(id -u):$(id -g) \
112-
-e "GO111MODULE=on" \
113-
-e "CGO_ENABLED=0" \
114-
-v $GITHUB_WORKSPACE:/go/src/github.com/pion/$(basename $GITHUB_WORKSPACE) \
115-
-v $HOME/go/pkg/mod:/go/pkg/mod \
116-
-v $HOME/.cache:/.cache \
117-
-w /go/src/github.com/pion/$(basename $GITHUB_WORKSPACE) \
118-
i386/golang:${{matrix.go}}-alpine \
119-
/usr/local/go/bin/go test \
120-
${TEST_EXTRA_ARGS:-} \
121-
-v ./...
35+
with:
36+
go-version: ${{ matrix.go }}
12237

12338
test-wasm:
124-
runs-on: ubuntu-latest
125-
strategy:
126-
fail-fast: false
127-
name: WASM
128-
steps:
129-
- uses: actions/checkout@v3
130-
131-
- name: Use Node.js
132-
uses: actions/setup-node@v3
133-
with:
134-
node-version: '16.x'
135-
136-
- uses: actions/cache@v3
137-
with:
138-
path: |
139-
~/go/pkg/mod
140-
~/.cache
141-
key: ${{ runner.os }}-wasm-go-${{ hashFiles('**/go.sum') }}
142-
restore-keys: |
143-
${{ runner.os }}-wasm-go-
144-
145-
- name: Download Go
146-
run: curl -sSfL https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz | tar -C ~ -xzf -
147-
env:
148-
GO_VERSION: '1.19' # auto-update/latest-go-version
149-
150-
- name: Set Go Root
151-
run: echo "GOROOT=${HOME}/go" >> $GITHUB_ENV
152-
153-
- name: Set Go Path
154-
run: echo "GOPATH=${HOME}/go" >> $GITHUB_ENV
155-
156-
- name: Set Go Path
157-
run: echo "GO_JS_WASM_EXEC=${GOROOT}/misc/wasm/go_js_wasm_exec" >> $GITHUB_ENV
158-
159-
- name: Insall NPM modules
160-
run: yarn install
161-
162-
- name: Run Tests
163-
run: |
164-
if [ -f .github/.ci.conf ]; then . .github/.ci.conf; fi
165-
GOOS=js GOARCH=wasm $GOPATH/bin/go test \
166-
-coverprofile=cover.out -covermode=atomic \
167-
-exec="${GO_JS_WASM_EXEC}" \
168-
-v ./...
169-
170-
- uses: codecov/codecov-action@v3
171-
with:
172-
name: codecov-umbrella
173-
fail_ci_if_error: true
174-
flags: wasm
39+
uses: pion/.goassets/.github/workflows/test-wasm.reusable.yml@master
40+
with:
41+
go-version: '1.19' # auto-update/latest-go-version

‎.github/workflows/tidy-check.yaml

+4-23
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,12 @@
1212
name: Go mod tidy
1313
on:
1414
pull_request:
15-
branches:
16-
- master
1715
push:
1816
branches:
1917
- master
2018

21-
permissions:
22-
contents: read
23-
2419
jobs:
25-
Check:
26-
runs-on: ubuntu-latest
27-
steps:
28-
- name: checkout
29-
uses: actions/checkout@v3
30-
- name: Setup Go
31-
uses: actions/setup-go@v3
32-
with:
33-
go-version: '1.19' # auto-update/latest-go-version
34-
- name: check
35-
run: |
36-
go mod download
37-
go mod tidy
38-
if ! git diff --exit-code
39-
then
40-
echo "Not go mod tidied"
41-
exit 1
42-
fi
20+
tidy:
21+
uses: pion/.goassets/.github/workflows/tidy-check.reusable.yml@master
22+
with:
23+
go-version: '1.19' # auto-update/latest-go-version

‎AUTHORS.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# we would love to have you https://github.com/pion/webrtc/wiki/Contributing
33
#
44
# This file is auto generated, using git to list all individuals contributors.
5-
# see `.github/generate-authors.sh` for the scripting
5+
# see https://github.com/pion/.goassets/blob/master/scripts/generate-authors.sh for the scripting
66
Aleksandr Razumov <ar@gortc.io>
77
alvarowolfx <alvarowolfx@gmail.com>
88
Arlo Breault <arlolra@gmail.com>

0 commit comments

Comments
 (0)
Please sign in to comment.