WIP: feat: scoreboard (#15) #31
|
@ -32,7 +32,7 @@ steps:
|
|||
from_secret: gitea-token
|
||||
GITEA_ORG_NAME: FOCS-dev
|
||||
commands:
|
||||
- bash scripts/submit_scoreboard.sh
|
||||
- bash scripts/submit_scoreboard_failedtable.sh
|
||||
- name: store
|
||||
commands:
|
||||
- cp build/joj3 /home/drone/.local/bin/joj3
|
||||
|
|
|
@ -62,13 +62,6 @@ func readStageResults(t *testing.T, path string) []stage.StageResult {
|
|||
return results
|
||||
}
|
||||
|
||||
func removeStringPrefix(s, prefix string) string {
|
||||
if strings.HasPrefix(s, prefix) {
|
||||
return s[len(prefix):]
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
func TestMain(t *testing.T) {
|
||||
scoreboard := scoreboard.Scoreboard{}
|
||||
scoreboard.Init()
|
||||
|
@ -117,7 +110,7 @@ func TestMain(t *testing.T) {
|
|||
defer os.Remove(outputFile)
|
||||
main()
|
||||
stageResults := readStageResults(t, outputFile)
|
||||
scoreboard.AddScore(removeStringPrefix(tt, "/examples/"), stageResults)
|
||||
scoreboard.AddScore(strings.TrimPrefix(tt, "/examples/"), stageResults)
|
||||
regex := true
|
||||
expectedFile := "expected_regex.json"
|
||||
if _, err := os.Stat(expectedFile); os.IsNotExist(err) {
|
||||
|
|
|
@ -7,13 +7,13 @@ import (
|
|||
"focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/stage"
|
||||
)
|
||||
|
||||
type StageRecord struct {
|
||||
StageName string `json:"stagename"`
|
||||
type TestRecord struct {
|
||||
TestName string `json:"testname"`
|
||||
StageResults []stage.StageResult `json:"stageresults"`
|
||||
}
|
||||
|
||||
type ScoreboardData struct {
|
||||
StageRecords []StageRecord `json:"stagerecords"`
|
||||
TestRecords []TestRecord `json:"testrecords"`
|
||||
}
|
||||
|
||||
type Scoreboard struct {
|
||||
|
@ -21,12 +21,12 @@ type Scoreboard struct {
|
|||
}
|
||||
|
||||
func (b *Scoreboard) Init() {
|
||||
b.scoreboard.StageRecords = make([]StageRecord, 0)
|
||||
b.scoreboard.TestRecords = make([]TestRecord, 0)
|
||||
}
|
||||
|
||||
func (b *Scoreboard) AddScore(stagename string, results []stage.StageResult) {
|
||||
b.scoreboard.StageRecords = append(b.scoreboard.StageRecords,
|
||||
StageRecord{StageName: stagename, StageResults: results})
|
||||
func (b *Scoreboard) AddScore(testname string, results []stage.StageResult) {
|
||||
b.scoreboard.TestRecords = append(b.scoreboard.TestRecords,
|
||||
TestRecord{TestName: testname, StageResults: results})
|
||||
}
|
||||
|
||||
func (b *Scoreboard) SaveFile(filePath string) {
|
||||
|
|
|
@ -2,11 +2,12 @@
|
|||
export ORIG_HOME=$(grep ^${USER}: /etc/passwd |cut -d : -f 6)
|
||||
PATH=$PATH:$ORIG_HOME/.local/bin
|
||||
|
||||
if echo "${DRONE_REPO_NAME}" | grep -q '-'; then
|
||||
SUBMITTER_NAME=$(echo "${DRONE_REPO_NAME}" | cut -d'-' -f1);
|
||||
else
|
||||
SUBMITTER_NAME=${DRONE_REPO_NAME};
|
||||
fi
|
||||
# if echo "${DRONE_REPO_NAME}" | grep -q '-'; then
|
||||
# SUBMITTER_NAME=$(echo "${DRONE_REPO_NAME}" | cut -d'-' -f1);
|
||||
# else
|
||||
# SUBMITTER_NAME=${DRONE_REPO_NAME};
|
||||
# fi
|
||||
SUBMITTER_NAME=${DRONE_REPO_NAME}
|
||||
|
||||
mkdir repos
|
||||
|
||||
|
@ -19,5 +20,6 @@ echo 'MATTERMOST_ACCESS_TOKEN=""' >> .env
|
|||
echo 'MATTERMOST_TEACHING_TEAM=[]' >> .env
|
||||
|
||||
joint-teapot JOJ3-scoreboard "score.json" $SUBMITTER_NAME "" "JOJ3-examples" "JOJ3_dev.csv"
|
||||
joint-teapot JOJ3-failed-table "score.json" "JOJ3-examples" $DRONE_REPO_NAME $DRONE_REMOTE_URL "JOJ3-failed.md"
|
||||
rm score.json
|
||||
rm .env
|
Loading…
Reference in New Issue
Block a user