Skip to content

Commit

Permalink
Add build caching
Browse files Browse the repository at this point in the history
  • Loading branch information
Y0sh1dk committed Dec 16, 2023
1 parent 22e9fff commit deb819c
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ on:

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
Expand All @@ -29,6 +30,7 @@ jobs:
task lint
build:
name: Build
needs: [lint]
runs-on: ubuntu-latest
permissions:
Expand All @@ -51,7 +53,8 @@ jobs:
file_pattern: "bin/*"

test:
needs: [lint]
name: Test
needs: [lint, build]
runs-on: ubuntu-latest
permissions:
contents: write
Expand All @@ -73,7 +76,8 @@ jobs:
run: |
ACTION_VERSION=${{ github.head_ref }} task gen-tests
- uses: stefanzweifel/git-auto-commit-action@v5
- name: Commit generated tests
uses: stefanzweifel/git-auto-commit-action@v5
if: github.event_name == 'pull_request'
with:
commit_message: "[skip ci] Update tests"
Expand All @@ -92,6 +96,7 @@ jobs:
wait_workflow: true

- name: Delete branch
if: always()
run: |
echo "Deleting branch ${{ steps.generate_branch.outputs.branch }}..."
git push origin --delete ${{ steps.generate_branch.outputs.branch }}
1 change: 1 addition & 0 deletions .task/checksum/build
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
90d25729e1f7ca52ae1ce10d633ebc69
11 changes: 8 additions & 3 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,15 @@ tasks:
<<: *go-docker
internal: false
desc: Build the application
env:
GOOS: "{{OS}}"
GOARCH: "{{ARCH}}"
sources:
- "*.go"
- "go.mod"
- "go.sum"
generates:
- "bin/{{ .GIT_REPO_NAME }}-{{ .GOOS }}-{{ .GOARCH }}"
vars:
GOOS: "{{ .GOOS | default OS }}"
GOARCH: "{{ .GOARCH | default ARCH}}"
COMMAND: go build -o bin/{{ .GIT_REPO_NAME }}-{{ .GOOS }}-{{ .GOARCH }} *.go {{ .CLI_ARGS }}

gen-tests:
Expand Down
Binary file modified bin/gha-docker-image-exists-linux-amd64
Binary file not shown.
Binary file modified bin/gha-docker-image-exists-linux-arm64
Binary file not shown.

0 comments on commit deb819c

Please sign in to comment.