Skip to content

Commit

Permalink
wf
Browse files Browse the repository at this point in the history
  • Loading branch information
userdocs committed Jan 27, 2025
1 parent 05a5517 commit 009d6f6
Show file tree
Hide file tree
Showing 5 changed files with 200 additions and 115 deletions.
24 changes: 24 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
root = true

[*]
indent_style = tab
tab_width = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
indent_style = space
trim_trailing_whitespace = false

[*.{json,yml,yaml}]
indent_style = space
indent_size = 2

[LICENSE.txt]
indent_style = space
indent_size = 0

[Jamfile]
indent_style = tabs
44 changes: 44 additions & 0 deletions .github/workflows/ci-auto-rerun-failed-jobs-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: ci - auto rerun failed jobs

on:
workflow_dispatch:
inputs:
run_id:
description: "The run id of the workflow to rerun"
required: true
attempts:
description: "The number of attempts to rerun the workflow"
required: true
retries:
description: "The number of retries to rerun the workflow"
required: true
github_repo:
description: "The repository to rerun the workflow"
required: false
distinct_id:
description: "The distinct id of the workflow to rerun"
required: false

run-name: ci auto rerun failed jobs - attempt ${{ inputs.attempts }}

jobs:
gh-cli-rerun:
name: rerun - attempt ${{ inputs.attempts }}
permissions:
actions: write
runs-on: ubuntu-24.04-arm
env:
GH_TOKEN: "${{ secrets.AUTO_RERUN || github.token }}"
steps:
- name: Host - Checkout action ${{ inputs.distinct_id }}
uses: actions/checkout@v4
with:
persist-credentials: false

- uses: userdocs/gh-cli-workflow-reruns/actions/auto-rerun-failed@main
with:
run_id: ${{ inputs.run_id }}
attempts: ${{ inputs.attempts }}
retries: ${{ inputs.retries }}
github_repo: ${{ inputs.github_repo || github.repository }}
distinct_id: ${{ inputs.distinct_id || github.run_id }}
76 changes: 76 additions & 0 deletions .github/workflows/ci-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: ci - checks
on:
push:
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
sh-checker:
runs-on: ubuntu-24.04-arm
permissions:
contents: read
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- name: Run the sh-checker
uses: luizm/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
SHELLCHECK_OPTS: -e SC2034,SC1091 # It is possible to exclude some shellcheck warnings.
SHFMT_OPTS: -ci -sr -i 0 # It is possible to pass arguments to shftm
with:
sh_checker_comment: true
sh_checker_exclude: ""

zizmor-checker:
runs-on: ubuntu-24.04-arm
permissions:
contents: read
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- name: Check GitHub Action workflows
shell: bash {0}
run: |
pip install zizmor
zizmor="$(zizmor . --gh-token "${{ github.token }}")"
exit_code="$?"
printf '%s\n' "$zizmor"
printf '%b\n' "\`\`\`" >> $GITHUB_STEP_SUMMARY
printf '%s\n' "$zizmor" >> $GITHUB_STEP_SUMMARY
printf '%b' "\`\`\`" >> $GITHUB_STEP_SUMMARY
exit "$exit_code"
editorconfig-checker:
runs-on: ubuntu-24.04-arm
permissions:
contents: read
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- name: editorconfig-checker
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl -Lo- "https://github.com/editorconfig-checker/editorconfig-checker/releases/latest/download/ec-linux-amd64.tar.gz" | tar xzf - --strip-components=1
printf '%b\n' "\`\`\`" >> $GITHUB_STEP_SUMMARY
./ec-linux-amd64 --exclude '^(docs/.*|patches/.*)$' | sed "s,\x1B\[[0-9;]*[a-zA-Z],,g" >> $GITHUB_STEP_SUMMARY
exit_code=("${PIPESTATUS[0]}")
printf '%b' "\`\`\`" >> $GITHUB_STEP_SUMMARY
# exit "${exit_code}"
127 changes: 56 additions & 71 deletions .github/workflows/qt6_crossbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
skip_rerun:
description: "Skip rerun?"
required: true
default: true
default: false
type: boolean
retries:
description: "Number of rerun retries"
Expand All @@ -19,12 +19,11 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: write
permissions: {}

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
outputs:
qt_version: ${{ steps.version_info.outputs.qt_version }}
strategy:
Expand Down Expand Up @@ -52,62 +51,34 @@ jobs:
opt_dir_name: "opt/local"
qt_short_version: "6"
cxx_standard: "17"
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
GH_TOKEN: "${{ github.token }}"

steps:
- name: Host - Checkout action
uses: actions/checkout@v4
with:
persist-credentials: false

