Skip to content

Generate test code #246

Generate test code

Generate test code #246

name: Generate test code
on:
workflow_dispatch:
inputs:
scope:
type: choice
description: scope of the test code to generate
required: true
default: typespec
options:
- all
- autorest
- typespec
jobs:
build:
timeout-minutes: 60
runs-on: ubuntu-latest
permissions:
actions: read
contents: write
deployments: none
packages: none
pull-requests: none
security-events: none
steps:
- name: Checkout branch
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup node 20
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Install autorest
run: |
npm install -g autorest
npm ci --no-bin-links
- name: Setup jdk 11
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
- name: Build autorest-java, install modules
run: |
mvn install -f pom.xml -P local,tsp --no-transfer-progress
- name: Generate test code for autorest-java
if: ${{ inputs.scope == 'all' || inputs.scope == 'autorest' }}
shell: pwsh
run: |
./Generate.ps1 -Parallelization 1
- name: Generate test code for typespec-java
if: ${{ inputs.scope == 'all' || inputs.scope == 'typespec' }}
shell: pwsh
run: |
cd typespec-tests
./Generate.ps1 -Parallelization 1
cd ..
- name: Commit generated code
run: |
git config --global user.name 'actions-user'
git config --global user.email '[email protected]'
git add .
git commit -m "re-generate test code"
git push