adding appInsights #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: cdp | |
env: | |
VERCEL_ORG_ID: ${{secrets.VERCEL_ORG_ID}} | |
VERCEL_PROJECT_ID: ${{secrets.VERCEL_PROJECT_ID}} | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
types: [opened, synchronize, reopened] | |
workflow_dispatch: | |
branches: [master] | |
jobs: | |
createbuildvars: | |
name: Create build variables | |
runs-on: ubuntu-latest | |
outputs: | |
buildversion: ${{steps.createbuildversion.outputs.buildversion}} | |
buildcommit: ${{steps.createbuildcommit.outputs.buildcommit}} | |
steps: | |
- id: createbuildversion | |
run: echo "buildversion=$(date +'%y.%m%d').${{github.run_number}}" >> "$GITHUB_OUTPUT" | |
- id: createbuildcommit | |
run: echo "buildcommit=${{github.sha}}" >> "$GITHUB_OUTPUT" | |
build-test-rust: | |
needs: createbuildvars | |
name: Build & test rust | |
strategy: | |
matrix: | |
os: | |
- windows-latest | |
runs-on: ${{matrix.os}} | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v2 | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- name: Run cargo build | |
continue-on-error: false | |
run: | | |
cd lib | |
cargo build --release --examples | |
- name: Run cargo test | |
continue-on-error: false | |
run: | | |
cd lib | |
cargo test --release | |
shell: pwsh | |
lint-rust: | |
needs: createbuildvars | |
name: Lint rust | |
strategy: | |
matrix: | |
os: | |
- windows-latest | |
runs-on: ${{matrix.os}} | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v2 | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
components: rustfmt, clippy | |
- name: Run cargo fmt | |
continue-on-error: false | |
run: | | |
cd lib | |
cargo fmt --all -- --check | |
- name: Run cargo clippy | |
continue-on-error: false | |
run: | | |
cd lib | |
cargo clippy --all-targets --all-features -- -D warnings | |
build-lint-test-web: | |
needs: createbuildvars | |
strategy: | |
matrix: | |
os: | |
- windows-latest | |
runs-on: ${{matrix.os}} | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- uses: pnpm/action-setup@v4 | |
name: Install pnpm | |
with: | |
version: 9 | |
run_install: false | |
- name: Install Vercel CLI | |
run: npm install --global vercel@latest | |
- name: Install wasm-pack | |
continue-on-error: false | |
run: | | |
cd lib | |
cargo install wasm-pack | |
- name: Run wasm-pack | |
continue-on-error: false | |
run: | | |
cd lib | |
wasm-pack build --release | |
- name: Install npm packages | |
run: | | |
cd web | |
pnpm install --frozen-lockfile --strict-peer-dependencies | |
- name: Check code format | |
run: | | |
cd web | |
pnpm format | |
- name: Lint code | |
run: | | |
cd web | |
pnpm lint | |
- name: Test | |
run: | | |
cd web | |
pnpm test | |
- name: Build & deploy | |
run: | | |
cd web | |
cmd /c set VITE_ | |
vercel pull --yes --environment=production --token=${{secrets.VERCEL_TOKEN}} | |
vercel build --prod --token=${{secrets.VERCEL_TOKEN}} | |
vercel deploy --prebuilt --prod --token=${{secrets.VERCEL_TOKEN}} | |
env: | |
VITE_APP_VERSION: ${{needs.createbuildvars.outputs.buildversion}} | |
VITE_APP_COMMIT_ID: ${{needs.createbuildvars.outputs.buildcommit}} | |
VITE_APP_AI_INSTRUMENTATION_KEY: ${{secrets.AZURE_CREDENTIALS_KSAPPLICATIONS_AI_KEY}} | |
build-lint-test-py: | |
continue-on-error: true # TODO: Temporary hack till we figure out whats wrong with python setup on GitHub | |
needs: createbuildvars | |
name: Build & Test python | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
runs-on: ${{matrix.os}} | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Install python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11.0' | |
cache: 'pip' # caching pip dependencies | |
- name: Install requirements.txt | |
run: | | |
cd ml | |
conda update conda | |
conda update anaconda | |
python --version | |
pip --version | |
pip install --upgrade wheel | |
pip install -r requirements.txt | |
- name: Run lint | |
run: | | |
cd ml | |
pylint *.py **/*.py | |
- name: Check code format | |
run: | | |
cd ml | |
black --check --diff . | |
- name: Check notebooks are clean | |
run: | | |
cd ml | |
nb-clean check *.ipynb -e -M | |
- name: Running tests | |
continue-on-error: false | |
run: | | |
cd ml | |
nose2 | |
finish: | |
name: Waiting on rest of the jobs | |
needs: [build-test-rust, lint-rust, build-lint-test-web, build-lint-test-py] | |
runs-on: windows-latest | |
steps: | |
- run: | | |
echo done... |