]> sigrok.org Git - sigrok-build.git/commitdiff
build.yml: Adjust ARTIFACT_VERSION and use PR checkout everywhere
authorSoeren Apel <redacted>
Sun, 25 Aug 2024 22:02:31 +0000 (00:02 +0200)
committerSoeren Apel <redacted>
Sun, 25 Aug 2024 22:02:31 +0000 (00:02 +0200)
.github/workflows/build.yml

index 366e9f65b9c3117b15b95b7245c0ab6332ba3c27..f2e32fd9613d7a7da3b2ded9143c80f275338bbd 100644 (file)
@@ -61,6 +61,11 @@ jobs:
       ARTIFACT_VERSION: "NIGHTLY"
 
     steps:
+      - name: Set artifact version to PR
+        if: (github.event_name == 'pull_request')
+        run: |
+          echo "ARTIFACT_VERSION=PR${{ github.event.pull_request.number }}" >> $GITHUB_ENV
+
       - name: Checkout sigrok-build
         # Cannot use actions/checkout because it always checks out the calling actions' repo, not the one specified
         run: |
@@ -72,13 +77,24 @@ jobs:
           source sigrok-mxe-init-toolchain.sh
           ./sigrok-mxe-build-dependencies.sh
 
-      - name: Checkout PulseView
+      - name: Checkout sigrok's PulseView
+        # Check out default PV repository unless we're processing a pull request
         uses: actions/checkout@v4
         with:
           # TODO: Clone from sigrok.org
           repository: sigrokproject/pulseview
           path: pulseview
 
+      - name: Checkout PulseView from PR
+        # Check out PV branch of the pull request we're processing
+        if: (github.event_name == 'pull_request')
+        uses: actions/checkout@v4
+        with:
+          repository: ${{ github.event.pull_request.head.repo.full_name }}
+          ref: ${{ github.event.pull_request.head.ref }}
+          path: pulseview
+          fetch-depth: 0
+
       - name: Build PulseView
         run: |
           source sigrok-build/ci/mxe/sigrok-mxe-init-toolchain.sh
@@ -142,6 +158,11 @@ jobs:
       ARTIFACT_VERSION: "NIGHTLY"
 
     steps:
+      - name: Set artifact version to PR
+        if: (github.event_name == 'pull_request')
+        run: |
+          echo "ARTIFACT_VERSION=PR${{ github.event.pull_request.number }}" >> $GITHUB_ENV
+
       - name: Checkout sigrok-build
         # Cannot use actions/checkout because it always checks out the calling actions' repo, not the one specified
         run: |
@@ -153,12 +174,24 @@ jobs:
           source sigrok-mxe-init-toolchain.sh
           ./sigrok-mxe-build-dependencies.sh
 
-      - name: Checkout sigrok-cli
+      - name: Checkout sigrok's sigrok-cli
+        # Check out default sigrok-cli repository unless we're processing a pull request
+        if: (github.event_name != 'pull_request')
         uses: actions/checkout@v4
         with:
           repository: sigrokproject/sigrok-cli
           path: sigrok-cli
 
+      - name: Checkout sigrok-cli from PR
+        # Check out sigrok-cli branch of the pull request we're processing
+        if: (github.event_name == 'pull_request')
+        uses: actions/checkout@v4
+        with:
+          repository: ${{ github.event.pull_request.head.repo.full_name }}
+          ref: ${{ github.event.pull_request.head.ref }}
+          path: sigrok-cli
+          fetch-depth: 0
+
       - name: Build sigrok-cli
         run: |
           source sigrok-build/ci/mxe/sigrok-mxe-init-toolchain.sh
@@ -235,6 +268,11 @@ jobs:
       ARTIFACT_VERSION: "NIGHTLY"
 
     steps:
+      - name: Set artifact version to PR
+        if: (github.event_name == 'pull_request')
+        run: |
+          echo "ARTIFACT_VERSION=PR${{ github.event.pull_request.number }}" >> $GITHUB_ENV
+
       - name: Update dependencies
         run: |
           sudo apt-get update
@@ -253,12 +291,24 @@ jobs:
           source sigrok-appimage-init-toolchain.sh
           ./sigrok-appimage-build-dependencies.sh
 
