Skip to content

Commit a247155

Browse files
Merge pull request #2930 from Azure/ant/bump
Update to latest package versions, reorganize GitHub actions
2 parents c45181b + 4d650cb commit a247155

13 files changed

+2697
-585
lines changed

.github/workflows/generate-schemas-batch.yml

Lines changed: 0 additions & 116 deletions
This file was deleted.
Lines changed: 77 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,116 @@
11
name: Generate Schemas
22

33
on:
4+
schedule:
5+
- cron: '45 5 * * SUN'
46
workflow_dispatch:
57
inputs:
68
api_specs_ref:
79
description: 'Git ref or full SHA for https://github.com/Azure/azure-rest-api-specs.'
810
required: true
911
default: 'main'
10-
single_path:
11-
description: 'The path to generate types for (e.g. "compute", or "keyvault"). Leave blank to generate all types.'
12-
required: false
12+
13+
env:
14+
# This must be kept in sync with the arguments passed to the "batch" matrix
15+
BATCH_COUNT: 20
1316

1417
jobs:
15-
update-schemas:
16-
name: Update Schemas
18+
generate:
19+
name: Update Schemas Batch ${{ matrix.batch }}
1720
runs-on: ubuntu-latest
18-
21+
strategy:
22+
matrix:
23+
batch: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
1924
steps:
20-
- uses: actions/[email protected]
25+
- name: Checkout repo
26+
uses: actions/checkout@v3
2127

2228
- name: Clone azure-rest-api-specs
23-
uses: actions/checkout@v2.3.5
29+
uses: actions/checkout@v3
2430
with:
2531
repository: Azure/azure-rest-api-specs
2632
path: workflow-temp/azure-rest-api-specs
2733
ref: ${{ github.event.inputs.api_specs_ref }}
34+
35+
- name: Setup Node.js
36+
uses: actions/setup-node@v3
37+
with:
38+
node-version: 16.x
2839

2940
- name: Install generator npm packages
3041
run: npm ci
3142
working-directory: generator
32-
33-
- id: generate
34-
name: Run generator
43+
44+
- name: Run generator
3545
run: |
36-
if [ -z "${{ github.event.inputs.single_path }}" ]
37-
then
38-
npm run generate-all -- --local-path "$GITHUB_WORKSPACE/workflow-temp/azure-rest-api-specs"
39-
else
40-
npm run generate-single -- --base-path '${{ github.event.inputs.single_path }}/resource-manager' --local-path "$GITHUB_WORKSPACE/workflow-temp/azure-rest-api-specs"
41-
fi
46+
rm -Rf "$GITHUB_WORKSPACE/schemas"
47+
rm -Rf "$GITHUB_WORKSPACE/summary.log"
48+
mkdir -p "$GITHUB_WORKSPACE/schemas"
49+
50+
npm run generate-all -- \
51+
--local-path "$GITHUB_WORKSPACE/workflow-temp/azure-rest-api-specs" \
52+
--batch-count ${{ env.BATCH_COUNT }} \
53+
--batch-index ${{ matrix.batch }} \
54+
--summary-log-path "$GITHUB_WORKSPACE/summary.log" \
55+
--combine-batch-mode true
4256
working-directory: generator
4357

44-
- id: get_swagger_gh_uri
45-
name: Get GitHub URI for azure-rest-api-specs
58+
- name: Upload Schemas
59+
uses: actions/upload-artifact@v3
60+
with:
61+
name: batch-${{ matrix.batch }}-schemas
62+
path: schemas
63+
if-no-files-found: error
64+
65+
- name: Upload summary log
66+
uses: actions/upload-artifact@v3
67+
with:
68+
name: batch-${{ matrix.batch }}-summary
69+
path: summary.log
70+
if-no-files-found: error
71+
72+
combine:
73+
needs: generate
74+
name: Combine Schema Batches
75+
runs-on: ubuntu-latest
76+
steps:
77+
- name: Checkout repo
78+
uses: actions/checkout@v3
79+
80+
- name: Download batch results
81+
uses: actions/download-artifact@v3
82+
with:
83+
path: workflow-temp
84+
85+
- name: Setup Node.js
86+
uses: actions/setup-node@v3
87+
with:
88+
node-version: 16.x
89+
90+
- name: Install generator npm packages
91+
run: npm ci
92+
working-directory: generator
93+
94+
- name: Combine batches
4695
run: |
47-
git_sha=`git rev-parse HEAD`
48-
echo "::set-output name=gh_uri::https://github.com/Azure/azure-rest-api-specs/tree/$git_sha"
49-
working-directory: workflow-temp/azure-rest-api-specs
96+
npm run combine-batches -- \
97+
--input-path "$GITHUB_WORKSPACE/workflow-temp" \
98+
--batch-count ${{ env.BATCH_COUNT }}
99+
working-directory: generator
50100

