Build binary test separately (#399)
* refactor ci caching to ensure go test runs without downloading packages
This commit is contained in:
parent
df63761537
commit
dcbc149aa7
41
.github/workflows/ci.yml
vendored
41
.github/workflows/ci.yml
vendored
@ -22,17 +22,26 @@ jobs:
|
|||||||
- name: Repo Code Checkout
|
- name: Repo Code Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
# Get values for cache paths to be used in later steps
|
||||||
|
- id: go-cache-paths
|
||||||
|
run: |
|
||||||
|
echo "::set-output name=go-build::$(go env GOCACHE)"
|
||||||
|
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
|
||||||
|
|
||||||
|
|
||||||
- name: Golang Setup
|
- name: Golang Setup
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: 1.18
|
go-version: 1.18
|
||||||
|
cache: true
|
||||||
|
cache-dependency-path: src/go.sum
|
||||||
|
|
||||||
# download packages
|
# download packages
|
||||||
- name: Cache Go Mod
|
- name: Cache Go Mod
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
id: cache
|
id: cache
|
||||||
with:
|
with:
|
||||||
path: ~/go/pkg/mod
|
path: ${{ steps.go-cache-paths.outputs.go-mod }}
|
||||||
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
|
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
|
||||||
|
|
||||||
- name: Run go mod download
|
- name: Run go mod download
|
||||||
@ -44,19 +53,16 @@ jobs:
|
|||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
id: mybuild
|
id: mybuild
|
||||||
with:
|
with:
|
||||||
path: ~/.cache/go-build
|
path: ${{ steps.go-cache-paths.outputs.go-build }}
|
||||||
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
|
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
|
||||||
|
|
||||||
- name: Go build
|
- name: Go build
|
||||||
if: steps.mybuild.outputs.cache-hit != 'true'
|
if: steps.mybuild.outputs.cache-hit != 'true'
|
||||||
run: go build ./...
|
run: go build -v ./...
|
||||||
|
|
||||||
# check licenses
|
# Alternatively, install using go install
|
||||||
- name: Get go-licenses
|
- name: Set up gotestfmt
|
||||||
run: go install github.com/google/go-licenses@latest
|
run: go install github.com/haveyoudebuggedit/gotestfmt/v2/cmd/gotestfmt@latest
|
||||||
|
|
||||||
- name: Run go-licenses
|
|
||||||
run: go-licenses check github.com/alcionai/corso --ignore github.com/alcionai/corso
|
|
||||||
|
|
||||||
# AWS creds
|
# AWS creds
|
||||||
- name: Configure AWS credentials from Test account
|
- name: Configure AWS credentials from Test account
|
||||||
@ -67,12 +73,23 @@ jobs:
|
|||||||
aws-region: us-east-1
|
aws-region: us-east-1
|
||||||
|
|
||||||
# run the tests
|
# run the tests
|
||||||
- run: echo "Running ${{ github.repository }} deployment unit tests at ${{ env.TIME_OF_TEST }}."
|
- run: echo "Running ${{ github.repository }} integration tests."
|
||||||
- name: Deployment Tests
|
- name: Integration Tests
|
||||||
env:
|
env:
|
||||||
CORSO_CI_TESTS: true
|
CORSO_CI_TESTS: true
|
||||||
CORSO_PASSWORD: ${{ secrets.INTEGRATION_TEST_CORSO_PASSWORD }}
|
CORSO_PASSWORD: ${{ secrets.INTEGRATION_TEST_CORSO_PASSWORD }}
|
||||||
CLIENT_ID: ${{ secrets.CLIENT_ID }}
|
CLIENT_ID: ${{ secrets.CLIENT_ID }}
|
||||||
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
|
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
|
||||||
TENANT_ID: ${{ secrets.TENANT_ID }}
|
TENANT_ID: ${{ secrets.TENANT_ID }}
|
||||||
run: go test ./...
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
go test -json -v ./... 2>&1 | tee /tmp/gotest.log | gotestfmt -hide successful-tests
|
||||||
|
|
||||||
|
# Upload the original go test log as an artifact for later review.
|
||||||
|
- name: Upload test log
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
if: always()
|
||||||
|
with:
|
||||||
|
name: test-log
|
||||||
|
path: /tmp/gotest.log
|
||||||
|
if-no-files-found: error
|
||||||
7
.github/workflows/lint.yml
vendored
7
.github/workflows/lint.yml
vendored
@ -49,3 +49,10 @@ jobs:
|
|||||||
version: v1.45.2
|
version: v1.45.2
|
||||||
working-directory: ./src
|
working-directory: ./src
|
||||||
skip-pkg-cache: true
|
skip-pkg-cache: true
|
||||||
|
|
||||||
|
# check licenses
|
||||||
|
- name: Get go-licenses
|
||||||
|
run: go install github.com/google/go-licenses@latest
|
||||||
|
|
||||||
|
- name: Run go-licenses
|
||||||
|
run: go-licenses check github.com/alcionai/corso --ignore github.com/alcionai/corso
|
||||||
@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
@ -93,7 +94,7 @@ func (suite *GraphConnectorIntegrationSuite) TestGraphConnector_restoreMessages(
|
|||||||
|
|
||||||
func (suite *GraphConnectorIntegrationSuite) TestGraphConnector_createDeleteFolder() {
|
func (suite *GraphConnectorIntegrationSuite) TestGraphConnector_createDeleteFolder() {
|
||||||
user := "lidiah@8qzvrj.onmicrosoft.com"
|
user := "lidiah@8qzvrj.onmicrosoft.com"
|
||||||
folderName := "createdForTest"
|
folderName := uuid.NewString() // todo - replace with danny's fix #391
|
||||||
aFolder, err := createMailFolder(suite.connector.graphService, user, folderName)
|
aFolder, err := createMailFolder(suite.connector.graphService, user, folderName)
|
||||||
assert.NoError(suite.T(), err, support.ConnectorStackErrorTrace(err))
|
assert.NoError(suite.T(), err, support.ConnectorStackErrorTrace(err))
|
||||||
if aFolder != nil {
|
if aFolder != nil {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user