diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 0225b053..17c2d274 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -13,10 +13,23 @@ jobs: name: Lint Backend runs-on: ubuntu-latest steps: - - uses: actions/setup-go@v3 + - name: Install Go + uses: actions/setup-go@v2 with: go-version: 1.19 - - uses: actions/checkout@v3 + + - name: Checkout Repo + uses: actions/checkout@v2 + with: + submodules: true + token: ${{ secrets.SSH_TOKEN }} + + - name: Install dependencies + run: make install-dependencies + + - name: Build Protos + run: make build-protos + - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7b1d1d69..24bf10b2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,10 +25,15 @@ jobs: - name: Install dependencies run: make install-dependencies + - name: Build Protos + run: make build-protos + - name: Test run: | go test -race ./... + # TODO: include protobuf installation and compilation steps here, once we actually start + # writing tests that need to run on the frontend. Jest: name: Test Frontend runs-on: ubuntu-latest diff --git a/Makefile b/Makefile index b6f96188..4bda4490 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,11 @@ all: build run # Dependencies # -------------------------------------------------------------------- -.PHONY: install-linter +.PHONY: install-dependencies install-linter install-protos install-fmter + +install-dependencies: install-linter install-protos install-fmter + cd houston && npm install + install-linter: # TODO: might as well just move this all to an install-linter script $(info Installing golangci-lint for $(OS)) @@ -18,17 +22,16 @@ install-linter: fi;\ install-protos: - git submodule init && git submodule update + sudo apt install protobuf-compiler + go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28 + echo "You will need to set your PATH variable to include go installations, if you have not already done so." install-fmter: go install golang.org/x/tools/cmd/goimports@latest -install-assets: - ./scripts/pull-large-assets.sh - # Build # -------------------------------------------------------------------- -.PHONY: pre-build build install-dependencies configure-git build-go build-react build-docker build-protos build-backend-protos build-frontend-protos +.PHONY: pre-build build configure-git build-go build-react build-docker build-protos build-backend-protos build-frontend-protos pre-build: configure-git build: build-go build-react build-protos diff --git a/internal/server/server.go b/internal/server/server.go index eb97efce..bfc7dbed 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -14,7 +14,6 @@ import ( "github.com/tritonuas/gcs/internal/influxdb" mav "github.com/tritonuas/gcs/internal/mavlink" "github.com/tritonuas/gcs/internal/obc" - "github.com/tritonuas/gcs/internal/obc/camera" "github.com/tritonuas/gcs/internal/protos" ) @@ -25,10 +24,11 @@ var Log = logrus.New() Stores the server state and data that the server deals with. */ type Server struct { - influxDBClient *influxdb.Client - mavlinkClient *mav.Client - obcClient *obc.Client - newestRawImage camera.RawImage + influxDBClient *influxdb.Client + mavlinkClient *mav.Client + obcClient *obc.Client + // TODO: reintroduce once this is actually referenced in the code + // newestRawImage camera.RawImage UnclassifiedTargets []cvs.UnclassifiedODLC `json:"unclassified_targets"` MissionTime int64 ClassifiedTargets []cvs.ClassifiedODLC @@ -414,8 +414,8 @@ func (server *Server) postMission() gin.HandlerFunc { server.MissionConfig = &mission - resp_body, status := server.obcClient.PostMission(&mission) - c.Data(status, "text/plain", resp_body) + respBody, status := server.obcClient.PostMission(&mission) + c.Data(status, "text/plain", respBody) } } diff --git a/scripts/pull-large-assets.sh b/scripts/pull-large-assets.sh deleted file mode 100755 index 035ef26b..00000000 --- a/scripts/pull-large-assets.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -# Move current directory so we can use relative file paths to where this script is located -parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) -cd "$parent_path" - -wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=1u8EYuGkd-QekLDBO6k8SF5XN4_o-cOUU' -O '../static/videos/familyguy.mp4' -wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=1OJZh1qdNypbKKG1C219WU2UgaEfO0Bsj' -O '../static/videos/subway.mp4' -wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=1-QOoGsjG6gKJCnOucw2UBw2N33fW1fV3' -O '../static/music/intense.webm' -wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=1Tbyn3OosYyTL_r9liVZHYz-jMwexxB50' -O '../static/music/blow.wav' -wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=1RQU-4GU4VPaqMq5zSkVnJzTimaMzQBe1' -O '../static/music/normal.webm' -wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=1HBwqcHz9pQYBhHYJP6YE88r4pISUcZFM' -O '../static/music/title.webm' -wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=19hbJJnGJK5UoxraZxu6V15KucwhOamVr' -O '../static/music/drop.wav' \ No newline at end of file