ci: cache generated SDK toolchain downloads #4
This file contains hidden or 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
| name: Generated SDK Conformance | |
| on: | |
| pull_request: | |
| paths-ignore: | |
| - "docs/**" | |
| - "**/*.md" | |
| push: | |
| branches: [main] | |
| paths-ignore: | |
| - "docs/**" | |
| - "**/*.md" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: sdk-java-conformance-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| generate-and-build: | |
| runs-on: blacksmith-2vcpu-ubuntu-2404 | |
| timeout-minutes: 12 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-java@v5 | |
| with: | |
| distribution: temurin | |
| java-version: '17' | |
| - name: Restore OpenAPI generator cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: /tmp/openapi-generator-cli.jar | |
| key: openapi-generator-cli-7.12.0 | |
| - name: Restore generated SDK Maven cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2/repository | |
| key: generated-sdk-m2-${{ runner.os }}-7.12.0 | |
| restore-keys: | | |
| generated-sdk-m2-${{ runner.os }}- | |
| - name: Fetch immutable contract | |
| run: | | |
| curl --fail --location \ | |
| https://raw.githubusercontent.com/CoreLinkPlatform/api-contracts/5bdc07b80c8acbd0617b75e2d7ae3edd17f6324b/openapi/corelink-public-v1.yaml \ | |
| --output /tmp/corelink-public-v1.yaml | |
| - name: Fetch pinned generator when uncached | |
| run: | | |
| if [ ! -s /tmp/openapi-generator-cli.jar ]; then | |
| curl --fail --location \ | |
| https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.12.0/openapi-generator-cli-7.12.0.jar \ | |
| --output /tmp/openapi-generator-cli.jar | |
| fi | |
| - name: Generate Java client | |
| run: | | |
| rm -rf /tmp/corelink-java-sdk | |
| java -jar /tmp/openapi-generator-cli.jar generate \ | |
| -i /tmp/corelink-public-v1.yaml \ | |
| -g java \ | |
| -o /tmp/corelink-java-sdk \ | |
| --additional-properties=groupId=io.corelink,artifactId=corelink-sdk,artifactVersion=0.1.0-SNAPSHOT,invokerPackage=io.corelink.sdk,apiPackage=io.corelink.sdk.api,modelPackage=io.corelink.sdk.model,library=native,dateLibrary=java8,hideGenerationTimestamp=true \ | |
| --global-property=apiDocs=false,modelDocs=false | |
| - name: Compile generated Java SDK | |
| working-directory: /tmp/corelink-java-sdk | |
| run: mvn -B -DskipTests package |