Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into platform-cross-compil…
Browse files Browse the repository at this point in the history
…ation
  • Loading branch information
franciscodr committed Nov 15, 2023
2 parents 2d30b29 + 812b744 commit 4a7d0a2
Show file tree
Hide file tree
Showing 733 changed files with 40,323 additions and 5,944 deletions.
30 changes: 25 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,44 @@ concurrency:

jobs:
check:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
timeout-minutes: 15

strategy:
matrix:
include:
- platform: jvm
os: ubuntu-latest
- platform: js
os: ubuntu-latest
- platform: linuxX64
os: ubuntu-latest
- platform: macosX64
os: macos-latest
- platform: mingwX64
os: windows-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 19
java-version: 20

- name: Build and Test (multip)
uses: gradle/gradle-build-action@v2
with:
arguments: buildAndTestMultip -Pplatform=${{ matrix.platform }}

- name: build
- name: Build and Test (singlep)
uses: gradle/gradle-build-action@v2
with:
arguments: build --full-stacktrace
arguments: buildAndTestSinglep -Pplatform=${{ matrix.platform }}
if: ${{ matrix.platform == 'jvm' }}

- name: Upload reports
if: failure()
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/create-version-tag-manually.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.BOT_TOKEN }}
Expand All @@ -31,7 +31,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 19
java-version: 20

- name: Extract parameters from selected choice
id: extract-parameters
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/create-version-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.BOT_TOKEN }}
Expand All @@ -18,7 +18,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 19
java-version: 20

- name: Build
uses: gradle/gradle-build-action@v2
Expand Down
25 changes: 0 additions & 25 deletions .github/workflows/githubpages.yaml

This file was deleted.

150 changes: 150 additions & 0 deletions .github/workflows/openai-api-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
name: Check OpenAI API

on:
workflow_dispatch:

jobs:
checkAPIVersion:
runs-on: ubuntu-latest
steps:
- name: Install Octokit Action
run: npm install @octokit/action
- name: Get latest API commit
id: get-latest-commit
uses: actions/github-script@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
result-encoding: string
script: '
const { Octokit } = require("@octokit/action");
const octokit = new Octokit();
const owner = ''openai'';
const repo = ''openai-openapi'';
const filePath = ''openapi.yaml'';
const branch = ''master'';
const commits = await octokit.repos.listCommits({
owner,
repo,
path: filePath,
ref: branch
});
return commits.data[0].sha.trim();
'
- name: Get result latest API commit
run: |
LATEST_API_COMMIT="${{steps.get-latest-commit.outputs.result}}"
echo "LATEST_API_COMMIT=$LATEST_API_COMMIT" >> $GITHUB_ENV
- name: Get current API commit
id: get-current-commit
uses: actions/github-script@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
result-encoding: string
script: '
const { Octokit } = require("@octokit/action");
const octokit = new Octokit();
const owner = ''xebia-functional'';
const repo = ''xef'';
const filePath = ''openai-client/generator/config/openai-api-commit'';
const branch = ''main'';
const response = await octokit.repos.getContent({
owner,
repo,
path: filePath,
ref: branch,
});
const content = Buffer.from(response.data.content, ''base64'').toString(''utf-8'');
return content.trim();
'
- name: Get result current API commit
run: |
CURRENT_API_COMMIT="${{steps.get-current-commit.outputs.result}}"
echo "CURRENT_API_COMMIT=$CURRENT_API_COMMIT" >> $GITHUB_ENV
- name: Check existing PR
if: env.CURRENT_API_COMMIT != env.LATEST_API_COMMIT
id: get-pr-commit
uses: actions/github-script@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
result-encoding: string
script: '
const { Octokit } = require("@octokit/action");
const octokit = new Octokit();
const owner = ''xebia-functional'';
const repo = ''xef'';
const filePath = ''openai-client/generator/config/openai-api-commit'';
const existing = await octokit.pulls.list({
owner,
repo,
head: ''xebia-functional:update/openai-client''
});
if (existing.data.length > 0) {
const prCommit = existing.data[0].head.sha;
const response = await octokit.repos.getContent({
owner,
repo,
path: filePath,
ref: prCommit
});
const prApiCommit = Buffer.from(response.data.content, ''base64'').toString(''utf-8'').trim();
if (prApiCommit === ''${{ env.LATEST_API_COMMIT }}'') {
return prApiCommit;
} else {
return '''';
}
} else {
return '''';
}
'
- name: Update current commit with PR
if: env.CURRENT_API_COMMIT != env.LATEST_API_COMMIT
run: |
PR_API_COMMIT="${{steps.get-pr-commit.outputs.result}}"
if [[ ! -z "$PR_API_COMMIT" ]]
then
echo "CURRENT_API_COMMIT=$PR_API_COMMIT" >> $GITHUB_ENV
else
echo "Previous PR outdated or nonexistent"
fi
- name: Checkout
if: env.CURRENT_API_COMMIT != env.LATEST_API_COMMIT
uses: actions/checkout@v4
- name: Update commit
if: env.CURRENT_API_COMMIT != env.LATEST_API_COMMIT
run: |
echo $LATEST_API_COMMIT > $GITHUB_WORKSPACE/openai-client/generator/config/openai-api-commit
- name: Set up Java
if: env.CURRENT_API_COMMIT != env.LATEST_API_COMMIT
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 20
- name: Download new API spec
if: env.CURRENT_API_COMMIT != env.LATEST_API_COMMIT
uses: gradle/gradle-build-action@v2
with:
arguments: downloadOpenAIAPI
- name: Generate new OpenAI client
if: env.CURRENT_API_COMMIT != env.LATEST_API_COMMIT
uses: gradle/gradle-build-action@v2
with:
arguments: openaiClientGenerate
- name: Spotless Apply
if: env.CURRENT_API_COMMIT != env.LATEST_API_COMMIT
uses: gradle/gradle-build-action@v2
with:
arguments: spotlessApply
- name: Create PR
if: env.CURRENT_API_COMMIT != env.LATEST_API_COMMIT
uses: peter-evans/create-pull-request@v5
with:
commit-message: 'Update OpenAI Client'
branch: update/openai-client
title: 'Update OpenAI client'
body: 'Updates the OpenAI client based on the latest changes.'
40 changes: 4 additions & 36 deletions .github/workflows/publish-development-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.ref_name }}
Expand All @@ -29,12 +29,12 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11
java-version: 20

