diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index c54182c..575e226 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -16,16 +16,10 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: stable + go-version-file: go.mod - - name: Install Goreleaser - uses: goreleaser/goreleaser-action@v6 - with: - version: "v2.8.2" - install-only: true - - - name: Build railcar binaries - run: make railcar-build-binaries + - name: make placeholder assets + run: make asset-placeholders - name: golangci-lint uses: golangci/golangci-lint-action@v7 diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml new file mode 100644 index 0000000..8c5eb1a --- /dev/null +++ b/.github/workflows/unit-tests.yml @@ -0,0 +1,27 @@ +name: Unit tests + +on: + pull_request: # triggers on every push to a PR + +permissions: + contents: read # checkout needs this + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout source + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + # Reads version from go.mod; override with a specific version if you prefer + go-version-file: go.mod + + - name: make placeholder assets + run: make asset-placeholders + + - name: Run unit tests with the race detector + run: make test-go diff --git a/Makefile b/Makefile index afcca87..ccc8176 100644 --- a/Makefile +++ b/Makefile @@ -9,10 +9,30 @@ build-all: railcar-build-binaries build-freight railcar-build-binaries: goreleaser release --snapshot --clean --config=./assets/.goreleaser.yaml -.Phony: go-test -go-test: +.Phony: test-go +test-go: go test ./... --race .Phony: lint lint: - golangci-lint run \ No newline at end of file + golangci-lint run + + +.Phony: asset-placeholders +asset-placeholders: + mkdir -p assets/dist/conductor_darwin_amd64_v1 \ + assets/dist/conductor_darwin_arm64_v8.0 \ + assets/dist/conductor_linux_amd64_v1 \ + assets/dist/conductor_linux_arm64_v8.0 \ + assets/dist/conductor_linux_arm_6 \ + assets/dist/conductor_windows_amd64_v1 \ + assets/dist/conductor_windows_arm64_v8.0 \ + assets/dist/conductor_windows_arm_6 + touch assets/dist/conductor_darwin_amd64_v1/conductor \ + assets/dist/conductor_darwin_arm64_v8.0/conductor \ + assets/dist/conductor_linux_amd64_v1/conductor \ + assets/dist/conductor_linux_arm64_v8.0/conductor \ + assets/dist/conductor_linux_arm_6/conductor \ + assets/dist/conductor_windows_amd64_v1/conductor.exe \ + assets/dist/conductor_windows_arm64_v8.0/conductor.exe \ + assets/dist/conductor_windows_arm_6/conductor.exe