-
Notifications
You must be signed in to change notification settings - Fork 15.2k
workflows/release-binaries: Run tests on the same runner as the build #162421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Also, ignore the test results since they almost always fail. This allows us to simplify the build process and skip uploading and downloading the build and source directories which are huge.
|
||
- name: Setup Windows | ||
if: startsWith(runner.os, 'Windows') | ||
uses: llvm/actions/setup-windows@main |
Check warning
Code scanning / CodeQL
Unpinned tag for a non-immutable Action in workflow Medium
Uses Step
@llvm/pr-subscribers-github-workflow Author: Tom Stellard (tstellar) ChangesAlso, ignore the test results since they almost always fail. This allows us to simplify the build process and skip uploading and downloading the build and source directories which are huge. Full diff: https://github.com/llvm/llvm-project/pull/162421.diff 3 Files Affected:
diff --git a/.github/workflows/release-binaries-save-stage/action.yml b/.github/workflows/release-binaries-save-stage/action.yml
deleted file mode 100644
index 84ccf98c23a82..0000000000000
--- a/.github/workflows/release-binaries-save-stage/action.yml
+++ /dev/null
@@ -1,44 +0,0 @@
-name: Save Stage
-description: >-
- Upload the source and binary directories from a build stage so that they
- can be re-used in the next stage. This action is used to the release
- binaries workflow into multiple stages to avoid the 6 hour timeout on
- the GitHub hosted runners.
-inputs:
- build-prefix:
- description: "Directory containing the build directory."
- required: true
- type: 'string'
-
-permissions:
- contents: read
-
-runs:
- using: "composite"
- steps:
- # We need to create an archive of the build directory, because it has too
- # many files to upload.
- - name: Package Build and Source Directories
- shell: bash
- run: |
- # Remove .git/config to avoid leaking GITHUB_TOKEN stored there.
- # See https://unit42.paloaltonetworks.com/github-repo-artifacts-leak-tokens/
- rm -Rf .git/config
- # Windows does not support symlinks, so we need to dereference them.
- tar --exclude build/ ${{ (runner.os == 'Windows' && '-h') || '' }} -c . | zstd -T0 -c > ../llvm-project.tar.zst
- mv ../llvm-project.tar.zst .
- tar -C ${{ inputs.build-prefix }} -c build/ | zstd -T0 -c > build.tar.zst
-
- - name: Upload Stage 1 Source
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
- with:
- name: ${{ runner.os }}-${{ runner.arch }}-${{ github.job }}-source
- path: llvm-project.tar.zst
- retention-days: 2
-
- - name: Upload Stage 1 Build Dir
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
- with:
- name: ${{ runner.os}}-${{ runner.arch }}-${{ github.job }}-build
- path: build.tar.zst
- retention-days: 2
diff --git a/.github/workflows/release-binaries-setup-stage/action.yml b/.github/workflows/release-binaries-setup-stage/action.yml
deleted file mode 100644
index 475a25fa6b772..0000000000000
--- a/.github/workflows/release-binaries-setup-stage/action.yml
+++ /dev/null
@@ -1,59 +0,0 @@
-name: Setup Stage
-description: >-
- Setup the next stage of the release binaries workflow. This sets up the
- environment correctly for a new stage of the release binaries workflow
- and also restores the source and build directory from the previous stage.
-
-inputs:
- previous-artifact:
- description: >-
- A unique descriptor for the artifact from the previous stage. This will
- be used to construct the final artifact pattern, which is:
- $RUNNER_OS-$RUNNER_ARCH-$PREVIOUS_ARTIFACT-*
- required: false
- type: 'string'
-
-outputs:
- build-prefix:
- description: "Directory containing the build directory."
- value: ${{ steps.build-prefix.outputs.build-prefix }}
-
-runs:
- using: "composite"
- steps:
- - name: Install Ninja
- uses: llvm/actions/install-ninja@a1ea791b03c8e61f53a0e66f2f73db283aa0f01e # main
-
- - name: Setup Windows
- if: startsWith(runner.os, 'Windows')
- uses: llvm/actions/setup-windows@main
- with:
- arch: amd64
-
- - name: Set Build Prefix
- id: build-prefix
- shell: bash
- run: |
- build_prefix=`pwd`
- if [ "${{ runner.os }}" = "Linux" ]; then
- sudo chown $USER:$USER /mnt/
- build_prefix=/mnt/
- fi
- echo "build-prefix=$build_prefix" >> $GITHUB_OUTPUT
-
- - name: Download Previous Stage Artifact
- if: ${{ inputs.previous-artifact }}
- id: download
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
- with:
- pattern: ${{ runner.os }}-${{ runner.arch }}-${{ inputs.previous-artifact }}-*
- merge-multiple: true
-
- - name: Unpack Artifact
- if: ${{ steps.download.outputs.download-path }}
- shell: bash
- run: |
- tar --zstd -xf llvm-project.tar.zst
- rm llvm-project.tar.zst
- tar --zstd -C ${{ steps.build-prefix.outputs.build-prefix}} -xf build.tar.zst
- rm build.tar.zst
diff --git a/.github/workflows/release-binaries.yml b/.github/workflows/release-binaries.yml
index cba48e4d0c70a..83969b5490685 100644
--- a/.github/workflows/release-binaries.yml
+++ b/.github/workflows/release-binaries.yml
@@ -194,40 +194,30 @@ jobs:
runs-on: ${{ needs.prepare.outputs.build-runs-on }}
steps:
- - name: Checkout Actions
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- with:
- ref: ${{ (github.event_name == 'pull_request' && github.sha) || 'main' }}
- sparse-checkout: |
- .github/workflows/
- sparse-checkout-cone-mode: false
- # Check out outside of working directory so the source checkout doesn't
- # remove it.
- path: workflows
-
- # actions/checkout does not support paths outside of the GITHUB_WORKSPACE.
- # Also, anything that we put inside of GITHUB_WORKSPACE will be overwritten
- # by future actions/checkout steps. Therefore, in order to checkout the
- # latest actions from main, we need to first checkout out the actions inside of
- # GITHUB_WORKSPACE (see previous step), then use actions/checkout to checkout
- # the code being built and the move the actions from main back into GITHUB_WORKSPACE,
- # becasue the uses on composite actions only reads workflows from inside GITHUB_WORKSPACE.
- - shell: bash
- run: mv workflows ../workflows-main
-
- name: Checkout LLVM
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
ref: ${{ needs.prepare.outputs.ref }}
- - name: Copy main workflows
- shell: bash
- run: |
- mv ../workflows-main .
+ - name: Install Ninja
+ uses: llvm/actions/install-ninja@a1ea791b03c8e61f53a0e66f2f73db283aa0f01e # main
+
+ - name: Setup Windows
+ if: startsWith(runner.os, 'Windows')
+ uses: llvm/actions/setup-windows@main
+ with:
+ arch: amd64
- - name: Setup Stage
+ - name: Set Build Prefix
id: setup-stage
- uses: ./workflows-main/.github/workflows/release-binaries-setup-stage
+ shell: bash
+ run: |
+ build_prefix=`pwd`
+ if [ "${{ runner.os }}" = "Linux" ]; then
+ sudo chown $USER:$USER /mnt/
+ build_prefix=/mnt/
+ fi
+ echo "build-prefix=$build_prefix" >> $GITHUB_OUTPUT
- name: Configure
id: build
@@ -258,17 +248,11 @@ jobs:
path: |
${{ needs.prepare.outputs.release-binary-filename }}
- # Clean up some build files to reduce size of artifact.
- - name: Clean Up Build Directory
- shell: bash
+ - name: Run Tests
+ # These almost always fail so don't let them fail the build and prevent the uploads.
+ continue-on-error: true
run: |
- find ${{ steps.setup-stage.outputs.build-prefix }}/build -iname ${{ needs.prepare.outputs.release-binary-filename }} -delete
- find ${{ steps.setup-stage.outputs.build-prefix }}/build -iname _CPack_Packages -prune -exec rm -r {} +
-
- - name: Save Stage
- uses: ./workflows-main/.github/workflows/release-binaries-save-stage
- with:
- build-prefix: ${{ steps.setup-stage.outputs.build-prefix }}
+ ninja -C ${{ steps.setup-stage.outputs.build-prefix }}/build stage2-check-all
upload-release-binaries:
name: "Upload Release Binaries"
@@ -327,31 +311,3 @@ jobs:
--release ${{ needs.prepare.outputs.release-version }} \
upload \
--files ${{ needs.prepare.outputs.release-binary-filename }}*
-
- test-release:
- name: "Test Release"
- needs:
- - prepare
- - build-release-package
- if: >-
- github.repository_owner == 'llvm'
- runs-on: ${{ needs.prepare.outputs.test-runs-on }}
- steps:
- - name: Checkout Actions
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- with:
- ref: ${{ (github.event_name == 'pull_request' && github.sha) || 'main' }}
- sparse-checkout: |
- .github/workflows/
- sparse-checkout-cone-mode: false
- path: workflows
- - name: Setup Stage
- id: setup-stage
- uses: ./workflows/.github/workflows/release-binaries-setup-stage
- with:
- previous-artifact: build-release-package
-
- - name: Run Tests
- shell: bash
- run: |
- ninja -C ${{ steps.setup-stage.outputs.build-prefix }}/build stage2-check-all
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left one minor comment but otherwise LGTM, although it's the first time i've looked at this configuration so probably sensible if someone else also takes a look.
- name: Run Tests | ||
# These almost always fail so don't let them fail the build and prevent the uploads. | ||
continue-on-error: true | ||
run: | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should you also to specify shell: bash
here? I noticed most if not all other run sections do
Also, ignore the test results since they almost always fail. This allows us to simplify the build process and skip uploading and downloading the build and source directories which are huge.