Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

Pass CI workflow inputs through environment variables (#39717)

William Woodruff2c74b56fcde8
diff --git a/.github/actions/setup-msvc-env/action.yml b/.github/actions/setup-msvc-env/action.yml
index 287cb7f217..ab987a052b 100644
--- a/.github/actions/setup-msvc-env/action.yml
+++ b/.github/actions/setup-msvc-env/action.yml
@@ -14,4 +14,7 @@ runs:
steps:
- name: Expose MSVC SDK environment
shell: pwsh
- run: '& "$env:GITHUB_ACTION_PATH/setup-msvc-env.ps1" -Target "${{ inputs.target }}" -HostArch "${{ inputs.host-arch }}"'
+ env:
+ HOST_ARCH: ${{ inputs.host-arch }}
+ TARGET: ${{ inputs.target }}
+ run: '& "$env:GITHUB_ACTION_PATH/setup-msvc-env.ps1" -Target "$env:TARGET" -HostArch "$env:HOST_ARCH"'
diff --git a/.github/workflows/rust-ci-full-nextest-platform.yml b/.github/workflows/rust-ci-full-nextest-platform.yml
index e86bc0bb99..8799f1ea03 100644
--- a/.github/workflows/rust-ci-full-nextest-platform.yml
+++ b/.github/workflows/rust-ci-full-nextest-platform.yml
@@ -62,6 +62,8 @@ jobs:
# so the cross-compile build reuses the Windows x64 cache lineage.
ARCHIVE_CACHE_RUNNER: ${{ inputs.archive_runner != '' && inputs.archive_runner || inputs.runner }}
USE_SCCACHE: ${{ inputs.use_sccache && 'true' || 'false' }}
+ CODEX_CI_PROFILE: ${{ inputs.profile }}
+ CODEX_CI_TARGET: ${{ inputs.target }}
CARGO_INCREMENTAL: "0"
SCCACHE_CACHE_SIZE: 10G
NEXTEST_ARCHIVE_FILE: nextest-${{ inputs.artifact_id }}.tar.zst
@@ -170,8 +172,8 @@ jobs:
archive_dir="${RUNNER_TEMP}/nextest-archive"
mkdir -p "${archive_dir}"
cargo nextest archive \
- --target ${{ inputs.target }} \
- --cargo-profile ${{ inputs.profile }} \
+ --target "${CODEX_CI_TARGET}" \
+ --cargo-profile "${CODEX_CI_PROFILE}" \
--timings \
--archive-file "${archive_dir}/${NEXTEST_ARCHIVE_FILE}"
@@ -185,20 +187,20 @@ jobs:
if [[ "${RUNNER_OS}" == "Linux" ]]; then
cargo build \
- --target ${{ inputs.target }} \
- --profile ${{ inputs.profile }} \
+ --target "${CODEX_CI_TARGET}" \
+ --profile "${CODEX_CI_PROFILE}" \
-p codex-linux-sandbox \
--bin codex-linux-sandbox
- cp "${CARGO_TARGET_DIR}/${{ inputs.target }}/${{ inputs.profile }}/codex-linux-sandbox" "${helper_dir}/"
+ cp "${CARGO_TARGET_DIR}/${CODEX_CI_TARGET}/${CODEX_CI_PROFILE}/codex-linux-sandbox" "${helper_dir}/"
else
cargo build \
- --target ${{ inputs.target }} \
- --profile ${{ inputs.profile }} \
+ --target "${CODEX_CI_TARGET}" \
+ --profile "${CODEX_CI_PROFILE}" \
-p codex-windows-sandbox \
--bin codex-windows-sandbox-setup \
--bin codex-command-runner
- cp "${CARGO_TARGET_DIR}/${{ inputs.target }}/${{ inputs.profile }}/codex-windows-sandbox-setup.exe" "${helper_dir}/"
- cp "${CARGO_TARGET_DIR}/${{ inputs.target }}/${{ inputs.profile }}/codex-command-runner.exe" "${helper_dir}/"
+ cp "${CARGO_TARGET_DIR}/${CODEX_CI_TARGET}/${CODEX_CI_PROFILE}/codex-windows-sandbox-setup.exe" "${helper_dir}/"
+ cp "${CARGO_TARGET_DIR}/${CODEX_CI_TARGET}/${CODEX_CI_PROFILE}/codex-command-runner.exe" "${helper_dir}/"
fi
- name: Upload Cargo timings (nextest)
@@ -256,7 +258,7 @@ jobs:
shell: bash
run: |
{
- echo "### sccache stats — ${{ inputs.target }} (tests)";
+ echo "### sccache stats — ${CODEX_CI_TARGET} (tests)";
echo;
echo '```';
sccache --show-stats || true;
@@ -272,6 +274,9 @@ jobs:
run:
working-directory: codex-rs
env:
+ CODEX_CI_PROFILE: ${{ inputs.profile }}
+ CODEX_CI_TARGET: ${{ inputs.target }}
+ CODEX_CI_TEST_THREADS: ${{ inputs.test_threads }}
NEXTEST_ARCHIVE_FILE: nextest-${{ inputs.artifact_id }}.tar.zst
TEST_HELPERS_ARTIFACT: nextest-test-helpers-${{ inputs.artifact_id }}
strategy:
@@ -344,13 +349,13 @@ jobs:
if [[ "${RUNNER_OS}" == "Linux" ]]; then
helper_dir="${RUNNER_TEMP}/${TEST_HELPERS_ARTIFACT}"
- helper_target_dir="${CARGO_TARGET_DIR}/${{ inputs.target }}/${{ inputs.profile }}"
+ helper_target_dir="${CARGO_TARGET_DIR}/${CODEX_CI_TARGET}/${CODEX_CI_PROFILE}"
mkdir -p "${helper_target_dir}"
cp "${helper_dir}/codex-linux-sandbox" "${helper_target_dir}/"
chmod +x "${helper_target_dir}/codex-linux-sandbox"
elif [[ "${RUNNER_OS}" == "Windows" ]]; then
helper_dir="${RUNNER_TEMP}/${TEST_HELPERS_ARTIFACT}"
- helper_target_dir="${CARGO_TARGET_DIR}/${{ inputs.target }}/${{ inputs.profile }}"
+ helper_target_dir="${CARGO_TARGET_DIR}/${CODEX_CI_TARGET}/${CODEX_CI_PROFILE}"
mkdir -p "${helper_target_dir}"
cp "${helper_dir}/codex-windows-sandbox-setup.exe" "${helper_target_dir}/"
cp "${helper_dir}/codex-command-runner.exe" "${helper_target_dir}/"
@@ -363,8 +368,8 @@ jobs:
--workspace-remap "${workspace_root}"
--partition "hash:${{ matrix.shard }}/4"
)
- if [[ "${{ inputs.test_threads }}" != "0" ]]; then
- nextest_args+=(--test-threads "${{ inputs.test_threads }}")
+ if [[ "${CODEX_CI_TEST_THREADS}" != "0" ]]; then
+ nextest_args+=(--test-threads "${CODEX_CI_TEST_THREADS}")
fi
test_command=(cargo nextest "${nextest_args[@]}")