-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (87 loc) · 3.08 KB
/
Copy pathcodewith-cli.yml
File metadata and controls
99 lines (87 loc) · 3.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: codewith-cli
on:
push:
branches:
- "feat/loop-scheduled-tasks"
paths:
- "codex-rs/**"
- ".github/workflows/codewith-cli.yml"
- "scripts/codewith"
- "justfile"
pull_request:
paths:
- "codex-rs/**"
- ".github/workflows/codewith-cli.yml"
- "scripts/codewith"
- "justfile"
workflow_dispatch:
inputs:
profile:
description: "Cargo profile to build for the downloadable Codewith artifact."
type: choice
required: true
default: release
options:
- release
- debug
permissions:
contents: read
jobs:
build-linux:
name: Build Codewith Linux CLI
runs-on: ubuntu-24.04
timeout-minutes: 90
defaults:
run:
working-directory: codex-rs
env:
BUILD_PROFILE: ${{ github.event_name == 'workflow_dispatch' && inputs.profile || 'debug' }}
CARGO_INCREMENTAL: "0"
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
persist-credentials: false
- name: Install Linux build prerequisites
run: |
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
libcap-dev \
libssl-dev \
pkg-config
- uses: dtolnay/rust-toolchain@a0b273b48ed29de4470960879e8381ff45632f26 # 1.93.0
- name: Build Codewith native CLI
shell: bash
run: |
set -euo pipefail
cargo_args=(build --locked -p codex-cli --bin codewith)
if [[ "${BUILD_PROFILE}" == "release" ]]; then
# Match the canonical release workflow's resource-safe Cargo defaults.
export CARGO_BUILD_JOBS="${CARGO_BUILD_JOBS:-2}"
export CARGO_PROFILE_RELEASE_CODEGEN_UNITS="${CARGO_PROFILE_RELEASE_CODEGEN_UNITS:-16}"
cargo_args+=(--release)
fi
cargo "${cargo_args[@]}"
- name: Stage Codewith artifact
id: stage
shell: bash
run: |
set -euo pipefail
profile_dir=debug
if [[ "${BUILD_PROFILE}" == "release" ]]; then
profile_dir=release
fi
stage_dir="dist/codewith-linux-x86_64-${BUILD_PROFILE}"
archive="dist/codewith-linux-x86_64-${BUILD_PROFILE}.tar.gz"
rm -rf "${stage_dir}" "${archive}"
mkdir -p "${stage_dir}"
install -m 0755 "../scripts/codewith" "${stage_dir}/codewith"
install -m 0755 "target/${profile_dir}/codewith" "${stage_dir}/codewith-bin"
"${stage_dir}/codewith" --version
tar -C "${stage_dir}" -czf "${archive}" codewith codewith-bin
echo "archive=codex-rs/${archive}" >> "$GITHUB_OUTPUT"
- name: Upload Codewith artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: codewith-linux-x86_64-${{ env.BUILD_PROFILE }}
path: ${{ steps.stage.outputs.archive }}