Improving UI for rest api try #728
Workflow file for this run
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
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | |
name: Build | |
on: | |
push: | |
branches: [ "main" ] | |
paths: | |
- 'sdk/**' | |
- 'tools/**' | |
- 'samples/**' | |
- 'experimental/**' | |
pull_request: | |
branches: [ "main" ] | |
paths: | |
- 'sdk/**' | |
- 'tools/**' | |
- 'samples/**' | |
- 'experimental/**' | |
jobs: | |
javascript: | |
name: Build and Test JS code and samples | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x] | |
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | |
dotnet-version: [6.x] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- name: Test VSCode Extension | |
# See https://code.visualstudio.com/api/working-with-extensions/continuous-integration#github-actions | |
run: cd ./tools/vscode-azurewebpubsub && npm install && xvfb-run -a npm run test && cd ../../ | |
if: runner.os == 'Linux' | |
- name: Install and Test All Samples | |
run: | | |
find ./samples/javascript ./experimental -name 'node_modules' -prune -o -name 'package.json' -print0 | while IFS= read -r -d '' file; do | |
dir=$(dirname "$file") | |
echo "Processing directory: $dir" | |
cd "$dir" | |
echo "Installing dependencies in $dir" | |
npm install | |
echo "Running tests in $dir" | |
npm run test | |
echo "Finished tests in $dir" | |
cd - > /dev/null | |
done | |
- run: npm install -g yarn | |
- run: yarn install | |
- run: yarn workspaces run test | |
- name: Setup .NET ${{ matrix.dotnet-version }} | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: ${{ matrix.dotnet-version }} | |
- name: Build C# samples | |
run: dotnet build samples/csharp/samples.sln | |
csharp: | |
name: Build and Test C# | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
dotnet-version: [6.x] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET ${{ matrix.dotnet-version }} | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: ${{ matrix.dotnet-version }} | |
- name: Build C# samples | |
run: dotnet build samples/csharp/samples.sln | |
# Java Stage | |
java: | |
name: Build and Test Java | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
cache: maven | |
- name: Build and Test Java Projects | |
run: | | |
find ./samples/java -name 'pom.xml' -print0 | while IFS= read -r -d '' file; do | |
dir=$(dirname "$file") | |
echo "Building and testing Java project in $dir" | |
cd "$dir" | |
mvn clean install | |
mvn test | |
cd - > /dev/null | |
done | |
# Python Stage | |
python: | |
name: Build and Test Python | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install dependencies and Test Python Projects | |
run: | | |
find ./samples/python -name 'requirements.txt' -print0 | while IFS= read -r -d '' file; do | |
dir=$(dirname "$file") | |
echo "Installing dependencies for Python project in $dir" | |
cd "$dir" | |
pip install -r requirements.txt | |
echo "Running tests for Python project in $dir" | |
pytest --maxfail=0 --disable-warnings --junitxml=results.xml --ignore=node_modules --ignore=venv || true | |
TEST_COUNT=$(grep -o 'tests="[^"]*"' results.xml | sed 's/tests="//g' | sed 's/"//g') | |
FAILED_COUNT=$(grep -o 'failures="[^"]*"' results.xml | sed 's/failures="//g' | sed 's/"//g') | |
echo "Tests found: $TEST_COUNT" | |
echo "Tests failed: $FAILED_COUNT" | |
if [[ "$TEST_COUNT" -gt 0 && "$FAILED_COUNT" -gt 0 ]]; then | |
echo "Tests ran and some tests failed in $dir. Failing the job." | |
exit 1 | |
elif [[ "$TEST_COUNT" -eq 0 ]]; then | |
echo "No tests found for $dir. Exiting successfully." | |
else | |
echo "All tests passed in $dir. Exiting successfully." | |
fi | |
cd - > /dev/null | |
done |