diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 61059db655..b1a4521078 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,6 +3,7 @@ on: push: branches: - main + - test-java-8 tags: - "v*" pull_request: @@ -23,7 +24,7 @@ jobs: submodules: true - uses: VirtusLab/scala-cli-setup@0f48bba87c0a9ddc831e0209bee9fa00340491b8 with: - jvm: "temurin:17" + jvm: "temurin:8" - name: Copy launcher run: ./mill -i copyJvmLauncher artifacts/ if: runner.os == 'Linux' @@ -49,7 +50,7 @@ jobs: submodules: true - uses: VirtusLab/scala-cli-setup@0f48bba87c0a9ddc831e0209bee9fa00340491b8 with: - jvm: "temurin:17" + jvm: "temurin:8" - name: JVM integration tests run: ./mill -i integration.test.jvm env: @@ -65,7 +66,7 @@ jobs: submodules: true - uses: VirtusLab/scala-cli-setup@0f48bba87c0a9ddc831e0209bee9fa00340491b8 with: - jvm: "temurin:17" + jvm: "temurin:8" - name: JVM integration tests run: ./mill -i integration.test.jvm env: @@ -81,984 +82,8 @@ jobs: submodules: true - uses: VirtusLab/scala-cli-setup@0f48bba87c0a9ddc831e0209bee9fa00340491b8 with: - jvm: "temurin:17" + jvm: "temurin:8" - name: JVM integration tests run: ./mill -i integration.test.jvm env: SCALA_CLI_IT_GROUP: 3 - - generate-linux-launcher: - timeout-minutes: 120 - runs-on: "ubuntu-20.04" - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - submodules: true - - uses: VirtusLab/scala-cli-setup@0f48bba87c0a9ddc831e0209bee9fa00340491b8 - with: - jvm: "temurin:17" - - name: Generate native launcher - run: .github/scripts/generate-native-image.sh - - run: ./mill -i ci.setShouldPublish - - name: Build OS packages - if: env.SHOULD_PUBLISH == 'true' - run: .github/scripts/generate-os-packages.sh - - name: Copy artifacts - run: ./mill -i copyDefaultLauncher artifacts/ - - uses: actions/upload-artifact@v3 - with: - name: linux-launchers - path: artifacts/ - if-no-files-found: error - retention-days: 2 - - native-linux-tests-1: - needs: generate-linux-launcher - timeout-minutes: 120 - runs-on: "ubuntu-20.04" - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - submodules: true - - uses: VirtusLab/scala-cli-setup@0f48bba87c0a9ddc831e0209bee9fa00340491b8 - with: - jvm: "temurin:17" - - uses: actions/download-artifact@v3 - with: - name: linux-launchers - path: artifacts/ - - name: Native integration tests - run: ./mill -i nativeIntegrationTests - env: - UPDATE_GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/ - SCALA_CLI_IT_GROUP: 1 - SCALA_CLI_SODIUM_JNI_ALLOW: false - - native-linux-tests-2: - needs: generate-linux-launcher - timeout-minutes: 120 - runs-on: "ubuntu-20.04" - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - submodules: true - - uses: VirtusLab/scala-cli-setup@0f48bba87c0a9ddc831e0209bee9fa00340491b8 - with: - jvm: "temurin:17" - - uses: actions/download-artifact@v3 - with: - name: linux-launchers - path: artifacts/ - - name: Native integration tests - run: ./mill -i nativeIntegrationTests - env: - UPDATE_GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/ - SCALA_CLI_IT_GROUP: 2 - SCALA_CLI_SODIUM_JNI_ALLOW: false - - native-linux-tests-3: - needs: generate-linux-launcher - timeout-minutes: 120 - runs-on: "ubuntu-20.04" - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - submodules: true - - uses: VirtusLab/scala-cli-setup@0f48bba87c0a9ddc831e0209bee9fa00340491b8 - with: - jvm: "temurin:17" - - uses: actions/download-artifact@v3 - with: - name: linux-launchers - path: artifacts/ - - name: Native integration tests - run: ./mill -i nativeIntegrationTests - env: - UPDATE_GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/ - SCALA_CLI_IT_GROUP: 3 - SCALA_CLI_SODIUM_JNI_ALLOW: false - - generate-linux-arm64-native-launcher: - runs-on: "macOS-m1" - if: github.event_name == 'push' - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - submodules: true - - uses: VirtusLab/scala-cli-setup@0f48bba87c0a9ddc831e0209bee9fa00340491b8 - with: - apps: "" - - name: Generate native launcher and generate os packages - run: .github/scripts/build-linux-aarch64.sh - - uses: actions/upload-artifact@v3 - with: - name: linux-aarch64-launchers - path: artifacts/ - if-no-files-found: error - retention-days: 2 - - generate-macos-launcher: - timeout-minutes: 120 - runs-on: "macos-latest" - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - submodules: true - - uses: VirtusLab/scala-cli-setup@0f48bba87c0a9ddc831e0209bee9fa00340491b8 - with: - jvm: "temurin:17" - - name: Generate native launcher - run: .github/scripts/generate-native-image.sh - - run: ./mill -i ci.setShouldPublish - - name: Build OS packages - if: env.SHOULD_PUBLISH == 'true' - run: .github/scripts/generate-os-packages.sh - - name: Copy artifacts - run: ./mill -i copyDefaultLauncher artifacts/ - - uses: actions/upload-artifact@v3 - with: - name: macos-launchers - path: artifacts/ - if-no-files-found: error - retention-days: 2 - - native-macos-tests-1: - needs: generate-macos-launcher - timeout-minutes: 120 - runs-on: "macos-latest" - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - submodules: true - - uses: VirtusLab/scala-cli-setup@0f48bba87c0a9ddc831e0209bee9fa00340491b8 - with: - jvm: "temurin:17" - - uses: actions/download-artifact@v3 - with: - name: macos-launchers - path: artifacts/ - - name: Native integration tests - run: ./mill -i nativeIntegrationTests - env: - UPDATE_GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/ - SCALA_CLI_IT_GROUP: 1 - SCALA_CLI_SODIUM_JNI_ALLOW: false - - native-macos-tests-2: - needs: generate-macos-launcher - timeout-minutes: 120 - runs-on: "macos-latest" - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - submodules: true - - uses: VirtusLab/scala-cli-setup@0f48bba87c0a9ddc831e0209bee9fa00340491b8 - with: - jvm: "temurin:17" - - uses: actions/download-artifact@v3 - with: - name: macos-launchers - path: artifacts/ - - name: Native integration tests - run: ./mill -i nativeIntegrationTests - env: - UPDATE_GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/ - SCALA_CLI_IT_GROUP: 2 - SCALA_CLI_SODIUM_JNI_ALLOW: false - - native-macos-tests-3: - needs: generate-macos-launcher - timeout-minutes: 120 - runs-on: "macos-latest" - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - submodules: true - - uses: VirtusLab/scala-cli-setup@0f48bba87c0a9ddc831e0209bee9fa00340491b8 - with: - jvm: "temurin:17" - - uses: actions/download-artifact@v3 - with: - name: macos-launchers - path: artifacts/ - - name: Native integration tests - run: ./mill -i nativeIntegrationTests - env: - UPDATE_GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/ - SCALA_CLI_IT_GROUP: 3 - SCALA_CLI_SODIUM_JNI_ALLOW: false - - generate-macos-m1-launcher: - timeout-minutes: 120 - runs-on: "macOS-m1" - if: github.event_name == 'push' && github.repository == 'VirtusLab/scala-cli' - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - submodules: true - - uses: coursier/setup-action@6a582d7f7292a865e72c497ca64c3ef447cdb6c7 - with: - apps: "" - jvm: "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.2.0/graalvm-ce-java17-darwin-aarch64-22.2.0.tar.gz" - - name: Generate native launcher - run: .github/scripts/generate-native-image.sh - - run: ./mill -i ci.setShouldPublish - - name: Build OS packages - if: env.SHOULD_PUBLISH == 'true' - run: .github/scripts/generate-os-packages.sh - - name: Copy artifacts - run: ./mill -i copyDefaultLauncher artifacts/ - - uses: actions/upload-artifact@v3 - with: - name: macos-m1-launchers - path: artifacts/ - if-no-files-found: error - retention-days: 2 - - native-macos-m1-tests: - needs: generate-macos-m1-launcher - timeout-minutes: 120 - runs-on: "macOS-m1" - if: github.event_name == 'push' && github.repository == 'VirtusLab/scala-cli' - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - submodules: true - - uses: coursier/setup-action@6a582d7f7292a865e72c497ca64c3ef447cdb6c7 - with: - apps: "" - jvm: "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.2.0/graalvm-ce-java17-darwin-aarch64-22.2.0.tar.gz" - - uses: actions/download-artifact@v3 - with: - name: macos-m1-launchers - path: artifacts/ - - name: Native integration tests - run: ./mill -i nativeIntegrationTests - env: - UPDATE_GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/ - SCALA_CLI_SODIUM_JNI_ALLOW: false - - generate-windows-launcher: - timeout-minutes: 120 - runs-on: "windows-latest" - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - submodules: true - - uses: VirtusLab/scala-cli-setup@0f48bba87c0a9ddc831e0209bee9fa00340491b8 - with: - jvm: "temurin:17" - - name: Get latest coursier launcher - run: .github/scripts/get-latest-cs.sh - shell: bash - - name: Generate native launcher - run: .github/scripts/generate-native-image.sh - shell: bash - - run: ./mill -i ci.setShouldPublish - - name: Build OS packages - if: env.SHOULD_PUBLISH == 'true' - run: .github/scripts/generate-os-packages.sh - shell: bash - - name: Copy artifacts - run: ./mill -i copyDefaultLauncher artifacts/ - - uses: actions/upload-artifact@v3 - with: - name: windows-launchers - path: artifacts/ - if-no-files-found: error - retention-days: 2 - - native-windows-tests-1: - needs: generate-windows-launcher - timeout-minutes: 120 - runs-on: "windows-latest" - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - submodules: true - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.10" - - uses: VirtusLab/scala-cli-setup@0f48bba87c0a9ddc831e0209bee9fa00340491b8 - with: - jvm: "temurin:17" - - name: Get latest coursier launcher - run: .github/scripts/get-latest-cs.sh - shell: bash - - uses: actions/download-artifact@v3 - with: - name: windows-launchers - path: artifacts/ - - name: Native integration tests - run: ./mill -i nativeIntegrationTests - env: - COURSIER_JNI: force - UPDATE_GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/ - SCALA_CLI_IT_GROUP: 1 - SCALA_CLI_SODIUM_JNI_ALLOW: false - - native-windows-tests-2: - needs: generate-windows-launcher - timeout-minutes: 120 - runs-on: "windows-latest" - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - submodules: true - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.10" - - uses: VirtusLab/scala-cli-setup@0f48bba87c0a9ddc831e0209bee9fa00340491b8 - with: - jvm: "temurin:17" - - name: Get latest coursier launcher - run: .github/scripts/get-latest-cs.sh - shell: bash - - uses: actions/download-artifact@v3 - with: - name: windows-launchers - path: artifacts/ - - name: Native integration tests - run: ./mill -i nativeIntegrationTests - env: - COURSIER_JNI: force - UPDATE_GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/ - SCALA_CLI_IT_GROUP: 2 - SCALA_CLI_SODIUM_JNI_ALLOW: false - - native-windows-tests-3: - needs: generate-windows-launcher - timeout-minutes: 120 - runs-on: "windows-latest" - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - submodules: true - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.10" - - uses: VirtusLab/scala-cli-setup@0f48bba87c0a9ddc831e0209bee9fa00340491b8 - with: - jvm: "temurin:17" - - name: Get latest coursier launcher - run: .github/scripts/get-latest-cs.sh - shell: bash - - uses: actions/download-artifact@v3 - with: - name: windows-launchers - path: artifacts/ - - name: Native integration tests - run: ./mill -i nativeIntegrationTests - env: - COURSIER_JNI: force - UPDATE_GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/ - SCALA_CLI_IT_GROUP: 3 - SCALA_CLI_SODIUM_JNI_ALLOW: false - - generate-mostly-static-launcher: - timeout-minutes: 120 - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - submodules: true - - uses: VirtusLab/scala-cli-setup@0f48bba87c0a9ddc831e0209bee9fa00340491b8 - with: - jvm: "temurin:17" - - name: Generate native launcher - run: .github/scripts/generate-native-image.sh mostly-static - shell: bash - - name: Copy artifacts - run: ./mill -i copyMostlyStaticLauncher artifacts/ - - uses: actions/upload-artifact@v3 - with: - name: mostly-static-launchers - path: artifacts/ - if-no-files-found: error - retention-days: 2 - - native-mostly-static-tests-1: - needs: generate-mostly-static-launcher - timeout-minutes: 120 - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - submodules: true - - uses: VirtusLab/scala-cli-setup@0f48bba87c0a9ddc831e0209bee9fa00340491b8 - with: - jvm: "temurin:17" - - uses: actions/download-artifact@v3 - with: - name: mostly-static-launchers - path: artifacts/ - - name: Build slim docker image - run: .github/scripts/generate-slim-docker-image.sh - - name: Native integration tests - run: ./mill -i integration.test.nativeMostlyStatic - env: - UPDATE_GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/ - SCALA_CLI_IT_GROUP: 1 - SCALA_CLI_SODIUM_JNI_ALLOW: false - - name: Docker integration tests - run: ./mill integration.docker-slim.test - - name: Login to GitHub Container Registry - if: startsWith(github.ref, 'refs/tags/v') - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Push slim scala-cli image to github container registry - if: startsWith(github.ref, 'refs/tags/v') - run: .github/scripts/publish-slim-docker-images.sh - - native-mostly-static-tests-2: - needs: generate-mostly-static-launcher - timeout-minutes: 120 - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - submodules: true - - uses: VirtusLab/scala-cli-setup@0f48bba87c0a9ddc831e0209bee9fa00340491b8 - with: - jvm: "temurin:17" - - uses: actions/download-artifact@v3 - with: - name: mostly-static-launchers - path: artifacts/ - - name: Native integration tests - run: ./mill -i integration.test.nativeMostlyStatic - env: - UPDATE_GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/ - SCALA_CLI_IT_GROUP: 2 - SCALA_CLI_SODIUM_JNI_ALLOW: false - - native-mostly-static-tests-3: - needs: generate-mostly-static-launcher - timeout-minutes: 120 - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - submodules: true - - uses: VirtusLab/scala-cli-setup@0f48bba87c0a9ddc831e0209bee9fa00340491b8 - with: - jvm: "temurin:17" - - uses: actions/download-artifact@v3 - with: - name: mostly-static-launchers - path: artifacts/ - - name: Native integration tests - run: ./mill -i integration.test.nativeMostlyStatic - env: - UPDATE_GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/ - SCALA_CLI_IT_GROUP: 3 - SCALA_CLI_SODIUM_JNI_ALLOW: false - - generate-static-launcher: - timeout-minutes: 120 - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - submodules: true - - uses: VirtusLab/scala-cli-setup@0f48bba87c0a9ddc831e0209bee9fa00340491b8 - with: - jvm: "temurin:17" - - name: Generate native launcher - run: .github/scripts/generate-native-image.sh static - shell: bash - - name: Copy artifacts - run: ./mill -i copyStaticLauncher artifacts/ - - uses: actions/upload-artifact@v3 - with: - name: static-launchers - path: artifacts/ - if-no-files-found: error - retention-days: 2 - - native-static-tests-1: - needs: generate-static-launcher - timeout-minutes: 120 - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - submodules: true - - uses: VirtusLab/scala-cli-setup@0f48bba87c0a9ddc831e0209bee9fa00340491b8 - with: - jvm: "temurin:17" - - uses: actions/download-artifact@v3 - with: - name: static-launchers - path: artifacts/ - - name: Build docker image - run: .github/scripts/generate-docker-image.sh - - name: Native integration tests - run: ./mill -i integration.test.nativeStatic - env: - UPDATE_GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/ - SCALA_CLI_IT_GROUP: 1 - SCALA_CLI_SODIUM_JNI_ALLOW: false - - name: Docker integration tests - run: ./mill integration.docker.test - - name: Login to GitHub Container Registry - if: startsWith(github.ref, 'refs/tags/v') - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Push scala-cli to github container registry - if: startsWith(github.ref, 'refs/tags/v') - run: .github/scripts/publish-docker-images.sh - - native-static-tests-2: - needs: generate-static-launcher - timeout-minutes: 120 - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - submodules: true - - uses: VirtusLab/scala-cli-setup@0f48bba87c0a9ddc831e0209bee9fa00340491b8 - with: - jvm: "temurin:17" - - uses: actions/download-artifact@v3 - with: - name: static-launchers - path: artifacts/ - - name: Build docker image - run: .github/scripts/generate-docker-image.sh - - name: Native integration tests - run: ./mill -i integration.test.nativeStatic - env: - UPDATE_GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/ - SCALA_CLI_IT_GROUP: 2 - SCALA_CLI_SODIUM_JNI_ALLOW: false - - native-static-tests-3: - needs: generate-static-launcher - timeout-minutes: 120 - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - submodules: true - - uses: VirtusLab/scala-cli-setup@0f48bba87c0a9ddc831e0209bee9fa00340491b8 - with: - jvm: "temurin:17" - - uses: actions/download-artifact@v3 - with: - name: static-launchers - path: artifacts/ - - name: Build docker image - run: .github/scripts/generate-docker-image.sh - - name: Native integration tests - run: ./mill -i integration.test.nativeStatic - env: - UPDATE_GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/ - SCALA_CLI_IT_GROUP: 3 - SCALA_CLI_SODIUM_JNI_ALLOW: false - - docs-tests: - # for now, let's run those tests only on ubuntu - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - submodules: true - - uses: VirtusLab/scala-cli-setup@0f48bba87c0a9ddc831e0209bee9fa00340491b8 - with: - jvm: "zulu:17" - - uses: actions/setup-node@v3 - with: - node-version: '16.x' - - name: Build documentation - run: .github/scripts/build-website.sh - - name: Test documentation - run: ./mill -i docs-tests.test - - checks: - timeout-minutes: 15 - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - submodules: true - - uses: VirtusLab/scala-cli-setup@0f48bba87c0a9ddc831e0209bee9fa00340491b8 - with: - jvm: "temurin:17" - - name: Check Scala / Scala.js versions in doc - run: ./mill -i ci.checkScalaVersions - - name: Check native-image config format - run: ./mill -i __.checkNativeImageConfFormat - - name: Check Ammonite availability - run: ./mill -i 'dummy.amm[_].resolvedRunIvyDeps' - - name: Scalafix check - run: | - ./mill -i __.fix --check || ( - echo "To remove unused import run" - echo " ./mill -i __.fix" - exit 1 - ) - - format: - timeout-minutes: 15 - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - submodules: true - - uses: VirtusLab/scala-cli-setup@0f48bba87c0a9ddc831e0209bee9fa00340491b8 - with: - jvm: "temurin:17" - apps: scalafmt:3.0.0 - - run: scalafmt --check - - reference-doc: - timeout-minutes: 15 - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - submodules: true - - uses: VirtusLab/scala-cli-setup@0f48bba87c0a9ddc831e0209bee9fa00340491b8 - with: - jvm: "temurin:17" - - name: Check that reference doc is up-to-date - run: | - ./mill -i generate-reference-doc.run --check || ( - echo "Reference doc is not up-to-date. Run" - echo " ./mill -i generate-reference-doc.run" - echo "to update it, then commit the result." - exit 1 - ) - - bloop-memory-footprint: - timeout-minutes: 120 - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - submodules: true - - uses: VirtusLab/scala-cli-setup@0f48bba87c0a9ddc831e0209bee9fa00340491b8 - with: - jvm: "temurin:17" - - name: Java Version - run: java -version - - name: Java Home - run: echo "$JAVA_HOME" - - name: Build Scala CLI - run: ./mill copyJvmLauncher build - - name: Build Benchmark - run: java -jar ./build/scala-cli --power package --standalone gcbenchmark/gcbenchmark.scala -o gc - - name: Run Benchmark - run: ./gc $(realpath ./build/scala-cli) - - test-hypothetical-sbt-export: - timeout-minutes: 120 - runs-on: "ubuntu-20.04" - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - submodules: true - - uses: VirtusLab/scala-cli-setup@0f48bba87c0a9ddc831e0209bee9fa00340491b8 - with: - jvm: "temurin:17" - - name: Try to export to SBT - run: scala-cli --power export --sbt . - - vc-redist: - timeout-minutes: 15 - runs-on: windows-latest - if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == 'Virtuslab/scala-cli' - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - submodules: true - - uses: VirtusLab/scala-cli-setup@0f48bba87c0a9ddc831e0209bee9fa00340491b8 - with: - jvm: "temurin:17" - - run: ./mill -i ci.copyVcRedist - - uses: actions/upload-artifact@v3 - with: - name: launchers - path: artifacts/ - if-no-files-found: warn - retention-days: 2 - - publish: - needs: [unit-tests, jvm-tests-1, jvm-tests-2, jvm-tests-3, format, checks, reference-doc] - if: github.event_name == 'push' && github.repository == 'VirtusLab/scala-cli' - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - submodules: true - ssh-key: ${{ secrets.SSH_PRIVATE_KEY_SCALA_CLI }} - - uses: VirtusLab/scala-cli-setup@0f48bba87c0a9ddc831e0209bee9fa00340491b8 - with: - jvm: "temurin:17" - - name: GPG setup - run: .github/scripts/gpg-setup.sh - env: - PGP_SECRET: ${{ secrets.PGP_SECRET }} - - run: ./mill -i ci.setShouldPublish - - run: ./mill -i publishSonatype __.publishArtifacts - if: env.SHOULD_PUBLISH == 'true' - env: - PGP_PASSWORD: ${{ secrets.PGP_PASSPHRASE }} - SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} - SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} - - uses: webfactory/ssh-agent@d4b9b8ff72958532804b70bbe600ad43b36d5f2e - with: - ssh-private-key: | - ${{ secrets.SSH_PRIVATE_KEY_SCALA_CLI }} - - name: Update stable branch - if: env.SHOULD_PUBLISH == 'true' && startsWith(github.ref, 'refs/tags/v') - run: | - git config user.name gh-actions - git config user.email actions@github.com - git checkout stable - git merge origin/main -m "Back port of documentation changes to stable" - git push origin stable - - launchers: - timeout-minutes: 20 - needs: - - unit-tests - - jvm-tests-1 - - jvm-tests-2 - - jvm-tests-3 - - native-linux-tests-1 - - native-linux-tests-2 - - native-linux-tests-3 - - native-macos-tests-1 - - native-macos-tests-2 - - native-macos-tests-3 - - native-macos-m1-tests - - native-windows-tests-1 - - native-windows-tests-2 - - native-windows-tests-3 - - native-mostly-static-tests-1 - - native-mostly-static-tests-2 - - native-mostly-static-tests-3 - - native-static-tests-1 - - native-static-tests-2 - - native-static-tests-3 - - vc-redist - - format - - checks - - reference-doc - - generate-linux-arm64-native-launcher - if: github.event_name == 'push' - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - submodules: true - - uses: VirtusLab/scala-cli-setup@0f48bba87c0a9ddc831e0209bee9fa00340491b8 - with: - jvm: "temurin:17" - - run: ./mill -i ci.setShouldPublish - - uses: actions/download-artifact@v3 - if: env.SHOULD_PUBLISH == 'true' - with: - name: linux-launchers - path: artifacts/ - - uses: actions/download-artifact@v3 - if: env.SHOULD_PUBLISH == 'true' - with: - name: linux-aarch64-launchers - path: artifacts/ - - uses: actions/download-artifact@v3 - if: env.SHOULD_PUBLISH == 'true' - with: - name: macos-launchers - path: artifacts/ - - uses: actions/download-artifact@v3 - if: env.SHOULD_PUBLISH == 'true' - with: - name: macos-m1-launchers - path: artifacts/ - - uses: actions/download-artifact@v3 - if: env.SHOULD_PUBLISH == 'true' - with: - name: windows-launchers - path: artifacts/ - - uses: actions/download-artifact@v3 - if: env.SHOULD_PUBLISH == 'true' - with: - name: mostly-static-launchers - path: artifacts/ - - uses: actions/download-artifact@v3 - if: env.SHOULD_PUBLISH == 'true' - with: - name: static-launchers - path: artifacts/ - - uses: actions/download-artifact@v3 - if: env.SHOULD_PUBLISH == 'true' - with: - name: launchers - path: artifacts/ - - run: ./mill -i uploadLaunchers artifacts/ - if: env.SHOULD_PUBLISH == 'true' - env: - UPLOAD_GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - update-packages: - name: Update packages - needs: launchers - runs-on: ubuntu-20.04 - if: startsWith(github.ref, 'refs/tags/v') && github.repository == 'VirtusLab/scala-cli' - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - submodules: true - - uses: VirtusLab/scala-cli-setup@0f48bba87c0a9ddc831e0209bee9fa00340491b8 - with: - jvm: "temurin:17" - - uses: actions/download-artifact@v3 - with: - name: linux-launchers - path: artifacts/ - - uses: actions/download-artifact@v3 - with: - name: linux-aarch64-launchers - path: artifacts/ - - uses: actions/download-artifact@v3 - with: - name: macos-launchers - path: artifacts/ - - uses: actions/download-artifact@v3 - with: - name: macos-m1-launchers - path: artifacts/ - - uses: actions/download-artifact@v3 - with: - name: windows-launchers - path: artifacts/ - - uses: actions/download-artifact@v3 - with: - name: mostly-static-launchers - path: artifacts/ - - uses: actions/download-artifact@v3 - with: - name: static-launchers - path: artifacts/ - - uses: actions/download-artifact@v3 - with: - name: launchers - path: artifacts/ - - name: Display structure of downloaded files - run: ls -R - working-directory: artifacts/ - - uses: webfactory/ssh-agent@d4b9b8ff72958532804b70bbe600ad43b36d5f2e - with: - ssh-private-key: | - ${{ secrets.SCALA_CLI_PACKAGES_KEY }} - ${{ secrets.HOMEBREW_SCALA_CLI_KEY }} - ${{ secrets.HOMEBREW_SCALA_EXPERIMENTAL_KEY }} - ${{ secrets.SCALA_CLI_SETUP_KEY }} - - run: ./mill -i ci.updateInstallationScript - - run: ./mill -i ci.updateScalaCliBrewFormula - - name: GPG setup - run: .github/scripts/gpg-setup.sh - env: - PGP_SECRET: ${{ secrets.PGP_SECRET }} - - run: ./mill -i ci.updateDebianPackages - env: - PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} - GPG_EMAIL: ${{ secrets.GPG_EMAIL }} - - run: ./mill -i ci.updateCentOsPackages - env: - PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} - KEYGRIP: ${{ secrets.KEYGRIP }} - PGP_SECRET: ${{ secrets.PGP_SECRET }} - GPG_EMAIL: ${{ secrets.GPG_EMAIL }} - - run: ./mill -i ci.updateStandaloneLauncher - env: - UPLOAD_GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Publish to SDKMAN - run: .github/scripts/publish-sdkman.sh - shell: bash - env: - SDKMAN_KEY: ${{ secrets.SDKMAN_KEY }} - SDKMAN_TOKEN: ${{ secrets.SDKMAN_TOKEN }} - - run: ./mill -i ci.updateScalaCliSetup - - run: ./mill -i ci.updateScalaExperimentalBrewFormula - - update-windows-packages: - name: Update Windows packages - needs: launchers - runs-on: windows-latest - if: startsWith(github.ref, 'refs/tags/v') && github.repository == 'VirtusLab/scala-cli' - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - submodules: true - - uses: VirtusLab/scala-cli-setup@0f48bba87c0a9ddc831e0209bee9fa00340491b8 - with: - jvm: "temurin:17" - - uses: actions/download-artifact@v3 - with: - name: windows-launchers - path: artifacts/ - - name: Publish to chocolatey - run: ./mill -i ci.updateChocolateyPackage - env: - CHOCO_SECRET: ${{ secrets.CHOCO_SECRET_KEY }} diff --git a/.mill-jvm-opts b/.mill-jvm-opts index 9782885324..d2e0567d82 100644 --- a/.mill-jvm-opts +++ b/.mill-jvm-opts @@ -1,4 +1,4 @@ --Xmx2048m --Xms128m --Xss8m +-Xmx4048m +-Xms256m +-Xss16m -Dxsbt.skip.cp.lookup=true diff --git a/build.sc b/build.sc index 2a8a488bea..efd4afb91f 100644 --- a/build.sc +++ b/build.sc @@ -754,7 +754,18 @@ trait Cli extends SbtModule with ProtoBuildModule with CliLaunchers for ((srcUrl, destRelPath, transform) <- resources) { val dest = dir / defaultFilesResourcePath / destRelPath if (!os.isFile(dest)) { - val content = Using.resource(new URL(srcUrl).openStream())(_.readAllBytes()) + val content = Using.resource(new URL(srcUrl).openStream())(is => { + import java.io.InputStreamReader + import java.io.BufferedReader + val isr = new InputStreamReader(is) + val reader: BufferedReader = new BufferedReader(isr) + val json: StringBuilder = new StringBuilder + var c: Int = 0 + while ((c = reader.read) != -(1)) { + json.append(c.toChar) + } + json.toString().getBytes + }) os.write(dest, transform(content), createFolders = true) } } @@ -772,7 +783,7 @@ trait Cli extends SbtModule with ProtoBuildModule with CliLaunchers super.scalacOptions() ++ asyncScalacOptions(scalaVersion()) } def javacOptions = T { - super.javacOptions() ++ Seq("--release", "16") + super.javacOptions() ++ Seq("--release", "8") } def moduleDeps = Seq( `build-module`, @@ -1195,7 +1206,17 @@ def importedLauncher(directory: String = "artifacts"): Array[Byte] = { Using.resource(new ZipFile(from.toIO)) { zf => val ent = zf.getEntry("scala-cli.exe") Using.resource(zf.getInputStream(ent)) { is => - is.readAllBytes() +// is.readAllBytes() + import java.io.InputStreamReader + import java.io.BufferedReader + val isr = new InputStreamReader(is) + val reader: BufferedReader = new BufferedReader(isr) + val json: StringBuilder = new StringBuilder + var c: Int = 0 + while ((c = reader.read) != -(1)) { + json.append(c.toChar) + } + json.toString().getBytes } } } @@ -1206,7 +1227,16 @@ def importedLauncher(directory: String = "artifacts"): Array[Byte] = { val compressed = os.read.bytes(from) val bais = new ByteArrayInputStream(compressed) Using.resource(new GZIPInputStream(bais)) { gzis => - gzis.readAllBytes() + import java.io.InputStreamReader + import java.io.BufferedReader + val isr = new InputStreamReader(gzis) + val reader: BufferedReader = new BufferedReader(isr) + val json: StringBuilder = new StringBuilder + var c: Int = 0 + while ((c = reader.read) != -(1)) { + json.append(c.toChar) + } + json.toString().getBytes } } } diff --git a/mill b/mill index 95fd8ca1c2..05beb34302 100755 --- a/mill +++ b/mill @@ -53,7 +53,7 @@ elif [[ "$cache_dest" == *.zip ]]; then fi fi -eval "$("$cs" java --env --jvm temurin:17 || "$cs" java --env --jvm openjdk:1.17.0)" +eval "$("$cs" java --env --jvm temurin:8)" # temporary, until we pass JPMS options to native-image, # see https://www.graalvm.org/release-notes/22_2/#native-image diff --git a/modules/build/src/main/scala/scala/build/internal/zip/WrappedZipInputStream.scala b/modules/build/src/main/scala/scala/build/internal/zip/WrappedZipInputStream.scala index aa7fc9050e..d3997b68a3 100644 --- a/modules/build/src/main/scala/scala/build/internal/zip/WrappedZipInputStream.scala +++ b/modules/build/src/main/scala/scala/build/internal/zip/WrappedZipInputStream.scala @@ -22,8 +22,20 @@ final case class WrappedZipInputStream( case Left(zis) => zis.closeEntry() case Right(zis) => zis.closeEntry() } - def readAllBytes(): Array[Byte] = - wrapped.merge.readAllBytes() + def readAllBytes(): Array[Byte] = { + val d = wrapped.merge + import java.io.InputStreamReader + import java.io.BufferedReader + val isr = new InputStreamReader(d) + val reader: BufferedReader = new BufferedReader(isr) + val json: StringBuilder = new StringBuilder + var c: Int = 0 + while ((c = reader.read) != -(1)) { + json.append(c.toChar) + } + json.toString().getBytes + } + def close(): Unit = wrapped.merge.close() } diff --git a/project/publish.sc b/project/publish.sc index 8f34deaaff..90f4039330 100644 --- a/project/publish.sc +++ b/project/publish.sc @@ -1,10 +1,10 @@ import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.1.4` -import $ivy.`org.eclipse.jgit:org.eclipse.jgit:6.6.0.202305301015-r` +//import $ivy.`org.eclipse.jgit:org.eclipse.jgit:6.6.0.202305301015-r` import $file.settings, settings.{PublishLocalNoFluff, workspaceDirName} import de.tobiasroeser.mill.vcs.version._ import mill._, scalalib._ -import org.eclipse.jgit.api.Git +//import org.eclipse.jgit.api.Git import java.nio.charset.Charset @@ -13,47 +13,52 @@ import scala.jdk.CollectionConverters._ lazy val (ghOrg, ghName) = { def default = ("VirtusLab", "scala-cli") - val isCI = System.getenv("CI") != null + val isCI = { + System.getenv("CI") != null + false + } if (isCI) { - val repos = { - var git: Git = null - try { - git = Git.open(os.pwd.toIO) - git.remoteList().call().asScala.toVector - } - finally - if (git != null) - git.close() - } - val reposByName = repos.flatMap(r => - r.getURIs.asScala.headOption.map(_.toASCIIString).toSeq.map((r.getName, _)) - ) - val repoUrlOpt = - if (reposByName.length == 1) - reposByName.headOption.map(_._2) - else { - val m = reposByName.toMap - m.get("origin").orElse(m.get("upstream")) - } - repoUrlOpt match { - case Some(url) if url.startsWith("https://github.com/") => - url.stripPrefix("https://github.com/").stripSuffix(".git").split("/", 2) match { - case Array(org, name) => (org, name) - case Array(_) => - System.err.println( - s"Warning: git remote URL $url doesn't look like a GitHub URL, using default GitHub org and name" - ) - default - } - case Some(url) => - System.err.println( - s"Warning: git remote URL $url doesn't look like a GitHub URL, using default GitHub org and name" - ) - default - case _ => - System.err.println("Warning: no git remote found, using default GitHub org and name") - default - } +// val repos = { +// var git: Git = null +// try { +// git = Git.open(os.pwd.toIO) +// git.remoteList().call().asScala.toVector +// } +// finally +// if (git != null) +// git.close() +// Nil +// } +// val reposByName = repos.flatMap(r => +// r.getURIs.asScala.headOption.map(_.toASCIIString).toSeq.map((r.getName, _)) +// ) +// val repoUrlOpt = +// if (reposByName.length == 1) +// reposByName.headOption.map(_._2) +// else { +// val m = reposByName.toMap +// m.get("origin").orElse(m.get("upstream")) +// } +// repoUrlOpt match { +// case Some(url) if url.startsWith("https://github.com/") => +// url.stripPrefix("https://github.com/").stripSuffix(".git").split("/", 2) match { +// case Array(org, name) => (org, name) +// case Array(_) => +// System.err.println( +// s"Warning: git remote URL $url doesn't look like a GitHub URL, using default GitHub org and name" +// ) +// default +// } +// case Some(url) => +// System.err.println( +// s"Warning: git remote URL $url doesn't look like a GitHub URL, using default GitHub org and name" +// ) +// default +// case _ => +// System.err.println("Warning: no git remote found, using default GitHub org and name") +// default +// } + default } else default diff --git a/project/settings.sc b/project/settings.sc index 213a7b9acb..8dc18b0775 100644 --- a/project/settings.sc +++ b/project/settings.sc @@ -847,13 +847,31 @@ object Licenses { implicit val rw: ReadWriter[Licenses] = macroRW } +def readAllBytesJava8(is: InputStream) = try { + import java.io.BufferedInputStream + val bis = new BufferedInputStream(is) + try { + val data = new Array[Byte](bis.available) + bis.read(data) + data + } +} def updateLicensesFile() = { val url = "https://github.com/spdx/license-list-data/raw/master/json/licenses.json" var is: InputStream = null val b = try { is = new java.net.URL(url).openStream() - is.readAllBytes() + import java.io.InputStreamReader + import java.io.BufferedReader + val isr = new InputStreamReader(is) + val reader: BufferedReader = new BufferedReader(isr) + val json: StringBuilder = new StringBuilder + var c: Int = 0 + while ((c = reader.read) != -(1)) { + json.append(c.toChar) + } + json.toString().getBytes } finally if (is != null) is.close() val content = new String(b, "UTF-8")