51101
- name: Create Pull Request
52-
uses: peter-evans/create-pull-request@v4.1.3
102+
uses: peter-evans/create-pull-request@v5
53103
with:
54104
committer: GitHub <[email protected]>
55105
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
56106
signoff: false
57-
branch: autogenerate
58-
branch-suffix: short-commit-hash
107+
branch: autogenerate-batch
59108
delete-branch: true
60109
title: |
61-
Update Generated Types ${{ github.event.inputs.single_path && format('(single path: {0})', github.event.inputs.single_path) || '' }}
110+
Update Generated Schemas
62111
body: |
63-
Update Generated Types ${{ github.event.inputs.single_path && format('(single path: {0})', github.event.inputs.single_path) || '' }}
64-
65-
Generate types for ${{ steps.get_swagger_gh_uri.outputs.gh_uri }}
112+
Update Generated Schemas
66113
commit-message: |
67-
Update Generated Types ${{ github.event.inputs.single_path && format('(single path: {0})', github.event.inputs.single_path) || '' }}
68-
69-
Generate types for ${{ steps.get_swagger_gh_uri.outputs.gh_uri }}
114+
Update Generated Schemas
70115
labels: autogenerate
71116
draft: false

.github/workflows/generate-single.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Generate Single
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
api_specs_ref:
7+
description: 'Git ref or full SHA for https://github.com/Azure/azure-rest-api-specs.'
8+
required: true
9+
default: 'main'
10+
single_path:
11+
description: 'The path to generate types for (e.g. "compute", or "keyvault").'
12+
required: true
13+
14+
jobs:
15+
update-schemas:
16+
name: Update Schemas
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout repo
21+
uses: actions/checkout@v3
22+
23+
- name: Clone azure-rest-api-specs
24+
uses: actions/checkout@v3
25+
with:
26+
repository: Azure/azure-rest-api-specs
27+
path: workflow-temp/azure-rest-api-specs
28+
ref: ${{ github.event.inputs.api_specs_ref }}
29+
30+
- name: Setup Node.js
31+
uses: actions/setup-node@v3
32+
with:
33+
node-version: 16.x
34+
35+
- name: Install generator npm packages
36+
run: npm ci
37+
working-directory: generator
38+
39+
- name: Run generator
40+
run: |
41+
npm run generate-single -- \
42+
--local-path "$GITHUB_WORKSPACE/workflow-temp/azure-rest-api-specs" \
43+
--base-path '${{ github.event.inputs.single_path }}/resource-manager'
44+
working-directory: generator
45+
46+
- name: Create Pull Request
47+
uses: peter-evans/create-pull-request@v5
48+
with:
49+
committer: GitHub <[email protected]>
50+
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
51+
signoff: false
52+
branch: autogenerate-${{ github.event.inputs.single_path }}
53+
delete-branch: true
54+
title: |
55+
Update Generated Schemas (${{ github.event.inputs.single_path }})
56+
body: |
57+
Update Generated Schemas (${{ github.event.inputs.single_path }})
58+
commit-message: |
59+
Update Generated Schemas (${{ github.event.inputs.single_path }})
60+
labels: autogenerate
61+
draft: false

.github/workflows/main.yml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,16 @@ jobs:
99
runs-on: ubuntu-latest
1010

1111
steps:
12-
- uses: actions/[email protected]
12+
- name: Checkout repo
13+
uses: actions/checkout@v3
1314

1415
- name: Setup Node.js
15-
uses: actions/setup-node@v3.5.0
16+
uses: actions/setup-node@v3
1617
with:
17-
node-version: 14.x
18+
node-version: 16.x
1819

1920
- name: Setup .NET Core
20-
uses: actions/setup-dotnet@v3.0.0
21+
uses: actions/setup-dotnet@v3
2122
with:
2223
dotnet-version: '5.0.x'
2324

@@ -42,12 +43,13 @@ jobs:
4243
runs-on: ubuntu-latest
4344

4445
steps:
45-
- uses: actions/[email protected]
46+
- name: Checkout repo
47+
uses: actions/checkout@v3
4648

4749
- name: Setup Node.js
48-
uses: actions/setup-node@v3.5.0
50+
uses: actions/setup-node@v3
4951
with:
50-
node-version: 14.x
52+
node-version: 16.x
5153

5254
- name: Install
5355
run: npm ci
@@ -68,12 +70,13 @@ jobs:
6870
PR_PREFIX: sdkAuto/
6971
if: ${{ github.event.pull_request.user.login == 'azure-sdk' }}
7072
steps:
71-
- uses: actions/[email protected]
73+
- name: Checkout repo
74+
uses: actions/checkout@v3
7275

7376
- name: Setup Node.js
74-
uses: actions/setup-node@v3.5.0
77+
uses: actions/setup-node@v3
7578
with:
76-
node-version: 14.x
79+
node-version: 16.x
7780

7881
- name: Install NPM modules
7982
run: npm ci

generator/autogenlist.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Licensed under the MIT License.
33
import { ScopeType, AutoGenConfig } from './models';
44
import { postProcessor as insightsApplicationPostProcessor } from './processors/Microsoft.Insights.Application';
5-
import { postProcessor as resourcesPostProcessor } from './processors/Microsoft.Resources';
65
import { postProcessor as machineLearningPostProcessor } from './processors/Microsoft.MachineLearning';
76
import { postProcessor as kustoPostProcessor } from './processors/Microsoft.Kusto';
87
import { postProcessor as machineLearningServicesPostProcessor } from './processors/Microsoft.MachineLearningServices';

0 commit comments

Comments
 (0)