# Fix this bug https://github.com/actions/runner-images/issues/7192
- name: Host - phased updates
run: printf '%s\n' 'APT::Get::Always-Include-Phased-Updates "false";' | sudo tee /etc/apt/apt.conf.d/99-phased-updates

# Bootstrap Ubuntu Lunar repo so that we can install specific app we may need, like binfmt and qemu-user-static
- name: Host - set up lunar repo -t lunar
run: |
printf '%b\n' 'Package: *\nPin: release n=lunar\nPin-Priority: 50' | sudo tee /etc/apt/preferences
printf '%s\n' 'deb http://archive.ubuntu.com/ubuntu/ lunar main universe restricted' | sudo tee /etc/apt/sources.list.d/lunar.list
- name: Host - update
run: sudo apt-get update

# - name: Host - upgrade
# run: sudo apt-get -y upgrade

# No action or other method to bootstrap binfmt. Install from lunar and we get the latest versions and full docker support
- name: Host - set up qemu-user-static binfmt-support from lunar
run: sudo apt install -t lunar libpipeline1 qemu-user-static binfmt-support

# Why are we doing it like this and not using a container setup? That's how you're supposed to do it, right?
# qemu-user-static and binfmt-support are not part of the runner images https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md
# We would need to modify the runner to install these before the container starts. Which you cannot do as there is no way to bootstrap the host.
# So we install them on the host then create/pull a custom docker image that we use to build the multiarch targets.
# We are always on the host runner but can use any docker image we need with the access the qemu emulation when required.
#
# We are using these pre configured toolchain images that allows me to remove 50% of the code/time from this action.
#
# https://github.com/userdocs/dcb/blob/main/Dockerfile
#
# The image does not run as root and has password-less sudo. There are two users username:1000 /home/username and github:1001 /home/github
# In the action it runs as 1001 /home/github and files should be available to the host. For local use, you might need -u 1000
run: apt install -t lunar libpipeline1 qemu-user-static binfmt-support

- name: Host - Create docker multiarch ${{ matrix.arch }} container
run: docker run --name multiarch -it -d -u 1001 -v ${{ github.workspace }}:/home/github ghcr.io/userdocs/dcb:${{ matrix.os_id }}-${{ matrix.os_codename }}-${{ matrix.arch }}
run: docker run --name multiarch -it -d -v ${{ github.workspace }}:/home/github ghcr.io/userdocs/dcb:${{ matrix.os_id }}-${{ matrix.os_codename }}-${{ matrix.arch }}

- name: Docker - cmake and ninja download and install
run: |
docker exec multiarch curl -sNL "https://github.com/userdocs/cmake-crossbuild/releases/latest/download/${{ matrix.os_id }}-${{ matrix.os_codename }}-cmake-${{ matrix.arch }}.deb" -o ${{ matrix.os_id }}-${{ matrix.os_codename }}-cmake-${{ matrix.arch }}.deb
docker exec multiarch sudo dpkg -i ${{ matrix.os_id }}-${{ matrix.os_codename }}-cmake-${{ matrix.arch }}.deb
docker exec multiarch dpkg -i ${{ matrix.os_id }}-${{ matrix.os_codename }}-cmake-${{ matrix.arch }}.deb
- name: Docker - zlib-ng download and install
run: |
docker exec multiarch curl -sNL "https://github.com/userdocs/zlib-ng-crossbuild/releases/latest/download/${{ matrix.os_id }}-${{ matrix.os_codename }}-zlib-ng-${{ matrix.arch }}.deb" -o ${{ matrix.os_id }}-${{ matrix.os_codename }}-zlib-ng-${{ matrix.arch }}.deb
docker exec multiarch sudo dpkg -i ${{ matrix.os_id }}-${{ matrix.os_codename }}-zlib-ng-${{ matrix.arch }}.deb
docker exec multiarch dpkg -i ${{ matrix.os_id }}-${{ matrix.os_codename }}-zlib-ng-${{ matrix.arch }}.deb
- name: Docker - openssl download and install
run: |
docker exec multiarch curl -sNL "https://github.com/userdocs/openssl-crossbuild/releases/latest/download/${{ matrix.os_id }}-${{ matrix.os_codename }}-openssl-${{ matrix.arch }}.deb" -o ${{ matrix.os_id }}-${{ matrix.os_codename }}-openssl-${{ matrix.arch }}.deb
docker exec multiarch sudo dpkg -i ${{ matrix.os_id }}-${{ matrix.os_codename }}-openssl-${{ matrix.arch }}.deb
docker exec multiarch dpkg -i ${{ matrix.os_id }}-${{ matrix.os_codename }}-openssl-${{ matrix.arch }}.deb
- name: Host - qt get latest release info and create env and urls
id: version_info
Expand All @@ -125,11 +96,11 @@ jobs:
printf '%s\n' "qt_version=${qt_version}" >> $GITHUB_OUTPUT
- name: Host - qt qtbase - curl
run: curl -sNL ${{ env.qt_qtbase_url }} -o qtbase.tar.xz && tar xf qtbase.tar.xz
run: curl -sNL ${qt_qtbase_url} -o qtbase.tar.xz && tar xf qtbase.tar.xz

