Skip to content
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "clp-core-build"
name: "clp-core-image-run"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about run-on-image?

description: "Builds CLP-core in the specified container"
Comment thread
davidlion marked this conversation as resolved.
Resolved

inputs:
Expand All @@ -8,15 +8,9 @@ inputs:
use_published_image:
description: "Whether to use the published container image"
required: true
use_shared_libs:
description: "Whether to build the core binaries by linking against shared libraries"
run_command:
description: "Bash script executed inside docker run"
Comment thread
davidlion marked this conversation as resolved.
Resolved
required: true
upload_binaries:
description: "Whether to upload the core binaries"
required: true
binaries_artifact_name:
description: "Name of the artifact containing the core binaries"
required: false

runs:
using: "composite"
Expand Down Expand Up @@ -54,28 +48,5 @@ runs:
--volume "$GITHUB_WORKSPACE":/mnt/clp
--workdir /mnt/clp
${{steps.get_image_props.outputs.qualified_image_name}}
bash -c "task deps:core &&
python3 /mnt/clp/components/core/tools/scripts/utils/build-and-run-unit-tests.py
${{inputs.use_shared_libs == 'true' && '--use-shared-libs' || ''}}
--source-dir /mnt/clp/components/core
--build-dir /mnt/clp/components/core/build
--num-jobs $(getconf _NPROCESSORS_ONLN)"
shell: "bash"

- if: "inputs.upload_binaries == 'true'"
id: "copy_binaries"
run: |-
output_dir="/tmp/${{inputs.binaries_artifact_name}}"
echo "output_dir=${output_dir}" >> "$GITHUB_OUTPUT"

mkdir -p "${output_dir}"
cd "$GITHUB_WORKSPACE/components/core/build"
tar cfvv "${output_dir}/clp.tar" clg clp clp-s glt make-dictionaries-readable
bash -c "${{inputs.run_command}}"
shell: "bash"

- if: "inputs.upload_binaries == 'true'"
uses: "actions/upload-artifact@v4"
with:
name: "${{inputs.binaries_artifact_name}}"
path: "${{steps.copy_binaries.outputs.output_dir}}"
retention-days: 1
49 changes: 38 additions & 11 deletions .github/workflows/clp-core-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: "clp-core-build"
on:
pull_request:
paths:
- ".github/actions/clp-core-build/action.yaml"
- ".github/actions/clp-core-build-containers/action.yaml"
- ".github/actions/clp-core-image-run/action.yaml"
- ".github/workflows/clp-core-build.yaml"
- ".gitmodules"
- "components/core/**"
Expand All @@ -14,8 +14,8 @@ on:
- "!components/core/tools/scripts/lib_install/macos/**"
push:
paths:
- ".github/actions/clp-core-build/action.yaml"
- ".github/actions/clp-core-build-containers/action.yaml"
- ".github/actions/clp-core-image-run/action.yaml"
- ".github/workflows/clp-core-build.yaml"
- ".gitmodules"
- "components/core/**"
Expand Down Expand Up @@ -163,16 +163,21 @@ jobs:
run: "chown $(id -u):$(id -g) -R ."
shell: "bash"

- uses: "./.github/actions/clp-core-build"
- uses: "./.github/actions/clp-core-image-run"
env:
OS_NAME: "centos-stream-9"
with:
image_name: "${{env.DEPS_IMAGE_NAME_PREFIX}}${{env.OS_NAME}}"
use_shared_libs: "${{matrix.use_shared_libs}}"
use_published_image: >-
${{needs.filter-relevant-changes.outputs.centos_stream_9_image_changed == 'false'
|| (github.event_name != 'pull_request' && github.ref == 'refs/heads/main')}}
upload_binaries: "false"
run_command: >-
task deps:core &&
python3 /mnt/clp/components/core/tools/scripts/utils/build-and-run-unit-tests.py
Comment thread
davidlion marked this conversation as resolved.
Resolved
${{matrix.use_shared_libs == 'true' && '--use-shared-libs' || ''}}
--source-dir /mnt/clp/components/core
--build-dir /mnt/clp/components/core/build
--num-jobs $(getconf _NPROCESSORS_ONLN)

ubuntu-jammy-binaries:
# Run if the ancestor jobs succeeded OR they were skipped and clp was changed.
Expand All @@ -189,6 +194,8 @@ jobs:
upload_binaries: false
- use_shared_libs: false
upload_binaries: true
env:
OS_NAME: "ubuntu-jammy"
name: "ubuntu-jammy-${{matrix.use_shared_libs && 'dynamic' || 'static'}}-linked-bins"
continue-on-error: true
runs-on: "ubuntu-latest"
Expand All @@ -201,17 +208,37 @@ jobs:
run: "chown $(id -u):$(id -g) -R ."
shell: "bash"

- uses: "./.github/actions/clp-core-build"
env:
OS_NAME: "ubuntu-jammy"
- uses: "./.github/actions/clp-core-image-run"
with:
image_name: "${{env.DEPS_IMAGE_NAME_PREFIX}}${{env.OS_NAME}}"
use_shared_libs: "${{matrix.use_shared_libs}}"
use_published_image: >-
${{needs.filter-relevant-changes.outputs.ubuntu_jammy_image_changed == 'false'
|| (github.event_name != 'pull_request' && github.ref == 'refs/heads/main')}}
upload_binaries: "${{matrix.upload_binaries}}"
binaries_artifact_name: "${{env.BINARIES_ARTIFACT_NAME_PREFIX}}${{env.OS_NAME}}"
run_command: >-
task deps:core &&
python3 /mnt/clp/components/core/tools/scripts/utils/build-and-run-unit-tests.py
Comment thread
davidlion marked this conversation as resolved.
Resolved
${{matrix.use_shared_libs == 'true' && '--use-shared-libs' || ''}}
--source-dir /mnt/clp/components/core
--build-dir /mnt/clp/components/core/build
--num-jobs $(getconf _NPROCESSORS_ONLN)

- if: "${{matrix.upload_binaries}}"
Comment thread
davidlion marked this conversation as resolved.
Resolved
id: "copy_binaries"
run: |-
output_dir="/tmp/${{env.BINARIES_ARTIFACT_NAME_PREFIX}}${{env.OS_NAME}}"
echo "output_dir=${output_dir}" >> "$GITHUB_OUTPUT"

mkdir -p "${output_dir}"
cd "$GITHUB_WORKSPACE/components/core/build"
tar cfvv "${output_dir}/clp.tar" clg clp clp-s glt make-dictionaries-readable
shell: "bash"

- if: "${{matrix.upload_binaries}}"
Comment thread
davidlion marked this conversation as resolved.
Resolved
uses: "actions/upload-artifact@v4"
with:
name: "${{env.BINARIES_ARTIFACT_NAME_PREFIX}}${{env.OS_NAME}}"
path: "${{steps.copy_binaries.outputs.output_dir}}"
retention-days: 1

ubuntu-jammy-binaries-image:
# Run if the ancestor jobs were successful/skipped, building clp was successful, and this is a
Expand Down