From 0e18de0bc94a2ce3cbbf94fd105669369b034f00 Mon Sep 17 00:00:00 2001 From: Gaurav Kumar Date: Tue, 24 Sep 2024 00:03:09 +0200 Subject: [PATCH] Repository upkeep (#361) * Added github action to Build and Test the repository * Removed the comment * Adding github actions for build and test on every push to the master branch * Corrected the go list command * Renamed the build and test file --------- Co-authored-by: Gaurav Kumar --- .github/workflows/build-and-test.yaml | 30 +++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/build-and-test.yaml diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml new file mode 100644 index 000000000..6863c0a53 --- /dev/null +++ b/.github/workflows/build-and-test.yaml @@ -0,0 +1,30 @@ +name: Build and Test + +on: [push] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + go-version: [ '1.21', '1.22' , '1.23' ] + steps: + - uses: actions/checkout@v4 + - name: Set up Go ${{ matrix.go-version }} + uses: actions/setup-go@v5 + with: + go-version: ${{ matrix.go-version }} + - name: Display Go version + run: go version + - name: Install dependencies + run: go mod download + - name: Build + run: go build -v ./... + - name: Test with the Go CLI + run: go test $(go list ./...) -cover -json > TestResults-${{ matrix.go-version }}.json + - name: Upload Go test results + uses: actions/upload-artifact@v4 + with: + name: Go-results-${{ matrix.go-version }} + path: TestResults-${{ matrix.go-version }}.json