diff --git a/.github/workflows/pre-merge.yml b/.github/workflows/pre-merge.yml index 174136a..1bb3056 100644 --- a/.github/workflows/pre-merge.yml +++ b/.github/workflows/pre-merge.yml @@ -27,6 +27,20 @@ jobs: gh_token: ${{ secrets.SYS_ORCH_GITHUB }} bootstrap_tools: "go,gotools,nodejs" + - name: Configure cache locations + run: | + echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_ENV + echo "GOMODCACHE=$(go env GOMODCACHE)" >> $GITHUB_ENV + + - name: Cache build artifact + uses: actions/cache@v4 + with: + path: | + ${{ env.GOCACHE }} + ${{ env.GOMODCACHE }} + ~/.cache/golangci-lint + key: ${{ github.repository }}-lint-${{ runner.os }}-go-${{ hashFiles('**/go.mod') }} + - name: Lint code run: make lint @@ -44,6 +58,19 @@ jobs: gh_token: ${{ secrets.SYS_ORCH_GITHUB }} bootstrap_tools: "go,gotools" + - name: Configure cache locations + run: | + echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_ENV + echo "GOMODCACHE=$(go env GOMODCACHE)" >> $GITHUB_ENV + + - name: Cache build artifact + uses: actions/cache@v4 + with: + path: | + ${{ env.GOCACHE }} + ${{ env.GOMODCACHE }} + key: ${{ github.repository }}-build-${{ runner.os }}-go-${{ hashFiles('**/go.mod') }} + - name: Build code run: make build @@ -61,6 +88,19 @@ jobs: gh_token: ${{ secrets.SYS_ORCH_GITHUB }} bootstrap_tools: "go,gotools" + - name: Configure cache locations + run: | + echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_ENV + echo "GOMODCACHE=$(go env GOMODCACHE)" >> $GITHUB_ENV + + - name: Cache build artifact + uses: actions/cache@v4 + with: + path: | + ${{ env.GOCACHE }} + ${{ env.GOMODCACHE }} + key: ${{ github.repository }}-test-${{ runner.os }}-go-${{ hashFiles('**/go.mod') }} + - name: Test code run: make test @@ -81,4 +121,4 @@ jobs: run_docker_build: true run_scan_containers: false run_artifact: false - secrets: inherit \ No newline at end of file + secrets: inherit