- name: Assemble
uses: gradle/gradle-build-action@v2
with:
arguments: assemble -x:kotlin-loom:assemble -x:xef-scala:assemble -x:xef-scala-examples:assemble
arguments: assemble

- name: Upload reports
if: failure()
Expand All @@ -46,36 +46,4 @@ jobs:
- name: Publish development version
uses: gradle/gradle-build-action@v2
with:
arguments: publishToSonatype -x:kotlin-loom:publishToSonatype -x:xef-scala:publishToSonatype closeAndReleaseSonatypeStagingRepository

publish-modules-with-loom:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.ref_name }}

- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 19

- name: assemble
uses: gradle/gradle-build-action@v2
with:
arguments: :kotlin-loom:assemble :xef-scala:assemble

- name: Upload reports
if: failure()
uses: actions/upload-artifact@v3
with:
name: 'reports-${{ matrix.os }}'
path: '**/build/reports/**'

- name: Publish development version
uses: gradle/gradle-build-action@v2
with:
arguments: :kotlin-loom:publishToSonatype :xef-scala:publishToSonatype closeAndReleaseSonatypeStagingRepository
arguments: publishToSonatype closeAndReleaseSonatypeStagingRepository
40 changes: 4 additions & 36 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.ref_name }}
Expand All @@ -27,12 +27,12 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11
java-version: 20

- name: Assemble
uses: gradle/gradle-build-action@v2
with:
arguments: assemble -x:kotlin-loom:assemble -x:xef-scala:assemble -x:xef-scala-examples:assemble
arguments: assemble

- name: Upload reports
if: failure()
Expand All @@ -44,36 +44,4 @@ jobs:
- name: Publish final version
uses: gradle/gradle-build-action@v2
with:
arguments: publishToSonatype -x:kotlin-loom:publishToSonatype -x:xef-scala:publishToSonatype closeSonatypeStagingRepository

publish-modules-with-loom:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.ref_name }}

- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 19

- name: assemble
uses: gradle/gradle-build-action@v2
with:
arguments: :kotlin-loom:assemble :xef-scala:assemble

- name: Upload reports
if: failure()
uses: actions/upload-artifact@v3
with:
name: 'reports-${{ matrix.os }}'
path: '**/build/reports/**'

- name: Publish final version
uses: gradle/gradle-build-action@v2
with:
arguments: :kotlin-loom:publishToSonatype :xef-scala:publishToSonatype closeSonatypeStagingRepository
arguments: publishToSonatype closeSonatypeStagingRepository
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,5 @@ kotlin-js-store/
.jekyll-metadata

.env

*.bin
Loading

0 comments on commit 4a7d0a2

Please sign in to comment.