name: Mill plugin tests on: push: paths: - modules/openapi-generator-mill-plugin/** pull_request: paths: - modules/openapi-generator-mill-plugin/** jobs: test: name: Mill plugin tests runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - name: Set up JDK 11 uses: actions/setup-java@v5 with: java-version: 11 distribution: 'temurin' - name: Restore cache (read-only) # only use restore keys, no save key because we need to clear the cache before running the examples uses: actions/cache/restore@v5 with: path: | ~/.m2/repository ~/.gradle ~/.cache/coursier !~/.gradle/caches/*/plugin-resolution/ !~/.m2/repository/org/openapitools/ !~/.cache/coursier/v1/https/repo1.maven.org/maven2/org/openapitools/ key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} - name: Maven Clean Install env: GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} run: | ./mvnw clean install -DskipTests -Dmaven.javadoc.skip=true # This is needed because of differences in how Maven and Coursier download artifacts # Maven will only download the pom when the transitive dependency is not needed in the current projects compile classpath # whereas Coursier expects the artifact (jar) to be present in a Maven repository. When Coursier encounters a # artifact folder with a pom it considers the artifact to be available and will then crash when the jar is missing. - name: Clear m2 cache except openapitools (because otherwise coursier will fail to resolve artifacts where only poms are downloaded) run: | mv ~/.m2/repository/org/openapitools /tmp/openapitools-backup || true rm -rf ~/.m2/repository/* mkdir -p ~/.m2/repository/org mv /tmp/openapitools-backup ~/.m2/repository/org/openapitools || true - name: Mill Example - Test Validation Command env: GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} run: | (cd modules/openapi-generator-mill-plugin/example/ && ./mill validateOpenapiSpec $(pwd)/api/petstore-invalid.yaml) - name: Mill Example - Test Validation Task env: GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} run: | (cd modules/openapi-generator-mill-plugin/example/ && ./mill openapi.validate) - name: Mill Example - Test Compile Task env: GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} run: | (cd modules/openapi-generator-mill-plugin/example/ && ./mill __.compile)