Skip to content

Commit

Permalink
CI: Add editorconfig-checker workflow when testing the project (#2800)
Browse files Browse the repository at this point in the history
  • Loading branch information
hjpotter92 authored Jun 2, 2023
1 parent dc1643c commit 7888548
Show file tree
Hide file tree
Showing 17 changed files with 202 additions and 232 deletions.
22 changes: 22 additions & 0 deletions .ecrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"Verbose": false,
"Debug": false,
"IgnoreDefaults": false,
"SpacesAftertabs": false,
"NoColor": false,
"Exclude": [
"core/.*.ts",
"net/.*.proto",
".*.md",
"go.mod",
"go.sum"
],
"AllowedContentTypes": [],
"PassedFiles": [],
"Disable": {
"EndOfLine": false,
"Indentation": false,
"InsertFinalNewline": false,
"TrimTrailingWhitespace": false
}
}
26 changes: 17 additions & 9 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,25 @@ insert_final_newline = true
trim_trailing_whitespace = true
end_of_line = lf

# Makefiles
[Makefile]
indent_style = tab
# Ignored files
[*.{ts,phash}]
charset = unset
indent_style = unset
indent_size = unset
insert_final_newline = unset
trim_trailing_whitespace = unset
end_of_line = unset

[{VERSION,LICENSE,*.txt}]
insert_final_newline = unset

[Dockerfile]
# Makefiles/Dockerfile/golang files
[{Makefile,Dockerfile{,.debian},*.go}]
indent_style = tab

# YAML Files
[*.{yaml,sh}]
# YAML/JSON Files
[{.ecrc,*.{yml,yaml,sh,json}}]
indent_size = 2

# Go source files
[*.go]
indent_style = tab
[{server/handlers_test,eth/accountmanager_test}.go]
indent_style = unset
4 changes: 2 additions & 2 deletions .github/workflows/issue-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
issues: write
steps:
- name: Label issues
uses: andymckay/labeler@e6c4322d0397f3240f0e7e30a33b5c5df2d39e90
uses: andymckay/labeler@master
with:
add-labels: "status: triage"
repo-token: ${{ secrets.GITHUB_TOKEN }}
ignore-if-assigned: false
ignore-if-assigned: false
17 changes: 17 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,20 @@ jobs:

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2

editorconfig:
name: Run editorconfig checker
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/[email protected]
with:
# Check https://github.com/livepeer/go-livepeer/pull/1891
# for ref value discussion
ref: ${{ github.event.pull_request.head.sha }}

- name: Install editorconfig-checker
uses: editorconfig-checker/action-editorconfig-checker@main

