mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2024-12-03 10:56:53 +00:00
139 lines
4.4 KiB
YAML
139 lines
4.4 KiB
YAML
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
|
|
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
|
|
|
name: CI
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
pull_request:
|
|
branches: [master]
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
name: "Unit Tests"
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Use Node.js 12.x
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: 12.x
|
|
- run: npm ci
|
|
- run: npm run test
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
name: "Build"
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Use Node.js 12.x
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: 12.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: npm run copyToConsumers
|
|
- uses: actions/upload-artifact@v2
|
|
with:
|
|
name: dist
|
|
path: dist/
|
|
endtoend:
|
|
name: "End to End Tests"
|
|
runs-on: windows-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: southpolesteve/cosmos-emulator-github-action@v1
|
|
- name: Use Node.js 12.x
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: 12.x
|
|
- name: Restore Cypress Binary Cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: ~/.cache/Cypress
|
|
key: ${{ runner.os }}-cypress-binary-cache
|
|
- name: End to End Tests
|
|
run: |
|
|
npm ci
|
|
npm start &
|
|
npm ci --prefix ./cypress
|
|
npm run test:ci --prefix ./cypress -- --spec ./integration/dataexplorer/ci-tests/createDatabase.spec.ts
|
|
shell: bash
|
|
env:
|
|
EMULATOR_ENDPOINT: https://0.0.0.0:8081/
|
|
NODE_TLS_REJECT_UNAUTHORIZED: 0
|
|
CYPRESS_CACHE_FOLDER: ~/.cache/Cypress
|
|
endtoendprodcassandra:
|
|
name: "End to End Tests Prod"
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Use Node.js 12.x
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: 12.x
|
|
- name: Restore Cypress Binary Cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: ~/.cache/Cypress
|
|
key: ${{ runner.os }}-cypress-binary-cache
|
|
- name: End to End Tests
|
|
run: |
|
|
npm ci
|
|
npm start &
|
|
npm ci --prefix ./cypress
|
|
npm run test --prefix ./cypress
|
|
shell: bash
|
|
env:
|
|
EMULATOR_ENDPOINT: https://0.0.0.0:8081/
|
|
NODE_TLS_REJECT_UNAUTHORIZED: 0
|
|
CYPRESS_CACHE_FOLDER: ~/.cache/Cypress
|
|
CONNECTION_STRING: ${{ secrets.CASSANDRA_CONNECTION_STRING }}
|
|
nuget:
|
|
name: Publish Nuget
|
|
needs: [build, test, endtoend]
|
|
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: 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 -Source "$NUGET_SOURCE" -ApiKey Az *.nupkg
|
|
- uses: actions/upload-artifact@v2
|
|
with:
|
|
path: "*.nupkg"
|
|
nugetmpac:
|
|
name: Publish Nuget MPAC
|
|
needs: [build, test, endtoend]
|
|
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: 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 -Source "$NUGET_SOURCE" -ApiKey Az *.nupkg
|
|
- uses: actions/upload-artifact@v2
|
|
with:
|
|
path: "*.nupkg"
|