## Description Github cache imposes a 10gb limit, after which cache entries will automatically get evictions (LRU policy). Various recent queries have pinned our current cache size at 14-19 gb. The golangci-lint cache alone accounts for 5-9 gb of that usage. Meanwhile, it takes a shorter time for that package to download missing modules than it does to run our tests. This change shuts down the golangci cache in hopes that it improves our branch caching retention. ## Type of change - [x] 💻 CI/Deployment ## Issue(s) * #790 ## Test Plan - [x] 💚 E2E
139 lines
4.8 KiB
YAML
139 lines
4.8 KiB
YAML
name: CI Tests
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
permissions:
|
|
# required to retrieve AWS credentials
|
|
id-token: write
|
|
contents: read
|
|
pull-requests: read
|
|
|
|
# cancel currently running jobs if a new version of the branch is pushed
|
|
concurrency:
|
|
group: ci-linting-${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
|
|
# ----------------------------------------------------------------------------------------------------
|
|
# --- Prechecks and Checkouts ------------------------------------------------------------------------
|
|
# ----------------------------------------------------------------------------------------------------
|
|
precheck:
|
|
uses: alcionai/corso/.github/workflows/_filechange_checker.yml@main
|
|
|
|
checkout:
|
|
needs: precheck
|
|
environment: Testing
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: src
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
# single setup and sum cache handling here.
|
|
# the results will cascade onto both testing and linting.
|
|
- name: Setup Golang with cache
|
|
if: needs.precheck.outputs.fileschanged == 'true'
|
|
uses: magnetikonline/action-golang-cache@v3
|
|
with:
|
|
go-version-file: src/go.mod
|
|
|
|
# ----------------------------------------------------------------------------------------------------
|
|
# --- Integration and Unit Testing -------------------------------------------------------------------
|
|
# ----------------------------------------------------------------------------------------------------
|
|
|
|
Test-Suite:
|
|
needs: [precheck, checkout]
|
|
environment: Testing
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: src
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Setup Golang with cache
|
|
if: needs.precheck.outputs.fileschanged == 'true'
|
|
uses: magnetikonline/action-golang-cache@v3
|
|
with:
|
|
go-version-file: src/go.mod
|
|
|
|
# Install gotestfmt
|
|
- name: Set up gotestfmt
|
|
if: needs.precheck.outputs.fileschanged == 'true'
|
|
run: go install github.com/haveyoudebuggedit/gotestfmt/v2/cmd/gotestfmt@latest
|
|
|
|
# AWS creds
|
|
- name: Configure AWS credentials from Test account
|
|
if: needs.precheck.outputs.fileschanged == 'true'
|
|
uses: aws-actions/configure-aws-credentials@v1
|
|
with:
|
|
role-to-assume: arn:aws:iam::951767375776:role/corso-testing-role
|
|
role-session-name: integration-testing
|
|
aws-region: us-east-1
|
|
|
|
# run the tests
|
|
- name: Integration Tests
|
|
if: needs.precheck.outputs.fileschanged == 'true'
|
|
env:
|
|
CLIENT_ID: ${{ secrets.CLIENT_ID }}
|
|
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
|
|
CORSO_CI_TESTS: true
|
|
CORSO_M356_TEST_USER_ID: ${{ secrets.CORSO_M356_TEST_USER_ID }}
|
|
CORSO_PASSPHRASE: ${{ secrets.INTEGRATION_TEST_CORSO_PASSPHRASE }}
|
|
RUDDERSTACK_CORSO_WRITE_KEY: ${{ secrets.RUDDERSTACK_CORSO_WRITE_KEY }}
|
|
RUDDERSTACK_CORSO_DATA_PLANE_URL: ${{ secrets.RUDDERSTACK_CORSO_DATA_PLANE_URL }}
|
|
TENANT_ID: ${{ secrets.TENANT_ID }}
|
|
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
|
|
if: failure() && needs.precheck.outputs.fileschanged == 'true'
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: test-log
|
|
path: /tmp/gotest.log
|
|
if-no-files-found: error
|
|
|
|
# ----------------------------------------------------------------------------------------------------
|
|
# --- Source Code Linting ----------------------------------------------------------------------------
|
|
# ----------------------------------------------------------------------------------------------------
|
|
|
|
Linting:
|
|
needs: [precheck, checkout]
|
|
environment: Testing
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: src
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Setup Golang with cache
|
|
if: needs.precheck.outputs.fileschanged == 'true'
|
|
uses: magnetikonline/action-golang-cache@v3
|
|
with:
|
|
go-version-file: src/go.mod
|
|
|
|
- name: Go Lint
|
|
if: needs.precheck.outputs.fileschanged == 'true'
|
|
uses: golangci/golangci-lint-action@v3
|
|
with:
|
|
version: v1.45.2
|
|
working-directory: src
|
|
skip-cache: true
|
|
|
|
# check licenses
|
|
- name: Get go-licenses
|
|
if: needs.precheck.outputs.fileschanged == 'true'
|
|
run: go install github.com/google/go-licenses@latest
|
|
|
|
- name: Run go-licenses
|
|
if: needs.precheck.outputs.fileschanged == 'true'
|
|
run: go-licenses check github.com/alcionai/corso/src --ignore github.com/alcionai/corso/src |