From dce9cee2bdd3431104d1e6e98b95149dd8f7d1a8 Mon Sep 17 00:00:00 2001 From: Guilhem Lettron Date: Thu, 23 Jun 2022 16:29:39 +0200 Subject: [PATCH 1/3] ci: add actions go --- .github/workflows/go.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/go.yml diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..8860de6 --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,25 @@ +name: Go + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: 1.18 + + - name: Build + run: go build -v ./... + + - name: Test + run: go test -v ./... From 19341b3cf6c1cdbd1d047073962461bd372990d1 Mon Sep 17 00:00:00 2001 From: Guilhem Lettron Date: Thu, 23 Jun 2022 16:33:52 +0200 Subject: [PATCH 2/3] Update go.yml --- .github/workflows/go.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 8860de6..1a7fa97 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -12,6 +12,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + with: + fetch-depth: 2 - name: Set up Go uses: actions/setup-go@v3 @@ -19,7 +21,11 @@ jobs: go-version: 1.18 - name: Build - run: go build -v ./... + run: make build - name: Test - run: go test -v ./... + run: make test + + # Test if anything changed (maining a generator or manifest changed + - name: git diff + run: git diff --no-ext-diff --quiet --exit-code From 31e2c6f2369f24e883da870825f90cb94934a7ff Mon Sep 17 00:00:00 2001 From: Guilhem Lettron Date: Thu, 23 Jun 2022 16:40:33 +0200 Subject: [PATCH 3/3] add cache --- .github/workflows/go.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 1a7fa97..4f4ddcf 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -19,6 +19,16 @@ jobs: uses: actions/setup-go@v3 with: go-version: 1.18 + + - name: Cache + uses: actions/cache@v3 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- - name: Build run: make build