Skip to content

Commit

Permalink
Try #544:
Browse files Browse the repository at this point in the history
  • Loading branch information
bors-ferrocene[bot] committed Jun 18, 2024
2 parents f3321ca + 0dceebb commit 8e6e08c
Show file tree
Hide file tree
Showing 16 changed files with 453 additions and 11 deletions.
23 changes: 15 additions & 8 deletions .circleci/calculate-parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,18 @@
# How long should it take before an image is rebuilt.
REBUILD_IMAGES_OLDER_THAN_DAYS = 7

# QNX targets only work on x86_64 Windows, x86_64 Linux, and x86_64 Mac
# They must be excluded on, for example, aarch64 Mac
QNX_TARGETS = [
"aarch64-unknown-nto-qnx710",
"x86_64-pc-nto-qnx710",
]

# Targets only built (and self-tested!) on Linux.
LINUX_ONLY_TARGETS = ["x86_64-unknown-linux-gnu", "aarch64-unknown-linux-gnu"]
# x86_64-unknown-linux-gnu builds a number of cross compilation targets
# for us and is special cased somewhat.
LINUX_BUILT_CROSS_TARGETS = [
X86_64_LINUX_BUILT_CROSS_TARGETS = [
"aarch64-unknown-none",
"thumbv7em-none-eabi",
"thumbv7em-none-eabihf",
Expand All @@ -47,15 +54,15 @@
"armv7r-none-eabihf",
"armebv7r-none-eabihf",
]
LINUX_ALL_TARGETS = LINUX_ONLY_TARGETS + LINUX_BUILT_CROSS_TARGETS
X86_64_LINUX_ALL_TARGETS = LINUX_ONLY_TARGETS + X86_64_LINUX_BUILT_CROSS_TARGETS + QNX_TARGETS

# Targets only built (and tested!) on Mac
MAC_ONLY_TARGETS = ["aarch64-apple-darwin", "x86_64-apple-darwin"]
MAC_ALL_TARGETS = MAC_ONLY_TARGETS + LINUX_BUILT_CROSS_TARGETS
AARCH64_MAC_ALL_TARGETS = MAC_ONLY_TARGETS + X86_64_LINUX_BUILT_CROSS_TARGETS

# Tagets only built (and tested!) on Windows
WINDOWS_ONLY_TARGETS = ["x86_64-pc-windows-msvc"]
WINDOWS_ALL_TARGETS = WINDOWS_ONLY_TARGETS + LINUX_BUILT_CROSS_TARGETS
X86_64_WINDOWS_ALL_TARGETS = WINDOWS_ONLY_TARGETS + X86_64_LINUX_BUILT_CROSS_TARGETS + QNX_TARGETS

s3 = boto3.client("s3", region_name=S3_REGION)
ecr = boto3.client("ecr", region_name=ECR_REGION)
Expand Down Expand Up @@ -158,16 +165,16 @@ def calculate_targets(host_plus_stage: str):
raise Exception(f"Host {host} not supported at this time, please add support")
elif stage == "std-only":
if host == "x86_64-unknown-linux-gnu":
targets = LINUX_ALL_TARGETS
targets = X86_64_LINUX_ALL_TARGETS
else:
raise Exception("Only the `x86_64-unknown-linux-gnu` currently runs the `std-only` stage.")
elif stage == "self-test":
if host == "x86_64-unknown-linux-gnu":
targets = LINUX_ALL_TARGETS
targets = X86_64_LINUX_ALL_TARGETS
elif host == "aarch64-apple-darwin":
targets = MAC_ALL_TARGETS
targets = AARCH64_MAC_ALL_TARGETS
elif host == "x86_64-pc-windows-msvc":
targets = WINDOWS_ALL_TARGETS
targets = X86_64_WINDOWS_ALL_TARGETS
else:
raise Exception(f"Host {host} not supported at this time, please add support")
else:
Expand Down
31 changes: 28 additions & 3 deletions .circleci/workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ jobs:
./x.py --stage 2 dist rust-std
steps:
- ferrocene-job-dist:
qnx: true
restore-from-job: x86_64-linux-build

x86_64-linux-dist-src:
Expand Down Expand Up @@ -321,9 +322,10 @@ jobs:
FERROCENE_HOST: x86_64-unknown-linux-gnu
FERROCENE_TARGETS: << pipeline.parameters.targets--x86_64-unknown-linux-gnu--self-test >>
steps:
- aws-oidc-auth
- ferrocene-git-shallow-clone:
depth: 1
- aws-oidc-auth
- setup-qnx-toolchain: {}
- run:
name: Download dist artifacts and run the self-test tool
command: ferrocene/ci/scripts/run-self-test.sh
Expand Down Expand Up @@ -412,6 +414,7 @@ jobs:
depth: 1
- ferrocene-setup-darwin # Darwin does not come with awscli, setup it before aws steps
- aws-oidc-auth
- setup-qnx-toolchain: {}
- run:
name: Download dist artifacts and run the self-test tool
command: ferrocene/ci/scripts/run-self-test.sh
Expand Down Expand Up @@ -477,9 +480,11 @@ jobs:
FERROCENE_HOST: x86_64-pc-windows-msvc
FERROCENE_TARGETS: << pipeline.parameters.targets--x86_64-pc-windows-msvc--self-test >>
steps:
- aws-oidc-auth
- ferrocene-git-shallow-clone:
depth: 1
- aws-oidc-auth
- ferrocene-setup-windows
- setup-qnx-toolchain: {}
- run:
name: Download dist artifacts and run the self-test tool
command: ferrocene/ci/scripts/run-self-test.sh
Expand Down Expand Up @@ -783,6 +788,9 @@ commands:
llvm-subset:
type: boolean
default: true
qnx:
type: boolean
default: false
steps:
- ferrocene-checkout:
llvm-subset: << parameters.llvm-subset >>
Expand All @@ -803,7 +811,11 @@ commands:
- run:
name: Restore files from the << parameters.restore-from-job >> job
command: ferrocene/ci/scripts/persist-between-jobs.sh restore << parameters.restore-from-job >>

- when:
condition:
equal: [<<parameters.qnx>>, true]
steps:
- setup-qnx-toolchain: {}
- ferrocene-ci

ferrocene-job-test-container:
Expand Down Expand Up @@ -1009,6 +1021,19 @@ commands:
path: /tmp/metrics
destination: metrics

setup-qnx-toolchain:
description: Setup QNX Toolchain
steps:
- run:
name: Fetch QNX710 toolchain
command: aws s3 cp s3://ferrocene-ci-mirrors/manual/qnx/qnx710-deployment.tar.xz - | tar -v -x --zstd -f-
- run:
name: Set PATH to include QNX710 tools
command: echo 'source $(pwd)/qnx710/qnxsdp-env.sh' >> "$BASH_ENV"
- run:
name: Test qcc
command: qcc -v || true

aws-oidc-auth:
description: Authenticate with AWS using OIDC
steps:
Expand Down
15 changes: 15 additions & 0 deletions ferrocene/ci/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,21 @@ if [[ is_internal && "${FERROCENE_BUILD_HOST:-}" = "x86_64-pc-windows-msvc" ]];
add --set target.wasm32-unknown-unknown.ar=lld-ar
fi

if [[ is_internal ]]; then
# QNX toolchains aren't automatically inferred, set them explicitly.
#
# Assumes `qnxsdp-env.sh` has been sourced or the binaries are otherwise
# already on path
add --set target.aarch64-unknown-nto-qnx710.cc=qcc
add --set target.aarch64-unknown-nto-qnx710.cxx=q++
add --set target.aarch64-unknown-nto-qnx710.ar=ntoaarch64-ar
add --set target.aarch64-unknown-nto-qnx710.profiler=false # Build failures were noted if this is enabled.
add --set target.x86_64-pc-nto-qnx710.cc=qcc
add --set target.x86_64-pc-nto-qnx710.cxx=q++
add --set target.x86_64-pc-nto-qnx710.ar=ntox86_64-ar
add --set target.x86_64-pc-nto-qnx710.profiler=false # Build failures were noted if this is enabled.
fi

# Set the host platform to build. The environment variable is set from the CI
# configuration (see the .circleci directory).
#
Expand Down
2 changes: 2 additions & 0 deletions ferrocene/ci/docker-images/ubuntu-20/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ ENV CC_aarch64_unknown_ferrocenecoretest=aarch64-linux-gnu-gcc
ENV CXX_aarch64_unknown_ferrocenecoretest=aarch64-linux-gnu-g++
ENV CC_armv8r_none_eabihf=arm-none-eabi-gcc
ENV CXX_armv8r_none_eabihf=arm-none-eabi-g++
ENV CFLAGS_aarch64_unknown_nto_qnx710=-Vgcc_ntoaarch64le_cxx
ENV CFLAGS_x86_64_pc_nto_qnx710=-Vgcc_ntox86_64_cxx

# Automatic CFLAGs do not work for some targets.
ENV CFLAGS_armv8r_none_eabihf="-march=armv8-r -mfpu=fp-armv8"
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions ferrocene/doc/internal-procedures/src/figures/qnx.png.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SPDX-License-Identifier: MIT OR Apache-2.0
SPDX-FileCopyrightText: The Ferrocene Developers
1 change: 1 addition & 0 deletions ferrocene/doc/internal-procedures/src/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ based on software engineering best practices.
:caption: Partnerships

partners/oxidos
partners/qnx

.. appendices::
:caption: Appendices
Expand Down
Loading

0 comments on commit 8e6e08c

Please sign in to comment.