Fix architecture-based early unit test exit logic, update mold => 2.34.1 to fix arm issues (#10617)

* Fix architecture-based early unit test exit logic.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Add mold binaries

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Refactor unit test again.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Remove runner_check from unit tests.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* lint yaml

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Update workflow actions.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Fix action tag usage.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Add fail_on_error to markdownlint unit test.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

---------

Signed-off-by: Satadru Pramanik <satadru@gmail.com>
This commit is contained in:
Satadru Pramanik, DO, MPH, MEng
2024-10-16 15:36:59 -04:00
committed by GitHub
parent 4d3b71f0ce
commit 11b197477d
5 changed files with 52 additions and 58 deletions

View File

@@ -9,4 +9,6 @@ jobs:
- name: Markdown-lint
uses: reviewdog/action-markdownlint@v0
with:
reporter: github-pr-review
fail_on_error: true
markdownlint_flags: '-s .mdl_style.rb'

View File

@@ -9,4 +9,6 @@ jobs:
- name: ShellCheck
uses: reviewdog/action-shellcheck@v1
with:
reporter: github-pr-review
fail_on_error: true
exclude: './tools/*'

View File

@@ -7,48 +7,37 @@ jobs:
matrix:
arch: [x86_64, armv7l, i686]
runner: [self-hosted, ubuntu-latest]
exclude:
- arch: x86_64
runner: self-hosted
- arch: i686
runner: self-hosted
- arch: armv7l
runner: ubuntu-latest
runs-on: ${{ matrix.runner }}
steps:
- name: Exit quickly if on wrong runner.
id: runner_check
run: |
arch="${{ matrix.arch }}"
runner="${{ matrix.runner }}"
echo "matrix arch is $arch"
echo "matrix runner is $runner"
[[ $arch == 'armv7l' ]] && [[ $runner == 'ubuntu-latest' ]] && export exitquick=1
[[ $arch != 'armv7l' ]] && [[ $runner == 'self-hosted' ]] && export exitquick=1
if [[ -n $exitquick ]]; then
echo "exiting"
echo "skipnext=true" >> $GITHUB_OUTPUT
else
echo "not exiting"
fi
- uses: actions/checkout@v4
if: ( steps.runner_check.outputs.skipnext != 'true' )
- name: Dump github context
if: ( steps.runner_check.outputs.skipnext != 'true' )
run: echo "$GITHUB_CONTEXT"
- name: Get non-pkg changed files
id: non-pkg-changed-files
if: ( steps.runner_check.outputs.skipnext != 'true' )
uses: tj-actions/changed-files@v45
with:
files_ignore: packages/*.rb
files_ignore: |
packages/*.rb
manifest/**
tools/packages.yaml
- name: Get all changed package files
id: changed-ruby-files
if: ( steps.runner_check.outputs.skipnext != 'true' )
uses: tj-actions/changed-files@v45
with:
files: packages/*.rb
- name: Export variables to github context
if: ( steps.runner_check.outputs.skipnext != 'true' )
run: |
# Convert "packages/foo.rb packages/bar.rb" (from steps.changed-ruby-files.outputs.all_changed_files) into "foo bar"
echo "CHANGED_PACKAGES=$(echo "${{ steps.changed-ruby-files.outputs.all_changed_files }}" | xargs basename -s .rb | xargs)" >> $GITHUB_ENV
echo "NON_PKG_CHANGED_FILES=$(echo "${{ steps.non-pkg-changed-files.outputs.all_changed_files }}" | xargs)" >> $GITHUB_ENV
- name: Determine glibc and architecture package compatibility
if: ( steps.runner_check.outputs.skipnext != 'true' )
run: |
# If a package doesnt have a min_glibc value, or if its below 2.27, add it to GLIBC_227_COMPATIBLE_PACKAGES.
export GLIBC_227_COMPATIBLE_PACKAGES="$(for i in ${CHANGED_PACKAGES} ; do if grep -q min_glibc packages/${i}.rb; then grep min_glibc packages/${i}.rb | tr -d \' | awk '{exit $2 <= 2.27}' || echo ${i} ; else echo ${i} ; fi ; done | xargs -r)"
@@ -85,52 +74,50 @@ jobs:
echo "PR #${{ github.event.pull_request.number }} has these i686 compatible packages: ${i686_PACKAGES}"
fi
- name: Export target docker container to github context
if: ( steps.runner_check.outputs.skipnext != 'true' )
env:
TARGET_ARCH: ${{ matrix.arch }}
run: |
case $TARGET_ARCH in
x86_64)
# Export the x86_64 container depending on whether this PR updates packages with a minimum glibc greater than or equal to 2.37.
if [[ $GLIBC_237_COMPATIBLE_PACKAGES ]]; then
echo "CONTAINER=hatch-x86_64.m129" >> $GITHUB_ENV
else
echo "CONTAINER=nocturne-x86_64.m90" >> $GITHUB_ENV
fi
echo "PLATFORM=linux/amd64" >> $GITHUB_ENV
echo "LIB_SUFFIX=64" >> $GITHUB_ENV
# Export the x86_64 container depending on whether this PR updates packages with a minimum glibc greater than or equal to 2.37.
if [[ $GLIBC_237_COMPATIBLE_PACKAGES ]]; then
echo "CONTAINER=hatch-x86_64.m129" >> $GITHUB_ENV
else
echo "CONTAINER=nocturne-x86_64.m90" >> $GITHUB_ENV
fi
echo "PLATFORM=linux/amd64" >> $GITHUB_ENV
echo "LIB_SUFFIX=64" >> $GITHUB_ENV
;;
armv7l)
# Export the armv7l container depending on whether this PR updates packages with a minimum glibc greater than or equal to 2.37.
if [[ $GLIBC_237_COMPATIBLE_PACKAGES ]]; then
echo "CONTAINER=strongbad-armv7l.m129" >> $GITHUB_ENV
else
echo "CONTAINER=fievel-armv7l.m91" >> $GITHUB_ENV
fi
echo "PLATFORM=linux/arm/v7" >> $GITHUB_ENV
echo "LIB_SUFFIX=" >> $GITHUB_ENV
# Export the armv7l container depending on whether this PR updates packages with a minimum glibc greater than or equal to 2.37.
if [[ $GLIBC_237_COMPATIBLE_PACKAGES ]]; then
echo "CONTAINER=strongbad-armv7l.m129" >> $GITHUB_ENV
else
echo "CONTAINER=fievel-armv7l.m91" >> $GITHUB_ENV
fi
echo "PLATFORM=linux/arm/v7" >> $GITHUB_ENV
echo "LIB_SUFFIX=" >> $GITHUB_ENV
;;
i686)
# There is only one i686 container based upon M58 with glibc 2.23.
echo "CONTAINER=alex-i686.m58" >> $GITHUB_ENV
echo "PLATFORM=linux/386" >> $GITHUB_ENV
echo "LIB_SUFFIX=" >> $GITHUB_ENV
# There is only one i686 container based upon M58 with glibc 2.23.
echo "CONTAINER=alex-i686.m58" >> $GITHUB_ENV
echo "PLATFORM=linux/386" >> $GITHUB_ENV
echo "LIB_SUFFIX=" >> $GITHUB_ENV
;;
esac
- name: Run unit tests
if: ( steps.runner_check.outputs.skipnext != 'true' )
run: |
if [[ -z ${NON_PKG_CHANGED_FILES} ]] && [[ $PLATFORM == 'linux/arm/v7' ]] && [[ -z ${ARMV7L_PACKAGES} ]]; then
# Run the arm container if there are non-package changed files,
# but otherwise do not run the arm container if there are no packages compatible with armv7l.
if [ -z "${NON_PKG_CHANGED_FILES}" ] && ([ "$PLATFORM" == 'linux/arm/v7' ] && [ -z "${ARMV7L_PACKAGES}" ]); then
# Exit the arm container if there are neither non-package changed files nor armv7l compatible packages.
echo "Skipping armv7l container unit tests."
exit 0
elif [[ -z ${NON_PKG_CHANGED_FILES} ]] && [[ $PLATFORM == 'linux/amd64' ]] && [[ -z ${x86_64_PACKAGES} ]]; then
# Run the x86_64 container if there are non-package changed files,
# but otherwise do not run the x86_64 container if there are no packages compatible with x86_64.
elif [ -z "${NON_PKG_CHANGED_FILES}" ] && ([ "$PLATFORM" == 'linux/amd64' ] && [ -z "${x86_64_PACKAGES}" ]); then
# Exit the x86_64 container if there are neither non-package changed files nor x86_64 compatible packages.
echo "Skipping x86_64 container unit tests."
exit 0
elif [[ -z ${NON_PKG_CHANGED_FILES} ]] && [[ $PLATFORM == 'linux/386' ]] && [[ -z ${i686_PACKAGES} ]]; then
# Run the i686 container if there are non-package changed files,
# but otherwise do not run the i686 container if there are no packages compatible with i686.
elif [ -z "${NON_PKG_CHANGED_FILES}" ] && ([ "$PLATFORM" == 'linux/386' ] && [ -z "${i686_PACKAGES}" ]); then
# Exit the i686 container if there are neither non-package changed files nor i686 compatible packages.
echo "Skipping i686 container unit tests."
exit 0
else
docker pull --platform $PLATFORM satmandu/crewbuild:$CONTAINER

View File

@@ -8,3 +8,6 @@ jobs:
- uses: actions/checkout@v4
- name: YAMLLint
uses: reviewdog/action-yamllint@v1
with:
reporter: github-pr-review
fail_on_error: true