From 0ac0bacb1eeb76a9add41f8681c8eaa09bda00bb Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Mon, 27 Jan 2025 21:54:57 +0800 Subject: [PATCH] try and inline into pre-build.yml again --- .github/workflows/pre-build.yml | 56 ++++++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pre-build.yml b/.github/workflows/pre-build.yml index c5e5c66e21f..72ec3bbf119 100644 --- a/.github/workflows/pre-build.yml +++ b/.github/workflows/pre-build.yml @@ -25,13 +25,61 @@ jobs: # For normal PR jobs, just checkout the base_ref the PR is against - uses: actions/checkout@v4 with: { fetch-depth: 1 } + # For normal PR jobs, just checkout the base_ref the PR is against + - uses: actions/checkout@v4 + with: + ref: ${{ github.base_ref }} + if: ${{ !(github.event_name == 'push' && github.repository != 'com-lihaoyi/mill') }} + + # For fork push jobs, first checkout the version being pushed, then look for the + # merge-base where the current version forks off from the upstream main branch + - uses: actions/checkout@v4 + with: { fetch-depth: 0 } + if: ${{ github.event_name == 'push' && github.repository != 'com-lihaoyi/mill' }} + + - run: | + git fetch https://github.com/com-lihaoyi/mill main + MERGE_BASE=$(git merge-base FETCH_HEAD HEAD) + # pretty-print the path between the FETCH_HEAD (main), HEAD, and the merge-base + git log --graph --pretty=format:"%h %d %ar %s %n" --ancestry-path $MERGE_BASE^1..HEAD --ancestry-path $MERGE_BASE^1..FETCH_HEAD + + git checkout $MERGE_BASE + shell: bash + if: ${{ github.event_name == 'push' && github.repository != 'com-lihaoyi/mill' }} - - uses: ./.github/actions/pre-build-setup + - run: echo temurin:${{ inputs.java-version }} > .mill-jvm-version + shell: bash + + - run: chmod -R 777 . # normalize permissions before and after upload/download-artifact + shell: bash + + - run: mkdir out && touch out/mill-selective-execution.json + shell: bash + + - run: cat .mill-jvm-version + shell: bash + + - run: ./mill -i --debug -k selective.prepare ${{ inputs.prepareargs }} + if: ${{ (github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'run-all-tests')) || github.repository != 'com-lihaoyi/mill' }} + shell: ${{ inputs.shell }} + + + - run: cat out/mill-build/methodCodeHashSignatures.dest/current/4-methodCodeHashes.json | jq '.["build_.dist.package_$native$.$anonfun$executableRaw$8(os.Path,scala.collection.immutable.Seq,java.io.OutputStream)void"]' + shell: bash + - run: cat out/mill-build/methodCodeHashSignatures.dest/current/7-transitiveCallGraphHashes.json | jq '.["build_.dist.package_$native$.$anonfun$executableRaw$8(os.Path,scala.collection.immutable.Seq,java.io.OutputStream)void"]' + shell: bash + - run: cat out/mill-build/methodCodeHashSignatures.json | jq '.["value"]["build_.dist.package_$native$.$anonfun$executableRaw$8(os.Path,scala.collection.immutable.Seq,java.io.OutputStream)void"]' + shell: bash + - run: cat out/mill-selective-execution.json | jq '.["methodCodeHashSignatures"]["build_.dist.package_$native$.$anonfun$executableRaw$8(os.Path,scala.collection.immutable.Seq,java.io.OutputStream)void"]' + shell: bash + + - uses: actions/upload-artifact@v4.6.0 with: - os: ${{ inputs.os }} - java-version: ${{ inputs.java-version }} - shell: ${{ inputs.shell }} + path: out/mill-selective-execution.json + name: ${{ inputs.os }}-selective-execution-artifact + include-hidden-files: true + - uses: actions/checkout@v4 - run: ./mill -i --debug -k version