From 7aa85a538d2204d8e4e59e0a0efdd112a9d760c3 Mon Sep 17 00:00:00 2001 From: Manuel Andruccioli Date: Sun, 17 Mar 2024 11:47:52 +0100 Subject: [PATCH] fix(test): windows stuffs --- .github/workflows/build-and-deploy.yml | 108 +++++++++--------- .../gradle/CheckNodeTask.kt | 5 + .../gradle/TypescriptPluginTest.kt | 8 ++ 3 files changed, 67 insertions(+), 54 deletions(-) diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index ac66407..0d89e4c 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -8,7 +8,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ windows-2022, macos-12, ubuntu-22.04 ] + os: [ windows-2022 ] runs-on: ${{ matrix.os }} concurrency: group: build-${{ github.workflow }}-${{ matrix.os }}-${{ github.event.number || github.ref }} @@ -41,57 +41,57 @@ jobs: maven-central-password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} signing-key: ${{ secrets.SIGNING_KEY }} signing-password: ${{ secrets.SIGNING_PASSWORD }} - release: - permissions: - contents: write - packages: write - concurrency: - # Only one release job at a time. Strictly sequential. - group: release - needs: - - build - runs-on: ubuntu-22.04 - if: >- - !github.event.repository.fork - && github.event_name != 'pull_request' - steps: - - name: Checkout - uses: actions/checkout@v4.1.1 +# release: +# permissions: +# contents: write +# packages: write +# concurrency: +# # Only one release job at a time. Strictly sequential. +# group: release +# needs: +# - build +# runs-on: ubuntu-22.04 +# if: >- +# !github.event.repository.fork +# && github.event_name != 'pull_request' +# steps: +# - name: Checkout +# uses: actions/checkout@v4.1.1 +## with: +## token: ${{ secrets.DEPLOYMENT_TOKEN }} +# - name: Find the version of Node from package.json +# id: node-version +# run: echo "version=$(jq -r .engines.node package.json)" >> $GITHUB_OUTPUT +# - name: Install Node +# uses: actions/setup-node@v4.0.2 # with: -# token: ${{ secrets.DEPLOYMENT_TOKEN }} - - name: Find the version of Node from package.json - id: node-version - run: echo "version=$(jq -r .engines.node package.json)" >> $GITHUB_OUTPUT - - name: Install Node - uses: actions/setup-node@v4.0.2 - with: - node-version: ${{ steps.node-version.outputs.version }} - - uses: DanySK/build-check-deploy-gradle-action@2.4.8 - with: - build-command: true - check-command: true - deploy-command: | - npm install - npx semantic-release - should-run-codecov: false - should-deploy: true - github-token: ${{ github.token }} - gradle-publish-secret: ${{ secrets.GRADLE_PUBLISH_SECRET }} - gradle-publish-key: ${{ secrets.GRADLE_PUBLISH_KEY }} - maven-central-username: ${{ secrets.MAVEN_CENTRAL_USERNAME }} - maven-central-password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} - signing-key: ${{ secrets.SIGNING_KEY }} - signing-password: ${{ secrets.SIGNING_PASSWORD }} - success: - runs-on: ubuntu-22.04 - needs: - - release - - build - if: >- - always() && ( - contains(join(needs.*.result, ','), 'failure') - || !contains(join(needs.*.result, ','), 'cancelled') - ) - steps: - - name: Verify that there were no failures - run: ${{ !contains(join(needs.*.result, ','), 'failure') }} +# node-version: ${{ steps.node-version.outputs.version }} +# - uses: DanySK/build-check-deploy-gradle-action@2.4.8 +# with: +# build-command: true +# check-command: true +# deploy-command: | +# npm install +# npx semantic-release +# should-run-codecov: false +# should-deploy: true +# github-token: ${{ github.token }} +# gradle-publish-secret: ${{ secrets.GRADLE_PUBLISH_SECRET }} +# gradle-publish-key: ${{ secrets.GRADLE_PUBLISH_KEY }} +# maven-central-username: ${{ secrets.MAVEN_CENTRAL_USERNAME }} +# maven-central-password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} +# signing-key: ${{ secrets.SIGNING_KEY }} +# signing-password: ${{ secrets.SIGNING_PASSWORD }} +# success: +# runs-on: ubuntu-22.04 +# needs: +# - release +# - build +# if: >- +# always() && ( +# contains(join(needs.*.result, ','), 'failure') +# || !contains(join(needs.*.result, ','), 'cancelled') +# ) +# steps: +# - name: Verify that there were no failures +# run: ${{ !contains(join(needs.*.result, ','), 'failure') }} diff --git a/src/main/kotlin/io/github/zuccherosintattico/gradle/CheckNodeTask.kt b/src/main/kotlin/io/github/zuccherosintattico/gradle/CheckNodeTask.kt index eeb7144..3cecfc9 100644 --- a/src/main/kotlin/io/github/zuccherosintattico/gradle/CheckNodeTask.kt +++ b/src/main/kotlin/io/github/zuccherosintattico/gradle/CheckNodeTask.kt @@ -155,6 +155,11 @@ abstract class CheckNodeTask : DefaultTask() { private fun downloadFromUrl(url: URL): Path { val tempDir = createTempDirectory(TEMP_DIR_PREFIX).also { logger.quiet("Node will be downloaded in $it") } val nodeArchive = tempDir.resolve(url.name()) + + println("AAAAaaaaaaaaaa $url") + println("AAAAaaaaaaaaaa ${url.name()}") + println("AAAAaaaaaaaaaa $nodeArchive") + runCatching { url.openStream().use { Files.copy(it, nodeArchive) diff --git a/src/test/kotlin/io/github/zuccherosintattico/gradle/TypescriptPluginTest.kt b/src/test/kotlin/io/github/zuccherosintattico/gradle/TypescriptPluginTest.kt index 0f0fabb..ebcad06 100644 --- a/src/test/kotlin/io/github/zuccherosintattico/gradle/TypescriptPluginTest.kt +++ b/src/test/kotlin/io/github/zuccherosintattico/gradle/TypescriptPluginTest.kt @@ -81,4 +81,12 @@ class TypescriptPluginTest : AnnotationSpec() { .executeGradleTask("checkNode", "checkNode") .output shouldContain "Node is installed at version v20.7.0" // version set in tested env } + + @Test + fun `wow`() { + val testFolder = getTempDirectoryWithResources("src/test/resources/download-node-env") + + val out = testFolder.executeGradleTask("checkNode", "checkNode") + println(out.output) + } }