cosmos-explorer/.github/workflows/ci.yml

217 lines
7.2 KiB
YAML
Raw Normal View History

name: CI
2020-05-26 20:44:36 +01:00
on:
push:
branches:
- master
2020-09-25 22:44:15 +01:00
- hotfix/**
- release/**
2020-05-26 20:44:36 +01:00
pull_request:
branches:
- master
2020-05-26 20:44:36 +01:00
jobs:
2021-01-26 19:13:13 +00:00
codemetrics:
runs-on: ubuntu-latest
name: "Log Code Metrics"
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
2021-03-15 03:53:16 +00:00
- name: Use Node.js 14.x
2021-01-26 19:13:13 +00:00
uses: actions/setup-node@v1
with:
2021-03-15 03:53:16 +00:00
node-version: 14.x
2021-01-26 19:13:13 +00:00
- run: npm ci
- run: node utils/codeMetrics.js
env:
CODE_METRICS_APP_ID: ${{ secrets.CODE_METRICS_APP_ID }}
compile:
runs-on: ubuntu-latest
name: "Compile TypeScript"
steps:
- uses: actions/checkout@v2
2021-03-15 03:53:16 +00:00
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
2021-03-15 03:53:16 +00:00
node-version: 14.x
- run: npm ci
- run: npm run compile
- run: npm run compile:strict
format:
runs-on: ubuntu-latest
name: "Check Format"
steps:
- uses: actions/checkout@v2
2021-03-15 03:53:16 +00:00
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
2021-03-15 03:53:16 +00:00
node-version: 14.x
- run: npm ci
- run: npm run format:check
lint:
runs-on: ubuntu-latest
name: "Lint"
steps:
- uses: actions/checkout@v2
2021-03-15 03:53:16 +00:00
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
2021-03-15 03:53:16 +00:00
node-version: 14.x
- run: npm ci
- run: npm run lint
unittest:
2020-05-26 20:44:36 +01:00
runs-on: ubuntu-latest
name: "Unit Tests"
2020-05-26 20:44:36 +01:00
steps:
- uses: actions/checkout@v2
2021-03-15 03:53:16 +00:00
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
2021-03-15 03:53:16 +00:00
node-version: 14.x
- run: npm ci
- run: npm run test
2020-05-26 20:44:36 +01:00
build:
runs-on: ubuntu-latest
name: "Build"
2020-05-26 20:44:36 +01:00
steps:
- uses: actions/checkout@v2
2021-03-15 03:53:16 +00:00
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
2021-03-15 03:53:16 +00:00
node-version: 14.x
- run: npm ci
2020-05-30 02:14:09 +01:00
- run: npm run build:contracts
- name: Restore Build Cache
uses: actions/cache@v2
with:
path: .cache
key: ${{ runner.os }}-build-cache
- run: npm run pack:prod
2020-06-12 18:33:00 +01:00
- run: cp -r ./Contracts ./dist/contracts
- run: cp -r ./configs ./dist/configs
2020-05-30 02:14:09 +01:00
- uses: actions/upload-artifact@v2
with:
name: dist
path: dist/
2021-04-02 18:24:01 +01:00
- name: Upload build to preview blob storage
run: az storage blob upload-batch -d '$web' -s 'dist' --account-name cosmosexplorerpreview --destination-path "${{github.event.pull_request.head.sha || github.sha}}" --account-key="${PREVIEW_STORAGE_KEY}" --overwrite true
2021-04-02 18:24:01 +01:00
env:
PREVIEW_STORAGE_KEY: ${{ secrets.PREVIEW_STORAGE_KEY }}
- name: Upload preview config to blob storage
run: az storage blob upload -c '$web' -f ./preview/config.json --account-name cosmosexplorerpreview --name "${{github.event.pull_request.head.sha || github.sha}}/config.json" --account-key="${PREVIEW_STORAGE_KEY}" --overwrite true
2021-04-02 18:24:01 +01:00
env:
PREVIEW_STORAGE_KEY: ${{ secrets.PREVIEW_STORAGE_KEY }}
endtoendemulator:
name: "End To End Emulator Tests"
2021-04-21 19:33:19 +01:00
# Temporarily disabled. This test needs to be rewritten in playwright
if: false
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
2021-03-15 03:53:16 +00:00
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
2021-03-15 03:53:16 +00:00
node-version: 14.x
- uses: southpolesteve/cosmos-emulator-github-action@v1
- name: End to End Tests
run: |
npm ci
npm start &
npm run wait-for-server
npx jest -c ./jest.config.e2e.js --detectOpenHandles test/sql/container.spec.ts
shell: bash
env:
DATA_EXPLORER_ENDPOINT: "https://localhost:1234/explorer.html?platform=Emulator"
PLATFORM: "Emulator"
NODE_TLS_REJECT_UNAUTHORIZED: 0
- uses: actions/upload-artifact@v2
2020-12-18 22:08:40 +00:00
if: failure()
with:
name: screenshots
path: failed-*
2021-04-20 04:08:25 +01:00
endtoend:
name: "E2E"
runs-on: ubuntu-latest
env:
NODE_TLS_REJECT_UNAUTHORIZED: 0
NOTEBOOKS_TEST_RUNNER_CLIENT_SECRET: ${{ secrets.NOTEBOOKS_TEST_RUNNER_CLIENT_SECRET }}
strategy:
2021-03-15 03:53:16 +00:00
fail-fast: false
matrix:
test-file:
- ./test/cassandra/container.spec.ts
2021-05-05 05:01:13 +01:00
- ./test/graph/container.spec.ts
- ./test/sql/container.spec.ts
2021-04-20 04:08:25 +01:00
- ./test/mongo/container.spec.ts
2021-05-12 19:41:44 +01:00
- ./test/mongo/container32.spec.ts
2021-04-20 04:08:25 +01:00
- ./test/selfServe/selfServeExample.spec.ts
2021-08-16 17:35:21 +01:00
# - ./test/notebooks/upload.spec.ts // TEMP disabled since notebooks service is off
- ./test/sql/resourceToken.spec.ts
- ./test/tables/container.spec.ts
steps:
- uses: actions/checkout@v2
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- run: npm ci
- run: npm start &
- run: npm run wait-for-server
- name: ${{ matrix['test-file'] }}
2021-04-21 17:01:16 +01:00
run: |
# Run tests up to three times
2021-04-21 18:45:34 +01:00
for i in $(seq 1 3); do npx jest -c ./jest.config.playwright.js ${{ matrix['test-file'] }} && s=0 && break || s=$? && sleep 1; done; (exit $s)
shell: bash
- uses: actions/upload-artifact@v2
2020-12-18 22:08:40 +00:00
if: failure()
with:
name: screenshots
2021-04-20 04:08:25 +01:00
path: screenshots/
2020-05-30 02:14:09 +01:00
nuget:
name: Publish Nuget
if: github.ref == 'refs/heads/master' || contains(github.ref, 'hotfix/') || contains(github.ref, 'release/')
needs: [build]
2020-05-30 02:14:09 +01:00
runs-on: ubuntu-latest
env:
NUGET_SOURCE: ${{ secrets.NUGET_SOURCE }}
AZURE_DEVOPS_PAT: ${{ secrets.AZURE_DEVOPS_PAT }}
steps:
- uses: nuget/setup-nuget@v1
with:
nuget-api-key: ${{ secrets.NUGET_API_KEY }}
- name: Download Dist Folder
uses: actions/download-artifact@v2
with:
name: dist
- run: cp ./configs/prod.json config.json
- run: nuget sources add -Name "ADO" -Source "$NUGET_SOURCE" -UserName "jawelton@microsoft.com" -Password "$AZURE_DEVOPS_PAT"
2020-05-30 02:14:09 +01:00
- run: nuget pack -Version "2.0.0-github-${GITHUB_SHA}"
- run: nuget push -SkipDuplicate -Source "$NUGET_SOURCE" -ApiKey Az *.nupkg
2020-05-30 02:14:09 +01:00
- uses: actions/upload-artifact@v2
name: packages
2020-05-30 02:14:09 +01:00
with:
path: "*.nupkg"
nugetmpac:
name: Publish Nuget MPAC
if: github.ref == 'refs/heads/master' || contains(github.ref, 'hotfix/') || contains(github.ref, 'release/')
needs: [build]
2020-05-30 02:14:09 +01:00
runs-on: ubuntu-latest
env:
NUGET_SOURCE: ${{ secrets.NUGET_SOURCE }}
AZURE_DEVOPS_PAT: ${{ secrets.AZURE_DEVOPS_PAT }}
steps:
- uses: nuget/setup-nuget@v1
with:
nuget-api-key: ${{ secrets.NUGET_API_KEY }}
- name: Download Dist Folder
uses: actions/download-artifact@v2
with:
name: dist
- run: cp ./configs/mpac.json config.json
2020-05-30 02:14:09 +01:00
- run: sed -i 's/Azure.Cosmos.DB.Data.Explorer/Azure.Cosmos.DB.Data.Explorer.MPAC/g' DataExplorer.nuspec
- run: nuget sources add -Name "ADO" -Source "$NUGET_SOURCE" -UserName "jawelton@microsoft.com" -Password "$AZURE_DEVOPS_PAT"
2020-05-30 02:14:09 +01:00
- run: nuget pack -Version "2.0.0-github-${GITHUB_SHA}"
- run: nuget push -SkipDuplicate -Source "$NUGET_SOURCE" -ApiKey Az *.nupkg
2020-05-30 02:14:09 +01:00
- uses: actions/upload-artifact@v2
name: packages
2020-05-30 02:14:09 +01:00
with:
path: "*.nupkg"