diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7c33ca7..d8b7cbd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build +name: Build & Test on: - push - pull_request @@ -8,7 +8,30 @@ env: NAME: stargazer jobs: + test: + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/setup-go@v3 + with: + go-version: ${{ env.GOVER }} + - uses: actions/checkout@v3 + - uses: actions/cache@v3 + with: + path: | + ~/go/pkg/mod + ~/.cache/go-build + ~/Library/Caches/go-build + ~\AppData\Local\go-build + key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go-${{ matrix.go-version }}- + - run: go test ./... + build: + needs: test name: build runs-on: ubuntu-latest strategy: @@ -42,10 +65,6 @@ jobs: with: go-version: ${{ env.GOVER }} - - name: Run tests - working-directory: pkg/stargazer - run: go test - - name: Build env: GOOS: ${{ matrix.GOOS }} @@ -63,4 +82,3 @@ jobs: name: ${{env.NAME}}-${{ matrix.GOOS }}-${{ matrix.GOARCH }}-${{github.sha}} path: dist/* retention-days: 90 -