- name: Docker - qt qtbase - cmake configure
run: >
docker exec -w /home/github/qtbase-everywhere-src-${{ env.qt_version }} multiarch cmake -Wno-dev -Wno-deprecated -G Ninja -B build
docker exec -u github:github -w /home/github/qtbase-everywhere-src-${qt_version} multiarch cmake -Wno-dev -Wno-deprecated -G Ninja -B build
-D CMAKE_BUILD_TYPE="release"
-D CMAKE_CXX_FLAGS="-lstdc++fs"
-D CMAKE_EXE_LINKER_FLAGS="-lstdc++fs"
Expand All @@ -152,30 +123,30 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.arch }}-${{ matrix.os_id }}-${{ matrix.os_codename }}-${{ matrix.name }}-cmake-logs
path: qtbase-everywhere-src-${{ env.qt_version }}/build/
path: qtbase-everywhere-src-${qt_version}/build/

- name: Docker - qt qtbase - cmake build
run: docker exec -w /home/github/qtbase-everywhere-src-${{ env.qt_version }} multiarch cmake --build build
run: docker exec -u github:github -w /home/github/qtbase-everywhere-src-${qt_version} multiarch cmake --build build

- name: Docker - qt qtbase - cmake install
run: docker exec -w /home/github/qtbase-everywhere-src-${{ env.qt_version }} multiarch cmake --install build
run: docker exec -u github:github -w /home/github/qtbase-everywhere-src-${qt_version} multiarch cmake --install build

- name: Docker - qt qttools - curl
run: curl -sNL ${{ env.qt_qttools_url }} -o qttools.tar.xz && tar xf qttools.tar.xz
run: curl -sNL ${qt_qttools_url} -o qttools.tar.xz && tar xf qttools.tar.xz

- name: Docker - qt qttools - cmake configure
run: >
docker exec -w /home/github/qttools-everywhere-src-${{ env.qt_version }} multiarch cmake -Wno-dev -Wno-deprecated -G Ninja -B build
docker exec -u github:github -w /home/github/qttools-everywhere-src-${qt_version} multiarch cmake -Wno-dev -Wno-deprecated -G Ninja -B build
-D CMAKE_BUILD_TYPE="release"
-D CMAKE_CXX_STANDARD="${{ env.cxx_standard }}"
-D CMAKE_PREFIX_PATH="/${{ env.opt_dir_name }}"
-D CMAKE_INSTALL_PREFIX="/home/github/build/${{ env.opt_dir_name }}"
- name: Docker - qt qttools - cmake build
run: docker exec -w /home/github/qttools-everywhere-src-${{ env.qt_version }} multiarch cmake --build build
run: docker exec -u github:github -w /home/github/qttools-everywhere-src-${qt_version} multiarch cmake --build build

- name: Docker - qt qttools - cmake install
run: docker exec -w /home/github/qttools-everywhere-src-${{ env.qt_version }} multiarch cmake --install build
run: docker exec -u github:github -w /home/github/qttools-everywhere-src-${qt_version} multiarch cmake --install build