- name: Run editorconfig checker against the repo
run: editorconfig-checker
9 changes: 0 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,3 @@ livepeer_bench:
.PHONY: livepeer_router
livepeer_router:
GO111MODULE=on CGO_ENABLED=1 CC="$(cc)" CGO_CFLAGS="$(cgo_cflags)" CGO_LDFLAGS="$(cgo_ldflags)" go build -o $(GO_BUILD_DIR) -ldflags="$(ldflags)" cmd/livepeer_router/*.go

.PHONY: localdocker
localdocker:
./print_version.sh > .git.describe
# docker build -t livepeerbinary:debian -f Dockerfile.debian .
# Manually build our context... this is hacky but docker refuses to support symlinks
# or selectable .dockerignore files
tar ch --exclude=.git . | docker build --build-arg BUILD_TAGS="$(BUILD_TAGS)" -t livepeerbinary:debian -f docker/Dockerfile.debian -
rm .git.describe
26 changes: 13 additions & 13 deletions common/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,30 +208,30 @@ func InitDB(dbPath string) (*DB, error) {

// updateOrch prepared statement
stmt, err = db.Prepare(`
INSERT INTO orchestrators(updatedAt, ethereumAddr, serviceURI, pricePerPixel, activationRound, deactivationRound, stake, createdAt)
VALUES(datetime(), :ethereumAddr, :serviceURI, :pricePerPixel, :activationRound, :deactivationRound, :stake, datetime())
ON CONFLICT(ethereumAddr) DO UPDATE SET
INSERT INTO orchestrators(updatedAt, ethereumAddr, serviceURI, pricePerPixel, activationRound, deactivationRound, stake, createdAt)
VALUES(datetime(), :ethereumAddr, :serviceURI, :pricePerPixel, :activationRound, :deactivationRound, :stake, datetime())
ON CONFLICT(ethereumAddr) DO UPDATE SET
updatedAt = excluded.updatedAt,
serviceURI =
CASE WHEN trim(excluded.serviceURI) == ""
THEN orchestrators.serviceURI
ELSE trim(excluded.serviceURI) END,
pricePerPixel =
CASE WHEN trim(excluded.serviceURI) == ""
THEN orchestrators.serviceURI
ELSE trim(excluded.serviceURI) END,
pricePerPixel =
CASE WHEN excluded.pricePerPixel == 0
THEN orchestrators.pricePerPixel
ELSE excluded.pricePerPixel END,
activationRound =
ELSE excluded.pricePerPixel END,
activationRound =
CASE WHEN excluded.activationRound == 0
THEN orchestrators.activationRound
ELSE excluded.activationRound END,
deactivationRound =
ELSE excluded.activationRound END,
deactivationRound =
CASE WHEN excluded.deactivationRound == 0
THEN orchestrators.deactivationRound
ELSE excluded.deactivationRound END,
stake =
stake =
CASE WHEN excluded.stake == 0
THEN orchestrators.stake
ELSE excluded.stake END
ELSE excluded.stake END
`)
if err != nil {
glog.Error("Unable to prepare updateOrch ", err)
Expand Down
6 changes: 3 additions & 3 deletions doc/assets/redeemer/eth-events.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ participant LocalSenderMonitor
participant SenderManager
end
participant Ethereum Node
participantgroup
participantgroup

Recipient->Redeemer Client (SenderMonitor):MaxFloat(sender)
group MaxFloat(sender)
Expand All @@ -20,9 +20,9 @@ Redeemer Client (SenderMonitor)->>Redeemer gRPC server: MaxFloat(sender)
Redeemer gRPC server->LocalSenderMonitor: MaxFloat(sender)
Redeemer gRPC server<--LocalSenderMonitor: MaxFloat
Redeemer Client (SenderMonitor)<<--Redeemer gRPC server: MaxFloatUpdate
Redeemer Client (SenderMonitor)-#blue>>Redeemer gRPC server: <color:#blue>MonitorMaxFloat(sender)
Redeemer Client (SenderMonitor)-#blue>>Redeemer gRPC server: <color:#blue>MonitorMaxFloat(sender)
Redeemer gRPC server-#red>LocalSenderMonitor: <color:#red>SubscribeMaxFloatChange(sender)
end
end
Recipient<--Redeemer Client (SenderMonitor): MaxFloat

entryspacing 3
Expand Down
8 changes: 4 additions & 4 deletions doc/assets/redeemer/ticketflow.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ participant TicketQueue
database TicketStore
end
participant Ethereum Node
participantgroup
participantgroup

Recipient->Redeemer Client (SenderMonitor):MaxFloat(sender)
group MaxFloat(sender)
Expand All @@ -21,9 +21,9 @@ Redeemer Client (SenderMonitor)->>Redeemer gRPC server: MaxFloat(sender)
Redeemer gRPC server->LocalSenderMonitor: MaxFloat(sender)
Redeemer gRPC server<--LocalSenderMonitor: MaxFloat
Redeemer Client (SenderMonitor)<<--Redeemer gRPC server: MaxFloatUpdate
Redeemer Client (SenderMonitor)-#blue>>Redeemer gRPC server: <color:#blue>MonitorMaxFloat(sender)
Redeemer Client (SenderMonitor)-#blue>>Redeemer gRPC server: <color:#blue>MonitorMaxFloat(sender)
Redeemer gRPC server-#red>LocalSenderMonitor: <color:#red>SubscribeMaxFloatChange(Sender)
end
end
Recipient<--Redeemer Client (SenderMonitor): MaxFloat

entryspacing 3
Expand All @@ -40,7 +40,7 @@ LocalSenderMonitor->TicketQueue:QueueTicket
parallel off
TicketQueue->TicketStore:StoreWinningTicket
note over TicketStore:submittedAt==NULL\ntxHash==NULL
Redeemer Client (SenderMonitor)<<#green--Redeemer gRPC server:<color:#green>QueueTicketRes
Redeemer Client (SenderMonitor)<<#green--Redeemer gRPC server:<color:#green>QueueTicketRes
end
Recipient<--Redeemer Client (SenderMonitor): RedeemWinningTicket

Expand Down
4 changes: 2 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ RUN GRPC_HEALTH_PROBE_VERSION=v0.3.6 \

# note: for runtime, Tensorflow version needs to be compatible with CUDA and CuDNN of the image
RUN LIBTENSORFLOW_VERSION=2.3.4 \
&& curl -LO https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-linux-x86_64-${LIBTENSORFLOW_VERSION}.tar.gz \
&& mkdir /tf && tar -C /tf -xzf libtensorflow-gpu-linux-x86_64-${LIBTENSORFLOW_VERSION}.tar.gz
&& curl -LO https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-linux-x86_64-${LIBTENSORFLOW_VERSION}.tar.gz \
&& mkdir /tf && tar -C /tf -xzf libtensorflow-gpu-linux-x86_64-${LIBTENSORFLOW_VERSION}.tar.gz

ENV GOPATH=/go \
GO_BUILD_DIR=/build/ \
Expand Down
48 changes: 0 additions & 48 deletions docker/Dockerfile.debian

This file was deleted.

8 changes: 0 additions & 8 deletions docker/run.ps1

This file was deleted.

13 changes: 0 additions & 13 deletions docker/start.sh

This file was deleted.

26 changes: 13 additions & 13 deletions etc/ffmpeg_trans_test.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
if [ -d "./tran_result" ]; then
echo "Need to remove tran_result first"
exit -1
echo "Need to remove tran_result first"
exit -1
fi

mkdir tran_result
mkdir -p tran_result
lastsum=''
for i in {1..2}
do
echo "Transcoding for out$i"
ffmpeg -i seg$i.ts -c:v libx264 -s 426:240 -r 30 -mpegts_copyts 1 -minrate 700k -maxrate 700k -bufsize 700k ./tran_result/out$i.ts
sum=($(md5sum ./tran_result/out$i.ts))
if [[ "$lastsum" != '' && "$sum" != "$lastsum" ]]; then
printf "\n\nDifferent MD5 - $lastsum != $sum(out$i)\n"
exit -1
fi
lastsum="$sum"

for i in {1..2}; do
echo "Transcoding for out$i"
ffmpeg -i seg$i.ts -c:v libx264 -s 426:240 -r 30 -mpegts_copyts 1 -minrate 700k -maxrate 700k -bufsize 700k ./tran_result/out$i.ts
sum=($(md5sum ./tran_result/out$i.ts))
if [[ "$lastsum" != '' && "$sum" != "$lastsum" ]]; then
printf "\n\nDifferent MD5 - $lastsum != $sum(out$i)\n"
exit -1
fi
lastsum="$sum"
done

echo "All Equal!"
Expand Down
28 changes: 14 additions & 14 deletions prepare_mingw64.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/bin/bash

set -eo pipefail
set -x

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

export MINGW_INSTALLS=mingw64
pacman -S --noconfirm --noprogressbar --ask=20 --needed mingw-w64-x86_64-binutils mingw-w64-x86_64-gcc mingw-w64-x86_64-pkg-config mingw-w64-x86_64-go mingw-w64-x86_64-nasm mingw-w64-x86_64-clang git make autoconf automake patch libtool texinfo gtk-doc zip
gpg --keyserver keyserver.ubuntu.com --recv-keys F3599FF828C67298 249B39D24F25E3B6 2071B08A33BD3F06 29EE58B996865171 D605848ED7E69871

echo "removing all dlls"
# https://narkive.com/Fjlrbrjg:20.646.48
find /mingw64 -name "*.dll.a" -exec rm -v {} \;
#!/bin/bash

set -eo pipefail
set -x

DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

export MINGW_INSTALLS=mingw64
pacman -S --noconfirm --noprogressbar --ask=20 --needed mingw-w64-x86_64-binutils mingw-w64-x86_64-gcc mingw-w64-x86_64-pkg-config mingw-w64-x86_64-go mingw-w64-x86_64-nasm mingw-w64-x86_64-clang git make autoconf automake patch libtool texinfo gtk-doc zip
gpg --keyserver keyserver.ubuntu.com --recv-keys F3599FF828C67298 249B39D24F25E3B6 2071B08A33BD3F06 29EE58B996865171 D605848ED7E69871

echo "removing all dlls"
# https://narkive.com/Fjlrbrjg:20.646.48
find /mingw64 -name "*.dll.a" -exec rm -v {} \;
5 changes: 3 additions & 2 deletions print_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@
set -e
set -o nounset

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

currentTag="$(git describe --tags)"
currentVersion="$(cat "$DIR/VERSION")"
currentSha="$(git describe --always --long --dirty --abbrev=8)"

if [[ "$currentTag" == "v$currentVersion" ]]; then
echo -en "$currentVersion"
else
echo -en "$currentVersion-$currentSha"
fi
fi
12 changes: 7 additions & 5 deletions server/broadcast.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,13 +282,15 @@ func (sp *SessionPool) selectSessions(ctx context.Context, sessionsNum int) []*B
}

/*
Don't select sessions no longer in the map.
Don't select sessions no longer in the map.
Retry if the first selected session has been removed from the map.
This may occur if the session is removed while still in the list.
To avoid a runtime search of the session list under lock, simply
fixup the session list at selection time by retrying the selection.
Retry if the first selected session has been removed from
the map. This may occur if the session is removed while
still in the list. To avoid a runtime search of the
session list under lock, simply fixup the session list at
selection time by retrying the selection.
*/

if _, ok := sp.sessMap[sess.Transcoder()]; ok {
selectedSessions = append(selectedSessions, sess)

Expand Down
Loading

0 comments on commit 7888548

Please sign in to comment.