Skip to content

Commit

Permalink
Speed Up Github Action (#260)
Browse files Browse the repository at this point in the history
* fixed go cache

* speedup

* speedup

* Update build-test.yml

* debug

* added todo

* divide test and end2end test into two seprate jobs

* fix other jobs
  • Loading branch information
y-bruin authored Nov 26, 2024
1 parent 3aad0ca commit 3a0ce0c
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 13 deletions.
40 changes: 31 additions & 9 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ on:
- 'package.json'
- 'package-lock.json'

# concurrency:
# group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
# cancel-in-progress: true
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build:
test:
strategy:
matrix:
platform: [ ubuntu-latest, windows-latest ]
Expand All @@ -40,11 +40,30 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Golang with cache
uses: magnetikonline/action-golang-cache@v5
# TODO: Replace with actions/setup-go once issue is resolved https://github.com/actions/setup-go/pull/515
- name: Setup Go
uses: antontroshin/setup-go@windows-go-mod-cache
with:
go-version-file: go.mod
go-version-file: 'go.mod'
cache-dependency-path: "go.sum"
- run: make test


end2end:
strategy:
matrix:
platform: [ ubuntu-latest, windows-latest ]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# TODO: Replace with actions/setup-go once issue is resolved https://github.com/actions/setup-go/pull/515
- name: Setup Go
uses: antontroshin/setup-go@windows-go-mod-cache
with:
go-version-file: 'go.mod'
cache-dependency-path: "go.sum"
- name: Install winget
if: matrix.platform == 'windows-latest'
uses: Cyberboss/install-winget@v1
Expand Down Expand Up @@ -77,9 +96,12 @@ jobs:
msystem: UCRT64
update: true
install: git mingw-w64-ucrt-x86_64-gcc
- uses: actions/setup-go@v4
# TODO: Replace with actions/setup-go once issue is resolved https://github.com/actions/setup-go/pull/515
- name: Setup Go
uses: antontroshin/setup-go@windows-go-mod-cache
with:
go-version-file: 'go.mod'
cache-dependency-path: "go.sum"
- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
Expand All @@ -96,7 +118,7 @@ jobs:

steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'

Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Golang with cache
uses: magnetikonline/action-golang-cache@v5
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
go-version-file: 'go.mod'
cache-dependency-path: "go.sum"
- run: make test
- name: Install winget
if: matrix.platform == 'windows-2022'
Expand All @@ -45,6 +46,7 @@ jobs:
- uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
cache-dependency-path: "go.sum"
- shell: bash
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: cache darwin
Expand Down Expand Up @@ -74,6 +76,7 @@ jobs:
- uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
cache-dependency-path: "go.sum"
- shell: bash
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: cache linux
Expand Down Expand Up @@ -133,9 +136,12 @@ jobs:
msystem: UCRT64
update: true
install: git mingw-w64-ucrt-x86_64-gcc
- uses: actions/setup-go@v4
# TODO: Replace with actions/setup-go once issue is resolved https://github.com/actions/setup-go/pull/515
- name: Setup Go
uses: antontroshin/setup-go@windows-go-mod-cache
with:
go-version-file: 'go.mod'
cache-dependency-path: "go.sum"
- name: Release
uses: goreleaser/goreleaser-action@v6
with:
Expand Down

0 comments on commit 3a0ce0c

Please sign in to comment.