## Description The current action workflow skips cause requried actions to be marked as passing until they fail, not marked as incomplete until either passed, failed, or skipped. This change should provide the latter behavior. ## Type of change - [x] 🌻 Feature ## Issue(s) * #744 ## Test Plan - [x] 💪 Manual - [ ] ⚡ Unit test - [ ] 💚 E2E
111 lines
3.6 KiB
YAML
111 lines
3.6 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:
|
|
precheck:
|
|
uses: alcionai/corso/.github/workflows/_filechange_checker.yml@issue-744-alt
|
|
|
|
Test-Suite:
|
|
needs: precheck
|
|
environment: Testing
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: src
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3
|
|
|
|
# Get values for cache paths to be used in later steps
|
|
- name: Local Cache Setup
|
|
if: needs.precheck.outputs.fileschanged == 'true'
|
|
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
|
|
if: needs.precheck.outputs.fileschanged == 'true'
|
|
uses: actions/setup-go@v3
|
|
with:
|
|
go-version: 1.18
|
|
cache: true
|
|
cache-dependency-path: src/go.sum
|
|
|
|
# download packages
|
|
- name: Cache Go Mod
|
|
if: needs.precheck.outputs.fileschanged == 'true'
|
|
id: modcache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ${{ steps.go-cache-paths.outputs.go-mod }}
|
|
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
|
|
|
|
- name: Run go mod download
|
|
if: needs.precheck.outputs.fileschanged == 'true' && steps.modcache.outputs.cache-hit != 'true'
|
|
run: go mod download
|
|
|
|
# build the binary
|
|
- name: Cache Go build
|
|
if: needs.precheck.outputs.fileschanged == 'true'
|
|
id: gocache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ${{ steps.go-cache-paths.outputs.go-build }}
|
|
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
|
|
|
|
- name: Go build
|
|
if: needs.precheck.outputs.fileschanged == 'true' && steps.gocache.outputs.cache-hit != 'true'
|
|
run: go build -v ./...
|
|
|
|
# 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 }}
|
|
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: needs.precheck.outputs.fileschanged == 'true'
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: test-log
|
|
path: /tmp/gotest.log
|
|
if-no-files-found: error |