Skip to content

Generate test code

Generate test code #49

name: Generate test code
on:
workflow_dispatch:
inputs:
scope:
type: choice
description: scope of the test code to generate
required: true
default: autorest
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@v4
with:
fetch-depth: 0
submodules: 'true'
- name: Install node
uses: actions/setup-node@v4
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@v4
with:
distribution: 'zulu'
java-version: '11'
- name: Patch core
run: |
cd core
git checkout .
git apply ../core.diff --ignore-whitespace
cd ..
- 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