- name: Docker - Set deb dependencies for qt
run: |
Expand All @@ -184,18 +155,18 @@ jobs:
if [[ ${{ matrix.os_codename }} =~ ^(bullseye|jammy)$ ]]; then
md4c_html="$(docker exec multiarch apt-cache search --names-only libmd4c-html0$ | sort -r | head -n1 | awk '{print $1}')"
printf '%s\n' "qt-deb-deps=zlib-ng,openssl,${icu},${double_conversion},${md4c_html}" >> $GITHUB_ENV
printf '%s\n' "zlib-ng,openssl,${icu},${double_conversion},${md4c_html}" >> $GITHUB_ENV
else
printf '%s\n' "qt-deb-deps=zlib-ng,openssl,${icu},${double_conversion}" >> $GITHUB_ENV
printf '%s\n' "zlib-ng,openssl,${icu},${double_conversion}" >> $GITHUB_ENV
fi
- name: Docker - ldconfig - create /etc/ld.so.conf.d/qt6.conf
run: |
docker exec -w /home/github/build multiarch mkdir -p DEBIAN
docker exec -w /home/github/build/DEBIAN multiarch bash -c "printf '%b\n' '#!/usr/bin/env bash\nldconfig' > postinst"
docker exec -w /home/github/build/DEBIAN multiarch bash -c "chmod +x postinst"
docker exec -w /home/github/build multiarch mkdir -p etc/ld.so.conf.d
docker exec -w /home/github/build/etc/ld.so.conf.d multiarch bash -c "printf '%s\n' '/${{ env.opt_dir_name }}/lib' > qt6.conf"
docker exec -u github:github -w /home/github/build multiarch mkdir -p DEBIAN
docker exec -u github:github -w /home/github/build/DEBIAN multiarch bash -c "printf '%b\n' '#!/usr/bin/env bash\nldconfig' > postinst"
docker exec -u github:github -w /home/github/build/DEBIAN multiarch bash -c "chmod +x postinst"
docker exec -u github:github -w /home/github/build multiarch mkdir -p etc/ld.so.conf.d
docker exec -u github:github -w /home/github/build/etc/ld.so.conf.d multiarch bash -c "printf '%s\n' '/${{ env.opt_dir_name }}/lib' > qt6.conf"
- name: Host - Create deb packages
uses: jiro4989/build-deb-action@v4
Expand All @@ -210,7 +181,7 @@ jobs:
desc: "${{ matrix.name }}-${{ matrix.arch }} for ${{ matrix.os_id }}-${{ matrix.os_codename }}"

- name: Host - Remove version from release name and use hyphens
run: mv -f "${{ matrix.name }}_${{ env.qt_version }}_${{ matrix.arch }}.deb" "${{ matrix.os_id }}-${{ matrix.os_codename }}-${{ matrix.name }}-${{ matrix.arch }}.deb"
run: mv -f "${{ matrix.name }}_${qt_version}_${{ matrix.arch }}.deb" "${{ matrix.os_id }}-${{ matrix.os_codename }}-${{ matrix.name }}-${{ matrix.arch }}.deb"

- name: Host - upload deb packages
uses: actions/upload-artifact@v4
Expand All @@ -220,15 +191,17 @@ jobs:

release:
name: Upload artifacts to release
runs-on: ubuntu-latest
needs: build
if: always() && contains(needs.*.result, 'success') && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
runs-on: ubuntu-24.04-arm
needs: [build]
if: needs.build.result == 'success'
env:
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
GH_TOKEN: "${{ github.token }}"
qt_version: ${{ needs.build.outputs.qt_version }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Host - Download artifacts
uses: actions/download-artifact@v4
Expand All @@ -251,18 +224,30 @@ jobs:
body: "Built with cmake using v${{ env.qt_version }} from github on amd64 arm64 armhf for Debian Bullseye Bookworm and Ubuntu Focal Jammy Noble"
allowUpdates: true

rerun-on-failure:
if: failure() && inputs.skip_rerun == '0'
name: rerun-on-failure
needs: release
ci-auto-rerun-failed-jobs:
if: failure() && (github.event.inputs.skip_rerun || 'false') == 'false'
needs: [release]
concurrency:
group: ci-auto-rerun-failed-jobs
cancel-in-progress: true
permissions:
actions: write
runs-on: ubuntu-latest
runs-on: ubuntu-24.04-arm
env:
GH_TOKEN: "${{ github.TOKEN }}"
GH_TOKEN: "${{ secrets.AUTO_RERUN || github.token }}"
github_repo: "" # To use ci-auto-rerun-failed-jobs.yml hosted in a remote repository else default to the current repository. Requires PAT token AUTO_RERUN
retries: ${{ github.event.inputs.retries || '1' }}
distinct_id: ${{ github.event.inputs.distinct_id }}
steps:
- uses: actions/checkout@v4
- name: Trigger rerun workflow on job failures
run: |
inputs_retries="${{ inputs.retries }}"
gh workflow run rerun.yml -f run_id=${{ github.run_id }} -f attempts=${{ github.run_attempt }} -f retries=${inputs_retries:-1}
with:
persist-credentials: false
- name: ci-auto-rerun-failed-jobs via ${{ env.github_repo || github.repository }}
run: >
gh workflow run ci-auto-rerun-failed-jobs-action.yml
--repo "${github_repo:-$GITHUB_REPOSITORY}"
-f github_repo=${GITHUB_REPOSITORY}
-f run_id=${GITHUB_RUN_ID}
-f attempts=${GITHUB_RUN_ATTEMPT}
-f retries=${retries}
-f distinct_id=${distinct_id}
Loading

0 comments on commit 009d6f6

Please sign in to comment.