name: CI on: push: branches: - master - hotfix/** - release/** pull_request: branches: - master jobs: codemetrics: runs-on: ubuntu-latest name: "Log Code Metrics" if: github.ref == 'refs/heads/master' 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: 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 - name: Use Node.js 14.x uses: actions/setup-node@v1 with: 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 - name: Use Node.js 14.x uses: actions/setup-node@v1 with: node-version: 14.x - run: npm ci - run: npm run format:check lint: runs-on: ubuntu-latest name: "Lint" 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 run lint unittest: runs-on: ubuntu-latest name: "Unit Tests" 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 run test build: runs-on: ubuntu-latest needs: [lint, format, compile, unittest] name: "Build" 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 run build:contracts - name: Restore Build Cache uses: actions/cache@v2 with: path: .cache key: ${{ runner.os }}-build-cache - run: npm run pack:prod - run: cp -r ./Contracts ./dist/contracts - run: cp -r ./configs ./dist/configs - uses: actions/upload-artifact@v2 with: name: dist path: dist/ endtoendemulator: name: "End To End Emulator Tests" if: github.ref == 'refs/heads/master' || contains(github.ref, 'hotfix/') || contains(github.ref, 'release/') runs-on: windows-latest steps: - uses: actions/checkout@v2 - name: Use Node.js 14.x uses: actions/setup-node@v1 with: 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 if: failure() with: name: screenshots path: failed-* accessibility: name: "Accessibility | Hosted" needs: [lint, format, compile, unittest] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Use Node.js 14.x uses: actions/setup-node@v1 with: node-version: 14.x - name: Accessibility Check run: | # Ubuntu gets mad when webpack runs too many files watchers cat /proc/sys/fs/inotify/max_user_watches sudo sysctl fs.inotify.max_user_watches=524288 sudo sysctl -p npm ci npm start & npx wait-on -i 5000 https-get://0.0.0.0:1234/ node utils/accesibilityCheck.js shell: bash env: NODE_TLS_REJECT_UNAUTHORIZED: 0 endtoendhosted: name: "End to End Tests" needs: [cleanupaccounts] runs-on: ubuntu-latest env: NODE_TLS_REJECT_UNAUTHORIZED: 0 PORTAL_RUNNER_SUBSCRIPTION: ${{ secrets.PORTAL_RUNNER_SUBSCRIPTION }} PORTAL_RUNNER_RESOURCE_GROUP: ${{ secrets.PORTAL_RUNNER_RESOURCE_GROUP }} PORTAL_RUNNER_DATABASE_ACCOUNT: ${{ secrets.PORTAL_RUNNER_DATABASE_ACCOUNT }} PORTAL_RUNNER_DATABASE_ACCOUNT_KEY: ${{ secrets.PORTAL_RUNNER_DATABASE_ACCOUNT_KEY }} PORTAL_RUNNER_MONGO_DATABASE_ACCOUNT: ${{ secrets.PORTAL_RUNNER_MONGO_DATABASE_ACCOUNT }} PORTAL_RUNNER_MONGO_DATABASE_ACCOUNT_KEY: ${{ secrets.PORTAL_RUNNER_MONGO_DATABASE_ACCOUNT_KEY }} NOTEBOOKS_TEST_RUNNER_TENANT_ID: ${{ secrets.NOTEBOOKS_TEST_RUNNER_TENANT_ID }} NOTEBOOKS_TEST_RUNNER_CLIENT_ID: ${{ secrets.NOTEBOOKS_TEST_RUNNER_CLIENT_ID }} NOTEBOOKS_TEST_RUNNER_CLIENT_SECRET: ${{ secrets.NOTEBOOKS_TEST_RUNNER_CLIENT_SECRET }} PORTAL_RUNNER_CONNECTION_STRING: ${{ secrets.CONNECTION_STRING_SQL }} MONGO_CONNECTION_STRING: ${{ secrets.CONNECTION_STRING_MONGO }} CASSANDRA_CONNECTION_STRING: ${{ secrets.CONNECTION_STRING_CASSANDRA }} TABLES_CONNECTION_STRING: ${{ secrets.CONNECTION_STRING_TABLE }} DATA_EXPLORER_ENDPOINT: "https://localhost:1234/hostedExplorer.html" strategy: fail-fast: false matrix: test-file: - ./test/cassandra/container.spec.ts - ./test/mongo/mongoIndexPolicy.spec.ts - ./test/notebooks/uploadAndOpenNotebook.spec.ts - ./test/selfServe/selfServeExample.spec.ts - ./test/sql/container.spec.ts - ./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: node utils/cleanupDBs.js - run: npm run wait-for-server - name: ${{ matrix['test-file'] }} run: npx jest -c ./jest.config.e2e.js --detectOpenHandles ${{ matrix['test-file'] }} shell: bash - uses: actions/upload-artifact@v2 if: failure() with: name: screenshots path: failed-* cleanupaccounts: name: "Cleanup Test Database Accounts" runs-on: ubuntu-latest env: NOTEBOOKS_TEST_RUNNER_CLIENT_ID: ${{ secrets.NOTEBOOKS_TEST_RUNNER_CLIENT_ID }} NOTEBOOKS_TEST_RUNNER_CLIENT_SECRET: ${{ secrets.NOTEBOOKS_TEST_RUNNER_CLIENT_SECRET }} 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: node utils/cleanupDBs.js nuget: name: Publish Nuget if: github.ref == 'refs/heads/master' || contains(github.ref, 'hotfix/') || contains(github.ref, 'release/') needs: [build] 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 "GitHub" -Password "$AZURE_DEVOPS_PAT" - run: nuget pack -Version "2.0.0-github-${GITHUB_SHA}" - run: nuget push -SkipDuplicate -Source "$NUGET_SOURCE" -ApiKey Az *.nupkg - uses: actions/upload-artifact@v2 name: packages with: path: "*.nupkg" nugetmpac: name: Publish Nuget MPAC if: github.ref == 'refs/heads/master' || contains(github.ref, 'hotfix/') || contains(github.ref, 'release/') needs: [build] 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 - 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 "GitHub" -Password "$AZURE_DEVOPS_PAT" - run: nuget pack -Version "2.0.0-github-${GITHUB_SHA}" - run: nuget push -SkipDuplicate -Source "$NUGET_SOURCE" -ApiKey Az *.nupkg - uses: actions/upload-artifact@v2 name: packages with: path: "*.nupkg"