From 3a6f531e33a76192a5fd31a229f12dbe458ede26 Mon Sep 17 00:00:00 2001 From: Pion <59523206+pionbot@users.noreply.github.com> Date: Fri, 20 Jan 2023 01:47:25 +0000 Subject: [PATCH] Update CI configs to v0.10.1 Update lint scripts and CI configs. --- .github/.gitignore | 1 + .github/fetch-scripts.sh | 29 ++++ .github/generate-authors.sh | 69 -------- .github/hooks/commit-msg.sh | 11 -- .github/hooks/pre-commit.sh | 13 -- .github/hooks/pre-push.sh | 13 -- .github/install-hooks.sh | 12 +- .github/lint-commit-message.sh | 64 -------- .../lint-disallowed-functions-in-library.sh | 43 ----- .github/lint-filename.sh | 24 --- ...int-no-trailing-newline-in-log-messages.sh | 37 ----- .github/workflows/codeql-analysis.yml | 40 ++--- .github/workflows/generate-authors.yml | 66 +------- .github/workflows/lint.yaml | 47 +----- .github/workflows/release.yml | 33 ++-- .github/workflows/renovate-go-mod-fix.yaml | 36 ----- .github/workflows/renovate-go-sum-fix.yaml | 22 +++ .github/workflows/test.yaml | 153 ++---------------- .github/workflows/tidy-check.yaml | 27 +--- AUTHORS.txt | 2 +- 20 files changed, 109 insertions(+), 633 deletions(-) create mode 100644 .github/.gitignore create mode 100755 .github/fetch-scripts.sh delete mode 100755 .github/generate-authors.sh delete mode 100755 .github/hooks/commit-msg.sh delete mode 100755 .github/hooks/pre-commit.sh delete mode 100755 .github/hooks/pre-push.sh delete mode 100755 .github/lint-commit-message.sh delete mode 100755 .github/lint-disallowed-functions-in-library.sh delete mode 100755 .github/lint-filename.sh delete mode 100755 .github/lint-no-trailing-newline-in-log-messages.sh delete mode 100644 .github/workflows/renovate-go-mod-fix.yaml create mode 100644 .github/workflows/renovate-go-sum-fix.yaml diff --git a/.github/.gitignore b/.github/.gitignore new file mode 100644 index 000000000..44d7f86aa --- /dev/null +++ b/.github/.gitignore @@ -0,0 +1 @@ +.goassets diff --git a/.github/fetch-scripts.sh b/.github/fetch-scripts.sh new file mode 100755 index 000000000..d7e848b31 --- /dev/null +++ b/.github/fetch-scripts.sh @@ -0,0 +1,29 @@ +#!/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. +# + +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 diff --git a/.github/generate-authors.sh b/.github/generate-authors.sh deleted file mode 100755 index 5468af80f..000000000 --- a/.github/generate-authors.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env bash - -# -# 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. -# - -set -e - -SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) -if [ -z "${AUTHORS_PATH}" ]; then - AUTHORS_PATH="$GITHUB_WORKSPACE/AUTHORS.txt" -fi - -if [ -f ${SCRIPT_PATH}/.ci.conf ]; then - . ${SCRIPT_PATH}/.ci.conf -fi - -# -# DO NOT EDIT THIS -# -EXCLUDED_CONTRIBUTORS+=('John R. Bradley' 'renovate[bot]' 'Renovate Bot' 'Pion Bot' 'pionbot') -# If you want to exclude a name from all repositories, send a PR to -# https://github.com/pion/.goassets instead of this repository. -# If you want to exclude a name only from this repository, -# add EXCLUDED_CONTRIBUTORS=('name') to .github/.ci.conf - -CONTRIBUTORS=() - -shouldBeIncluded () { - for i in "${EXCLUDED_CONTRIBUTORS[@]}"; do - if [[ $1 =~ "$i" ]]; then - return 1 - fi - done - return 0 -} - - -IFS=$'\n' #Only split on newline -for CONTRIBUTOR in $( - ( - git log --format='%aN <%aE>' - git log --format='%(trailers:key=Co-authored-by)' | sed -n 's/^[^:]*:\s*//p' - ) | LC_ALL=C.UTF-8 sort -uf -); do - if shouldBeIncluded ${CONTRIBUTOR}; then - CONTRIBUTORS+=("${CONTRIBUTOR}") - fi -done -unset IFS - -if [ ${#CONTRIBUTORS[@]} -ne 0 ]; then - cat >${AUTHORS_PATH} <<-'EOH' -# Thank you to everyone that made Pion possible. If you are interested in contributing -# we would love to have you https://github.com/pion/webrtc/wiki/Contributing -# -# This file is auto generated, using git to list all individuals contributors. -# see `.github/generate-authors.sh` for the scripting -EOH - for i in "${CONTRIBUTORS[@]}"; do - echo "$i" >> ${AUTHORS_PATH} - done - exit 0 -fi diff --git a/.github/hooks/commit-msg.sh b/.github/hooks/commit-msg.sh deleted file mode 100755 index 8213dc20c..000000000 --- a/.github/hooks/commit-msg.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -# -# DO NOT EDIT THIS FILE DIRECTLY -# -# It is automatically copied from https://github.com/pion/.goassets repository. -# - -set -e - -.github/lint-commit-message.sh $1 diff --git a/.github/hooks/pre-commit.sh b/.github/hooks/pre-commit.sh deleted file mode 100755 index d5a1ce5ce..000000000 --- a/.github/hooks/pre-commit.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -# -# DO NOT EDIT THIS FILE DIRECTLY -# -# It is automatically copied from https://github.com/pion/.goassets repository. -# - -# Redirect output to stderr. -exec 1>&2 - -.github/lint-disallowed-functions-in-library.sh -.github/lint-no-trailing-newline-in-log-messages.sh diff --git a/.github/hooks/pre-push.sh b/.github/hooks/pre-push.sh deleted file mode 100755 index bfe65bc50..000000000 --- a/.github/hooks/pre-push.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -# -# DO NOT EDIT THIS FILE DIRECTLY -# -# It is automatically copied from https://github.com/pion/.goassets repository. -# - -set -e - -.github/generate-authors.sh - -exit 0 diff --git a/.github/install-hooks.sh b/.github/install-hooks.sh index cd899d4f6..57b77988a 100755 --- a/.github/install-hooks.sh +++ b/.github/install-hooks.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # DO NOT EDIT THIS FILE @@ -9,8 +9,10 @@ # https://github.com/pion/.goassets instead of this repository. # -SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) +SCRIPT_PATH="$(realpath "$(dirname "$0")")" -cp "${SCRIPT_PATH}/hooks/commit-msg.sh" "${SCRIPT_PATH}/../.git/hooks/commit-msg" -cp "${SCRIPT_PATH}/hooks/pre-commit.sh" "${SCRIPT_PATH}/../.git/hooks/pre-commit" -cp "${SCRIPT_PATH}/hooks/pre-push.sh" "${SCRIPT_PATH}/../.git/hooks/pre-push" +. ${SCRIPT_PATH}/fetch-scripts.sh + +cp "${GOASSETS_PATH}/hooks/commit-msg.sh" "${SCRIPT_PATH}/../.git/hooks/commit-msg" +cp "${GOASSETS_PATH}/hooks/pre-commit.sh" "${SCRIPT_PATH}/../.git/hooks/pre-commit" +cp "${GOASSETS_PATH}/hooks/pre-push.sh" "${SCRIPT_PATH}/../.git/hooks/pre-push" diff --git a/.github/lint-commit-message.sh b/.github/lint-commit-message.sh deleted file mode 100755 index 2beb31d71..000000000 --- a/.github/lint-commit-message.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env bash - -# -# 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. -# - -set -e - -display_commit_message_error() { -cat << EndOfMessage -$1 - -------------------------------------------------- -The preceding commit message is invalid -it failed '$2' of the following checks - -* Separate subject from body with a blank line -* Limit the subject line to 50 characters -* Capitalize the subject line -* Do not end the subject line with a period -* Wrap the body at 72 characters -EndOfMessage - - exit 1 -} - -lint_commit_message() { - if [[ "$(echo "$1" | awk 'NR == 2 {print $1;}' | wc -c)" -ne 1 ]]; then - display_commit_message_error "$1" 'Separate subject from body with a blank line' - fi - - if [[ "$(echo "$1" | head -n1 | awk '{print length}')" -gt 50 ]]; then - display_commit_message_error "$1" 'Limit the subject line to 50 characters' - fi - - if [[ ! $1 =~ ^[A-Z] ]]; then - display_commit_message_error "$1" 'Capitalize the subject line' - fi - - if [[ "$(echo "$1" | awk 'NR == 1 {print substr($0,length($0),1)}')" == "." ]]; then - display_commit_message_error "$1" 'Do not end the subject line with a period' - fi - - if [[ "$(echo "$1" | awk '{print length}' | sort -nr | head -1)" -gt 72 ]]; then - display_commit_message_error "$1" 'Wrap the body at 72 characters' - fi -} - -if [ "$#" -eq 1 ]; then - if [ ! -f "$1" ]; then - echo "$0 was passed one argument, but was not a valid file" - exit 1 - fi - lint_commit_message "$(sed -n '/# Please enter the commit message for your changes. Lines starting/q;p' "$1")" -else - for COMMIT in $(git rev-list --no-merges origin/master..); do - lint_commit_message "$(git log --format="%B" -n 1 ${COMMIT})" - done -fi diff --git a/.github/lint-disallowed-functions-in-library.sh b/.github/lint-disallowed-functions-in-library.sh deleted file mode 100755 index 9dd988f59..000000000 --- a/.github/lint-disallowed-functions-in-library.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env bash - -# -# 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. -# - -set -e - -# Disallow usages of functions that cause the program to exit in the library code -SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) -if [ -f ${SCRIPT_PATH}/.ci.conf ]; then - . ${SCRIPT_PATH}/.ci.conf -fi - -EXCLUDE_DIRECTORIES=${DISALLOWED_FUNCTIONS_EXCLUDED_DIRECTORIES:-"examples"} -DISALLOWED_FUNCTIONS=('os.Exit(' 'panic(' 'Fatal(' 'Fatalf(' 'Fatalln(' 'fmt.Println(' 'fmt.Printf(' 'log.Print(' 'log.Println(' 'log.Printf(' 'print(' 'println(') - -FILES=$( - find "${SCRIPT_PATH}/.." -name "*.go" \ - | grep -v -e '^.*_test.go$' \ - | while read FILE; do - EXCLUDED=false - for EXCLUDE_DIRECTORY in ${EXCLUDE_DIRECTORIES}; do - if [[ ${FILE} == */${EXCLUDE_DIRECTORY}/* ]]; then - EXCLUDED=true - break - fi - done - ${EXCLUDED} || echo "${FILE}" - done -) - -for DISALLOWED_FUNCTION in "${DISALLOWED_FUNCTIONS[@]}"; do - if grep -e "\s${DISALLOWED_FUNCTION}" ${FILES} | grep -v -e 'nolint'; then - echo "${DISALLOWED_FUNCTION} may only be used in example code" - exit 1 - fi -done diff --git a/.github/lint-filename.sh b/.github/lint-filename.sh deleted file mode 100755 index 3e7d1b961..000000000 --- a/.github/lint-filename.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash - -# -# 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. -# - -set -e - -SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) -GO_REGEX="^[a-zA-Z][a-zA-Z0-9_]*\.go$" - -find "${SCRIPT_PATH}/.." -name "*.go" | while read FULLPATH; do - FILENAME=$(basename -- "${FULLPATH}") - - if ! [[ ${FILENAME} =~ ${GO_REGEX} ]]; then - echo "${FILENAME} is not a valid filename for Go code, only alpha, numbers and underscores are supported" - exit 1 - fi -done diff --git a/.github/lint-no-trailing-newline-in-log-messages.sh b/.github/lint-no-trailing-newline-in-log-messages.sh deleted file mode 100755 index f0dad5994..000000000 --- a/.github/lint-no-trailing-newline-in-log-messages.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env bash - -# -# 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. -# - -set -e - -# Disallow usages of functions that cause the program to exit in the library code -SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) -if [ -f ${SCRIPT_PATH}/.ci.conf ]; then - . ${SCRIPT_PATH}/.ci.conf -fi - -FILES=$( - find "${SCRIPT_PATH}/.." -name "*.go" \ - | while read FILE; do - EXCLUDED=false - for EXCLUDE_DIRECTORY in ${EXCLUDE_DIRECTORIES}; do - if [[ $file == */${EXCLUDE_DIRECTORY}/* ]]; then - EXCLUDED=true - break - fi - done - ${EXCLUDED} || echo "${FILE}" - done -) - -if grep -E '\.(Trace|Debug|Info|Warn|Error)f?\("[^"]*\\n"\)?' ${FILES} | grep -v -e 'nolint'; then - echo "Log format strings should have trailing new-line" - exit 1 -fi \ No newline at end of file diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index cec0d7c68..bb4490430 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -1,4 +1,15 @@ -name: "CodeQL" +# +# 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. +# + +name: CodeQL on: workflow_dispatch: @@ -12,29 +23,4 @@ on: jobs: analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - steps: - - name: Checkout repo - uses: actions/checkout@v3 - - # The code in examples/ might intentionally do things like log credentials - # in order to show how the library is used, aid in debugging etc. We - # should ignore those for CodeQL scanning, and only focus on the package - # itself. - - name: Remove example code - run: | - rm -rf examples/ - - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: 'go' - - - name: CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: pion/.goassets/.github/workflows/codeql-analysis.reusable.yml@master diff --git a/.github/workflows/generate-authors.yml b/.github/workflows/generate-authors.yml index c7a8404d9..9fc78bcdb 100644 --- a/.github/workflows/generate-authors.yml +++ b/.github/workflows/generate-authors.yml @@ -9,69 +9,13 @@ # https://github.com/pion/.goassets instead of this repository. # -name: generate-authors +name: Generate Authors on: pull_request: jobs: - checksecret: - permissions: - contents: none - runs-on: ubuntu-latest - outputs: - is_PIONBOT_PRIVATE_KEY_set: ${{ steps.checksecret_job.outputs.is_PIONBOT_PRIVATE_KEY_set }} - steps: - - id: checksecret_job - env: - PIONBOT_PRIVATE_KEY: ${{ secrets.PIONBOT_PRIVATE_KEY }} - run: | - echo "is_PIONBOT_PRIVATE_KEY_set: ${{ env.PIONBOT_PRIVATE_KEY != '' }}" - echo "::set-output name=is_PIONBOT_PRIVATE_KEY_set::${{ env.PIONBOT_PRIVATE_KEY != '' }}" - - generate-authors: - permissions: - contents: write - needs: [checksecret] - if: needs.checksecret.outputs.is_PIONBOT_PRIVATE_KEY_set == 'true' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - ref: ${{ github.head_ref }} - fetch-depth: 0 - token: ${{ secrets.PIONBOT_PRIVATE_KEY }} - - - name: Generate the authors file - run: .github/generate-authors.sh - - - name: Add the authors file to git - run: git add AUTHORS.txt - - - name: Get last commit message - id: last-commit-message - run: | - COMMIT_MSG=$(git log -1 --pretty=%B) - COMMIT_MSG="${COMMIT_MSG//'%'/'%25'}" - COMMIT_MSG="${COMMIT_MSG//$'\n'/'%0A'}" - COMMIT_MSG="${COMMIT_MSG//$'\r'/'%0D'}" - echo "::set-output name=msg::$COMMIT_MSG" - - - name: Get last commit author - id: last-commit-author - run: | - echo "::set-output name=msg::$(git log -1 --pretty='%aN <%ae>')" - - - name: Check if AUTHORS.txt file has changed - id: git-status-output - run: | - echo "::set-output name=msg::$(git status -s | wc -l)" - - - name: Commit and push - if: ${{ steps.git-status-output.outputs.msg != '0' }} - run: | - git config user.email $(echo "${{ steps.last-commit-author.outputs.msg }}" | sed 's/\(.\+\) <\(\S\+\)>/\2/') - git config user.name $(echo "${{ steps.last-commit-author.outputs.msg }}" | sed 's/\(.\+\) <\(\S\+\)>/\1/') - git add AUTHORS.txt - git commit --amend --no-edit - git push --force https://github.com/${GITHUB_REPOSITORY} $(git symbolic-ref -q --short HEAD) + generate: + uses: pion/.goassets/.github/workflows/generate-authors.reusable.yml@master + secrets: + token: ${{ secrets.PIONBOT_PRIVATE_KEY }} diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 11b633600..e72c71668 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -12,50 +12,7 @@ name: Lint on: pull_request: - types: - - opened - - edited - - synchronize - -permissions: - contents: read jobs: - lint-commit-message: - name: Metadata - runs-on: ubuntu-latest - strategy: - fail-fast: false - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Commit Message - run: .github/lint-commit-message.sh - - - name: File names - run: .github/lint-filename.sh - - - name: Functions - run: .github/lint-disallowed-functions-in-library.sh - - - name: Logging messages should not have trailing newlines - run: .github/lint-no-trailing-newline-in-log-messages.sh - - lint-go: - name: Go - permissions: - contents: read - pull-requests: read - runs-on: ubuntu-latest - strategy: - fail-fast: false - steps: - - uses: actions/checkout@v3 - - - name: golangci-lint - uses: golangci/golangci-lint-action@v3 - with: - version: v1.45.2 - args: $GOLANGCI_LINT_EXRA_ARGS + lint: + uses: pion/.goassets/.github/workflows/lint.reusable.yml@master diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ac2fe3c8a..a07c29280 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,15 @@ -name: release +# +# 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. +# + +name: Release on: push: tags: @@ -6,20 +17,6 @@ on: jobs: release: - permissions: - contents: write - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - uses: actions/setup-go@v3 - with: - go-version: '1.18' # auto-update/latest-go-version - - name: Build and release - uses: goreleaser/goreleaser-action@v4 - with: - version: latest - args: release --rm-dist - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: pion/.goassets/.github/workflows/release.reusable.yml@master + with: + go-version: '1.19' # auto-update/latest-go-version diff --git a/.github/workflows/renovate-go-mod-fix.yaml b/.github/workflows/renovate-go-mod-fix.yaml deleted file mode 100644 index 0804642ef..000000000 --- a/.github/workflows/renovate-go-mod-fix.yaml +++ /dev/null @@ -1,36 +0,0 @@ -# -# 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. -# - -name: go-mod-fix -on: - push: - branches: - - renovate/* - -permissions: - contents: write - -jobs: - go-mod-fix: - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - name: fix - uses: at-wat/go-sum-fix-action@v0 - with: - git_user: Pion Bot - git_email: 59523206+pionbot@users.noreply.github.com - github_token: ${{ secrets.PIONBOT_PRIVATE_KEY }} - commit_style: squash - push: force diff --git a/.github/workflows/renovate-go-sum-fix.yaml b/.github/workflows/renovate-go-sum-fix.yaml new file mode 100644 index 000000000..5a9af3647 --- /dev/null +++ b/.github/workflows/renovate-go-sum-fix.yaml @@ -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. +# + +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 }} diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 0d9125f4e..834a158d0 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -13,162 +13,29 @@ name: Test on: push: branches: - - master + - master pull_request: - branches: - - master - -permissions: - contents: read jobs: test: - runs-on: ubuntu-latest + uses: pion/.goassets/.github/workflows/test.reusable.yml@master strategy: matrix: go: ['1.19', '1.18'] # auto-update/supported-go-version-list fail-fast: false - name: Go ${{ matrix.go }} - steps: - - uses: actions/checkout@v3 - - - uses: actions/cache@v3 - with: - path: | - ~/go/pkg/mod - ~/go/bin - ~/.cache - key: ${{ runner.os }}-amd64-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-amd64-go- - - - name: Setup Go - uses: actions/setup-go@v3 - with: - go-version: ${{ matrix.go }} - - - name: Setup go-acc - run: go install github.com/ory/go-acc@latest - - - name: Set up gotestfmt - uses: haveyoudebuggedit/gotestfmt-action@v2 - with: - token: ${{ secrets.GITHUB_TOKEN }} # Avoid getting rate limited - - - name: Run test - run: | - TEST_BENCH_OPTION="-bench=." - if [ -f .github/.ci.conf ]; then . .github/.ci.conf; fi - - set -euo pipefail - go-acc -o cover.out ./... -- \ - ${TEST_BENCH_OPTION} \ - -json \ - -v -race 2>&1 | grep -v '^go: downloading' | tee /tmp/gotest.log | gotestfmt - - - name: Upload test log - uses: actions/upload-artifact@v3 - if: always() - with: - name: test-log-${{ matrix.go }} - path: /tmp/gotest.log - if-no-files-found: error - - - name: Run TEST_HOOK - run: | - if [ -f .github/.ci.conf ]; then . .github/.ci.conf; fi - if [ -n "${TEST_HOOK}" ]; then ${TEST_HOOK}; fi - - - uses: codecov/codecov-action@v3 - with: - name: codecov-umbrella - fail_ci_if_error: true - flags: go + with: + go-version: ${{ matrix.go }} test-i386: - runs-on: ubuntu-latest + uses: pion/.goassets/.github/workflows/test-i386.reusable.yml@master strategy: matrix: go: ['1.19', '1.18'] # auto-update/supported-go-version-list fail-fast: false - name: Go i386 ${{ matrix.go }} - steps: - - uses: actions/checkout@v3 - - - uses: actions/cache@v3 - with: - path: | - ~/go/pkg/mod - ~/.cache - key: ${{ runner.os }}-i386-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-i386-go- - - - name: Run test - run: | - mkdir -p $HOME/go/pkg/mod $HOME/.cache - docker run \ - -u $(id -u):$(id -g) \ - -e "GO111MODULE=on" \ - -e "CGO_ENABLED=0" \ - -v $GITHUB_WORKSPACE:/go/src/github.com/pion/$(basename $GITHUB_WORKSPACE) \ - -v $HOME/go/pkg/mod:/go/pkg/mod \ - -v $HOME/.cache:/.cache \ - -w /go/src/github.com/pion/$(basename $GITHUB_WORKSPACE) \ - i386/golang:${{matrix.go}}-alpine \ - /usr/local/go/bin/go test \ - ${TEST_EXTRA_ARGS:-} \ - -v ./... + with: + go-version: ${{ matrix.go }} 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.19' # auto-update/latest-go-version - - - 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@v3 - 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.19' # auto-update/latest-go-version diff --git a/.github/workflows/tidy-check.yaml b/.github/workflows/tidy-check.yaml index 50cc17a4f..29c5cb862 100644 --- a/.github/workflows/tidy-check.yaml +++ b/.github/workflows/tidy-check.yaml @@ -12,31 +12,12 @@ name: Go mod tidy on: pull_request: - branches: - - master push: branches: - master -permissions: - contents: read - jobs: - Check: - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@v3 - - name: Setup Go - uses: actions/setup-go@v3 - with: - go-version: '1.19' # auto-update/latest-go-version - - 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.19' # auto-update/latest-go-version diff --git a/AUTHORS.txt b/AUTHORS.txt index a73619817..61dfc050a 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -2,7 +2,7 @@ # we would love to have you https://github.com/pion/webrtc/wiki/Contributing # # This file is auto generated, using git to list all individuals contributors. -# see `.github/generate-authors.sh` for the scripting +# see https://github.com/pion/.goassets/blob/master/scripts/generate-authors.sh for the scripting Aleksandr Razumov alvarowolfx Arlo Breault