-      - name: Checkout PulseView
+      - name: Checkout sigrok's PulseView
+        # Check out default PV repository unless we're processing a pull request
         uses: actions/checkout@v4
         with:
+          # TODO: Clone from sigrok.org
           repository: sigrokproject/pulseview
           path: pulseview
 
+      - name: Checkout PulseView from PR
+        # Check out PV branch of the pull request we're processing
+        if: (github.event_name == 'pull_request')
+        uses: actions/checkout@v4
+        with:
+          repository: ${{ github.event.pull_request.head.repo.full_name }}
+          ref: ${{ github.event.pull_request.head.ref }}
+          path: pulseview
+          fetch-depth: 0
+
       - name: Build PulseView
         run: |
           source sigrok-build/ci/appimage/sigrok-appimage-init-toolchain.sh
@@ -333,6 +383,11 @@ jobs:
       ARTIFACT_VERSION: "NIGHTLY"
 
     steps:
+      - name: Set artifact version to PR
+        if: (github.event_name == 'pull_request')
+        run: |
+          echo "ARTIFACT_VERSION=PR${{ github.event.pull_request.number }}" >> $GITHUB_ENV
+
       - name: Update dependencies
         run: |
           sudo apt-get update
@@ -448,6 +503,11 @@ jobs:
       ARTIFACT_VERSION: "NIGHTLY"
 
     steps:
+      - name: Set artifact version to PR
+        if: (github.event_name == 'pull_request')
+        run: |
+          echo "ARTIFACT_VERSION=PR${{ github.event.pull_request.number }}" >> $GITHUB_ENV
+
       - name: Install dependencies
         run: |
           brew install autoconf automake autoconf-archive pkg-config libtool \
@@ -469,13 +529,24 @@ jobs:
           source sigrok-macos-init-toolchain.sh
           ./sigrok-macos-build-dependencies.sh
 
-      - name: Checkout PulseView
+      - name: Checkout sigrok's PulseView
+        # Check out default PV repository unless we're processing a pull request
         uses: actions/checkout@v4
         with:
           # TODO: Clone from sigrok.org
           repository: sigrokproject/pulseview
           path: pulseview
 
+      - name: Checkout PulseView from PR
+        # Check out PV branch of the pull request we're processing
+        if: (github.event_name == 'pull_request')
+        uses: actions/checkout@v4
+        with:
+          repository: ${{ github.event.pull_request.head.repo.full_name }}
+          ref: ${{ github.event.pull_request.head.ref }}
+          path: pulseview
+          fetch-depth: 0
+
       - name: Build PulseView
         run: |
           source sigrok-build/ci/macos/sigrok-macos-init-toolchain.sh
@@ -522,6 +593,11 @@ jobs:
       ARTIFACT_VERSION: "NIGHTLY"
 
     steps:
+      - name: Set artifact version to PR
+        if: (github.event_name == 'pull_request')
+        run: |
+          echo "ARTIFACT_VERSION=PR${{ github.event.pull_request.number }}" >> $GITHUB_ENV
+
       - name: Install dependencies
         run: |
           brew install autoconf automake autoconf-archive pkg-config sdcc \
@@ -539,13 +615,24 @@ jobs:
           source sigrok-macos-init-toolchain.sh
           ./sigrok-macos-build-dependencies.sh
 
-      - name: Checkout sigrok-cli
+      - name: Checkout sigrok's sigrok-cli
+        # Check out default sigrok-cli repository unless we're processing a pull request
+        if: (github.event_name != 'pull_request')
         uses: actions/checkout@v4
         with:
-          # TODO: Clone from sigrok.org
           repository: sigrokproject/sigrok-cli
           path: sigrok-cli
 
+      - name: Checkout sigrok-cli from PR
+        # Check out sigrok-cli branch of the pull request we're processing
+        if: (github.event_name == 'pull_request')
+        uses: actions/checkout@v4
+        with:
+          repository: ${{ github.event.pull_request.head.repo.full_name }}
+          ref: ${{ github.event.pull_request.head.ref }}
+          path: sigrok-cli
+          fetch-depth: 0
+
       - name: Build sigrok-cli
         run: |
           source sigrok-build/ci/macos/sigrok-macos-init-toolchain.sh