diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 27811ed..6474ffb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,40 +5,72 @@ jobs: name: run runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: install golang uses: actions/setup-go@v3 with: - go-version: '1.19.3' + go-version: '1.20.1' + + - name: install govulncheck + run: go install golang.org/x/vuln/cmd/govulncheck@latest + + - uses: actions/checkout@v3 + + - name: run vulnerability check + run: govulncheck ./... - - name: build - run: make cross-platform + - name: build Linux amd64 + run: make nightlight_linux_amd64 - - name: upload linux build + - name: test + run: make test + + - name: upload Linux amd64 build uses: actions/upload-artifact@v3 with: name: dist path: nightlight_linux_amd64 - - name: upload osx build + - name: build Linux arm7 (Raspberry Pi 32-bit) + run: make nightlight_linux_arm7 + + - name: upload Linux arm7 (Raspberry Pi 32-bit) build uses: actions/upload-artifact@v3 with: name: dist - path: nightlight_darwin_amd64 + path: nightlight_linux_arm7 - - name: upload windows build + - name: build Linux arm64 (Raspberry Pi 64-bit) + run: make nightlight_linux_arm64 + + - name: upload Linux arm64 (Raspberry Pi 64-bit) build uses: actions/upload-artifact@v3 with: name: dist - path: nightlight_windows_amd64.exe + path: nightlight_linux_arm64 - - name: upload raspi build + - name: build Darwin amd64 (MacOS Intel) + run: make nightlight_darwin_amd64 + + - name: upload Darwin amd64 (MacOS Intel) build uses: actions/upload-artifact@v3 with: name: dist - path: nightlight_linux_arm7 + path: nightlight_darwin_amd64 - - name: test - run: make test + - name: build Darwin arm64 (MacOS Apple Silicon) + run: make nightlight_darwin_arm64 + - name: upload Darwin arm64 (MacOS Apple Silicon) build + uses: actions/upload-artifact@v3 + with: + name: dist + path: nightlight_darwin_arm64 + + - name: build Windows amd64 + run: make nightlight_windows_amd64 + + - name: upload windows build + uses: actions/upload-artifact@v3 + with: + name: dist + path: nightlight_windows_amd64.exe diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5ec7fff..115fd4d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,16 +11,40 @@ jobs: name: run runs-on: ubuntu-latest steps: - - name: checkout - uses: actions/checkout@v3 - - name: install golang uses: actions/setup-go@v3 with: - go-version: '1.19.3' + go-version: '1.20.1' + + - name: install govulncheck + run: go install golang.org/x/vuln/cmd/govulncheck@latest + + - name: checkout + uses: actions/checkout@v3 + + - name: run vulnerability check + run: govulncheck ./... + + - name: build Linux amd64 + run: make nightlight_linux_amd64 + + - name: test + run: make test + + - name: build Linux arm7 (Raspberry Pi 32-bit) + run: make nightlight_linux_arm7 + + - name: build Linux arm64 (Raspberry Pi 64-bit) + run: make nightlight_linux_arm64 + + - name: build Darwin amd64 (MacOS Intel) + run: make nightlight_darwin_amd64 + + - name: build Darwin arm64 (MacOS Apple Silicon) + run: make nightlight_darwin_arm64 - - name: build - run: make cross-platform + - name: build Windows amd64 + run: make nightlight_windows_amd64 - name: zip run: | diff --git a/Makefile b/Makefile index aa1a2c7..f340d17 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ web/blockly/%: $(EXECUTABLE): $(SRCS) $(BLOCKLY) $(WEBSRCS) $(GO) build -o $@ $(FLAGS) ./cmd/$(TARGET) -cross-platform: $(TARGET)_linux_amd64 $(TARGET)_darwin_amd64 $(TARGET)_windows_amd64.exe $(TARGET)_linux_arm7 $(TARGET)_linux_arm64 +cross-platform: $(TARGET)_linux_amd64 $(TARGET)_linux_arm7 $(TARGET)_linux_arm64 $(TARGET)_darwin_amd64 $(TARGET)_darwin_arm64 $(TARGET)_windows_amd64.exe $(TARGET)_%_amd64: $(SRCS) $(BLOCKLY) GOOS=$* GOARCH=amd64 $(GO) build -o $@ $(FLAGS) ./cmd/$(TARGET) @@ -54,6 +54,9 @@ $(TARGET)_%_arm64: $(SRCS) $(BLOCKLY) test: $(GO) test -v ./cmd/$(TARGET) ./internal +vulncheck: + govulncheck ./... + clean: rm -f $(EXECUTABLE) $(TARGET)_*_amd64* $(TARGET)_*_amd64.exe diff --git a/internal/unused/bbox.go b/internal/unused/bbox.go deleted file mode 100644 index 0fe1f8c..0000000 --- a/internal/unused/bbox.go +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (C) 2020 Markus L. Noga -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - - -package internal - -import ( - "math" - "github.com/mlnoga/nightlight/internal/fits" - "github.com/mlnoga/nightlight/internal/star" -) - -// Calculate inner and outer bounding boxes for a set of lights. -func BoundingBoxes(lights []*fits.Image) (outer, inner star.Rect2D) { - outer.A.X=float32( math.MaxFloat32) - inner.A.X=float32(-math.MaxFloat32) - inner.B.X=float32( math.MaxFloat32) - outer.B.X=float32(-math.MaxFloat32) - - outer.A.Y=float32( math.MaxFloat32) - inner.A.Y=float32(-math.MaxFloat32) - inner.B.Y=float32( math.MaxFloat32) - outer.B.Y=float32(-math.MaxFloat32) - - for id,lp := range lights { - if lp==nil { continue } - - // Transform image coordiates into reference image coordinates - localP1:=star.Point2D{0,0} - localP2:=star.Point2D{float32(lp.Naxisn[0]), float32(lp.Naxisn[1])} - p1, p2:=lp.Trans.Apply(localP1), lp.Trans.Apply(localP2) - - // Fix mirrors/rotations: ensure p1 has lower X and Y than p2 - if p1.X>p2.X { p1.X, p2.X = p2.X, p1.X } - if p1.Y>p2.Y { p1.Y, p2.Y = p2.Y, p1.Y } - - LogPrintf("%d:bbox %v %v\n", id, p1, p2) - - // Update outer and inner bounding boxes - if p1.Xinner.A.X { inner.A.X=p1.X } - if p2.Xouter.B.X { outer.B.X=p2.X } - - if p1.Yinner.A.Y { inner.A.Y=p1.Y } - if p2.Youter.B.Y { outer.B.Y=p2.Y } - } - return outer, inner -} \ No newline at end of file