ci: use gitea actions instead of drone (#40)
Reviewed-on: FOCS-dev/JOJ3#40
This commit is contained in:
parent
2291264df0
commit
61dada5c40
31
.drone.yml
31
.drone.yml
|
@ -1,31 +0,0 @@
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: ssh
|
|
||||||
name: CI
|
|
||||||
server:
|
|
||||||
host: 111.186.59.59
|
|
||||||
user: drone
|
|
||||||
ssh_key:
|
|
||||||
from_secret: joj3-test
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: prepare
|
|
||||||
commands:
|
|
||||||
- go env -w GOPROXY=https://goproxy.cn,direct
|
|
||||||
- whoami
|
|
||||||
- pwd
|
|
||||||
- env
|
|
||||||
- go version
|
|
||||||
- go env
|
|
||||||
- git status -v
|
|
||||||
- git log -1
|
|
||||||
- name: build
|
|
||||||
commands:
|
|
||||||
- make
|
|
||||||
- name: test
|
|
||||||
commands:
|
|
||||||
- make prepare-test
|
|
||||||
- make test
|
|
||||||
- name: store
|
|
||||||
commands:
|
|
||||||
- cp build/joj3 /home/drone/.local/bin/joj3
|
|
44
.gitea/workflows/test.yaml
Normal file
44
.gitea/workflows/test.yaml
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
---
|
||||||
|
name: checks
|
||||||
|
on:
|
||||||
|
- push
|
||||||
|
- pull_request
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
container:
|
||||||
|
image: focs.ji.sjtu.edu.cn:5000/gitea/runner-images:ubuntu-latest
|
||||||
|
volumes:
|
||||||
|
- /home/actions/.ssh:/root/.ssh
|
||||||
|
steps:
|
||||||
|
- name: Check out repository code
|
||||||
|
uses: https://gitea.com/BoYanZh/checkout@focs
|
||||||
|
- name: Setup Go 1.23.1
|
||||||
|
run: |
|
||||||
|
wget -q https://studygolang.com/dl/golang/go1.23.1.linux-amd64.tar.gz
|
||||||
|
rm -rf /usr/local/go
|
||||||
|
tar -C /usr/local -xzf go1.23.1.linux-amd64.tar.gz
|
||||||
|
rm -rf go1.23.1.linux-amd64.tar.gz
|
||||||
|
echo "PATH=$PATH:/usr/local/go/bin:/root/go/bin" >> $GITHUB_ENV
|
||||||
|
- name: Display Go version
|
||||||
|
run: go version
|
||||||
|
- name: Prepare
|
||||||
|
run: |
|
||||||
|
go env -w GO111MODULE=on
|
||||||
|
go env -w GOPROXY=https://goproxy.io,direct
|
||||||
|
chown -R root:root /root/.ssh
|
||||||
|
- name: Setup golangci-lint
|
||||||
|
run: |
|
||||||
|
wget -q https://ghp.ci/https://github.com/golangci/golangci-lint/releases/download/v1.61.0/golangci-lint-1.61.0-linux-amd64.tar.gz
|
||||||
|
tar -C /tmp -xzf golangci-lint-1.61.0-linux-amd64.tar.gz
|
||||||
|
rm -rf golangci-lint-1.61.0-linux-amd64.tar.gz
|
||||||
|
mkdir -p /root/go/bin
|
||||||
|
mv /tmp/golangci-lint-1.61.0-linux-amd64/golangci-lint /root/go/bin
|
||||||
|
- name: Lint
|
||||||
|
run: make lint
|
||||||
|
- name: Build
|
||||||
|
run: make build
|
||||||
|
- name: Test
|
||||||
|
run: |
|
||||||
|
make prepare-test
|
||||||
|
make ci-test
|
10
Makefile
10
Makefile
|
@ -1,4 +1,4 @@
|
||||||
.PHONY: all build clean prepare-test test
|
.PHONY: all build clean lint prepare-test test ci-test
|
||||||
|
|
||||||
BUILD_DIR = ./build
|
BUILD_DIR = ./build
|
||||||
TMP_DIR = ./tmp
|
TMP_DIR = ./tmp
|
||||||
|
@ -15,9 +15,17 @@ clean:
|
||||||
rm -rf $(TMP_DIR)/*
|
rm -rf $(TMP_DIR)/*
|
||||||
rm -rf *.out
|
rm -rf *.out
|
||||||
|
|
||||||
|
lint:
|
||||||
|
golangci-lint run
|
||||||
|
|
||||||
prepare-test:
|
prepare-test:
|
||||||
git submodule update --init --remote
|
git submodule update --init --remote
|
||||||
|
|
||||||
test:
|
test:
|
||||||
./scripts/prepare_test_repos.sh $(TMP_DIR)
|
./scripts/prepare_test_repos.sh $(TMP_DIR)
|
||||||
go test -coverprofile cover.out -v ./...
|
go test -coverprofile cover.out -v ./...
|
||||||
|
|
||||||
|
ci-test:
|
||||||
|
./scripts/prepare_test_repos.sh $(TMP_DIR)
|
||||||
|
./scripts/run_foreach_test_repos.sh $(TMP_DIR) "sed -i '2i \ \ \"sandboxExecServer\": \"172.17.0.1:5051\",' conf.json"
|
||||||
|
go test -coverprofile cover.out -v ./...
|
||||||
|
|
|
@ -3,7 +3,6 @@ package stage
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/criyle/go-judge/envexec"
|
"github.com/criyle/go-judge/envexec"
|
||||||
)
|
)
|
||||||
|
@ -126,8 +125,8 @@ func (r ExecutorResult) String() string {
|
||||||
Status Status
|
Status Status
|
||||||
ExitStatus int
|
ExitStatus int
|
||||||
Error string
|
Error string
|
||||||
Time time.Duration
|
Time uint64
|
||||||
RunTime time.Duration
|
RunTime uint64
|
||||||
Memory envexec.Size
|
Memory envexec.Size
|
||||||
Files map[string]string
|
Files map[string]string
|
||||||
FileIDs map[string]string
|
FileIDs map[string]string
|
||||||
|
@ -137,8 +136,8 @@ func (r ExecutorResult) String() string {
|
||||||
Status: r.Status,
|
Status: r.Status,
|
||||||
ExitStatus: r.ExitStatus,
|
ExitStatus: r.ExitStatus,
|
||||||
Error: r.Error,
|
Error: r.Error,
|
||||||
Time: time.Duration(r.Time),
|
Time: r.Time,
|
||||||
RunTime: time.Duration(r.RunTime),
|
RunTime: r.RunTime,
|
||||||
Memory: envexec.Size(r.Memory),
|
Memory: envexec.Size(r.Memory),
|
||||||
Files: make(map[string]string),
|
Files: make(map[string]string),
|
||||||
FileIDs: r.FileIDs,
|
FileIDs: r.FileIDs,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user