82 lines
2.3 KiB
YAML
82 lines
2.3 KiB
YAML
name: CI
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
permissions:
|
|
# required to retrieve AWS credentials
|
|
id-token: write
|
|
# required to retrieve repository
|
|
contents: read
|
|
|
|
jobs:
|
|
Run-All:
|
|
environment: Testing
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: src
|
|
steps:
|
|
- name: Repo Code Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Golang Setup
|
|
uses: actions/setup-go@v3
|
|
with:
|
|
go-version: 1.18
|
|
|
|
- name: go-cache-paths
|
|
run: |
|
|
echo "::set-output name=go-build::$(go env GOCACHE)"
|
|
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
|
|
|
|
- name: Cache Go build
|
|
uses: actions/cache@v3
|
|
id: mybuild
|
|
with:
|
|
path: ~/.cache/go-build
|
|
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
|
|
|
|
- name: Cache Go Mod
|
|
uses: actions/cache@v3
|
|
id: cache
|
|
with:
|
|
path: ~/go/pkg/mod
|
|
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
|
|
|
|
- name: Run go mod download
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
run: go mod download
|
|
|
|
- name: Go build
|
|
if: steps.mybuild.outputs.cache-hit != 'true'
|
|
run: go build ./...
|
|
|
|
- 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
|
|
|
|
- name: Run gofmt
|
|
run: if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi
|
|
|
|
- name: Configure AWS credentials from Test account
|
|
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: echo "Running ${{ github.repository }} deployment unit tests at ${{ env.TIME_OF_TEST }}."
|
|
- name: Deployment Tests
|
|
env:
|
|
CORSO_CI_TESTS: true
|
|
CORSO_PASSWORD: ${{ secrets.INTEGRATION_TEST_CORSO_PASSWORD }}
|
|
CLIENT_ID: ${{ secrets.CLIENT_ID }}
|
|
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
|
|
TENANT_ID: ${{ secrets.TENANT_ID }}
|
|
run: go test ./...
|