-
Notifications
You must be signed in to change notification settings - Fork 6.6k
[codex-rs] Add rust-release action #671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
a26f1da
no component nonsense
oai-ragona 5e229b1
fix
oai-ragona 8d8024d
fix name
oai-ragona 5380288
test
oai-ragona 6d33a66
test
oai-ragona c4ba960
test
oai-ragona 62b0639
remove clippy flags
oai-ragona e4339db
fix
oai-ragona ba6c2e5
fail fast
oai-ragona a8f1d53
target bins
oai-ragona e24fe6a
stage artifacts
oai-ragona 57634e9
cargo-release prefix
oai-ragona 011bf6f
prettier
oai-ragona 1b367bb
cancel in progress
oai-ragona 43dfdfb
fix typo
oai-ragona e771d5a
prettier
oai-ragona 37bad9d
arm
oai-ragona 3241df4
test
oai-ragona 47f6bf1
test
oai-ragona de54bbf
include libssl-dev
oai-ragona eabd317
glob
oai-ragona cb3ee4a
debugging
oai-ragona b13e57e
one artifact per line
oai-ragona 56addbc
try static ssl on musl build
oai-ragona 8ae8a64
fix path
oai-ragona 4f499a4
vendor ssl for arm
oai-ragona c7430ff
musl fix
oai-ragona 6f25cf2
prettier
oai-ragona a84ce3d
drop arm musl
oai-ragona 4b39f8a
testing
oai-ragona c7ee0e7
test draft release
oai-ragona 7b48dcb
prettier
oai-ragona 680c1e3
remove unrelated musl ssl change
oai-ragona 2f5bb5b
name artifacts
oai-ragona d8a11df
dotslash step
oai-ragona 8f549cf
token
oai-ragona 3b91488
specify format for dotfile config
oai-ragona 2e2ef86
use dotslash v2 action
oai-ragona 1ab95aa
compress
oai-ragona f205330
deconflict release tag in testing
oai-ragona 4bd0217
remove workflow dispatch, add explicit tag guard
oai-ragona 7ffe534
enforce cargo toml match
oai-ragona 3a68777
version in top level Cargo.toml
oai-ragona 27dc44b
comment on draft/prerelease
oai-ragona 0c0887a
comment
oai-ragona 64e99cc
prettier
oai-ragona 0068c8b
workspace versioning
oai-ragona 54ec982
lto fat, update included bins
oai-ragona File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| { | ||
| "outputs": { | ||
| "codex-repl": { | ||
| "platforms": { | ||
| "macos-aarch64": { "regex": "^codex-repl-aarch64-apple-darwin\\.zst$", "path": "codex-repl" }, | ||
| "macos-x86_64": { "regex": "^codex-repl-x86_64-apple-darwin\\.zst$", "path": "codex-repl" }, | ||
| "linux-x86_64": { "regex": "^codex-repl-x86_64-unknown-linux-musl\\.zst$", "path": "codex-repl" }, | ||
| "linux-aarch64": { "regex": "^codex-repl-aarch64-unknown-linux-gnu\\.zst$", "path": "codex-repl" } | ||
| } | ||
| }, | ||
|
|
||
| "codex-exec": { | ||
| "platforms": { | ||
| "macos-aarch64": { "regex": "^codex-exec-aarch64-apple-darwin\\.zst$", "path": "codex-exec" }, | ||
| "macos-x86_64": { "regex": "^codex-exec-x86_64-apple-darwin\\.zst$", "path": "codex-exec" }, | ||
| "linux-x86_64": { "regex": "^codex-exec-x86_64-unknown-linux-musl\\.zst$", "path": "codex-exec" }, | ||
| "linux-aarch64": { "regex": "^codex-exec-aarch64-unknown-linux-gnu\\.zst$", "path": "codex-exec" } | ||
| } | ||
| }, | ||
|
|
||
| "codex-cli": { | ||
| "platforms": { | ||
| "macos-aarch64": { "regex": "^codex-cli-aarch64-apple-darwin\\.zst$", "path": "codex-cli" }, | ||
| "macos-x86_64": { "regex": "^codex-cli-x86_64-apple-darwin\\.zst$", "path": "codex-cli" }, | ||
| "linux-x86_64": { "regex": "^codex-cli-x86_64-unknown-linux-musl\\.zst$", "path": "codex-cli" }, | ||
| "linux-aarch64": { "regex": "^codex-cli-aarch64-unknown-linux-gnu\\.zst$", "path": "codex-cli" } | ||
| } | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,146 @@ | ||
| # Release workflow for codex-rs. | ||
| # To release, follow a workflow like: | ||
| # ``` | ||
| # git tag -a rust-v0.1.0 -m "Release 0.1.0" | ||
| # git push origin rust-v0.1.0 | ||
| # ``` | ||
|
|
||
| name: rust-release | ||
| on: | ||
| push: | ||
| tags: | ||
| - "rust-v.*.*.*" | ||
wpt-oai marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }} | ||
| cancel-in-progress: true | ||
|
|
||
| env: | ||
| TAG_REGEX: '^rust-v\.[0-9]+\.[0-9]+\.[0-9]+$' | ||
|
|
||
| jobs: | ||
| tag-check: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Validate tag matches Cargo.toml version | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
| echo "::group::Tag validation" | ||
|
|
||
| # 1. Must be a tag and match the regex | ||
| [[ "${GITHUB_REF_TYPE}" == "tag" ]] \ | ||
| || { echo "❌ Not a tag push"; exit 1; } | ||
| [[ "${GITHUB_REF_NAME}" =~ ${TAG_REGEX} ]] \ | ||
| || { echo "❌ Tag '${GITHUB_REF_NAME}' != ${TAG_REGEX}"; exit 1; } | ||
|
|
||
| # 2. Extract versions | ||
| tag_ver="${GITHUB_REF_NAME#rust-v.}" | ||
| cargo_ver="$(grep -m1 '^version' codex-rs/Cargo.toml \ | ||
| | sed -E 's/version *= *"([^"]+)".*/\1/')" | ||
|
|
||
| # 3. Compare | ||
| [[ "${tag_ver}" == "${cargo_ver}" ]] \ | ||
| || { echo "❌ Tag ${tag_ver} ≠ Cargo.toml ${cargo_ver}"; exit 1; } | ||
|
|
||
| echo "✅ Tag and Cargo.toml agree (${tag_ver})" | ||
| echo "::endgroup::" | ||
|
|
||
| build: | ||
| needs: tag-check | ||
| name: ${{ matrix.runner }} - ${{ matrix.target }} | ||
| runs-on: ${{ matrix.runner }} | ||
| timeout-minutes: 30 | ||
| defaults: | ||
| run: | ||
| working-directory: codex-rs | ||
|
|
||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - runner: macos-14 | ||
| target: aarch64-apple-darwin | ||
| - runner: macos-14 | ||
| target: x86_64-apple-darwin | ||
| - runner: ubuntu-24.04 | ||
| target: x86_64-unknown-linux-musl | ||
| - runner: ubuntu-24.04 | ||
| target: x86_64-unknown-linux-gnu | ||
| - runner: ubuntu-24.04-arm | ||
oai-ragona marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| target: aarch64-unknown-linux-gnu | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| targets: ${{ matrix.target }} | ||
|
|
||
| - uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.cargo/bin/ | ||
| ~/.cargo/registry/index/ | ||
| ~/.cargo/registry/cache/ | ||
| ~/.cargo/git/db/ | ||
| ${{ github.workspace }}/codex-rs/target/ | ||
| key: cargo-release-${{ matrix.runner }}-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }} | ||
|
|
||
| - if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }} | ||
oai-ragona marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| name: Install musl build tools | ||
| run: | | ||
| sudo apt install -y musl-tools pkg-config | ||
|
|
||
| - name: Cargo build | ||
| run: cargo build --target ${{ matrix.target }} --release --all-targets --all-features | ||
|
|
||
| - name: Stage artifacts | ||
| shell: bash | ||
| run: | | ||
| dest="dist/${{ matrix.target }}" | ||
| mkdir -p "$dest" | ||
|
|
||
| cp target/${{ matrix.target }}/release/codex-repl "$dest/codex-repl-${{ matrix.target }}" | ||
| cp target/${{ matrix.target }}/release/codex-exec "$dest/codex-exec-${{ matrix.target }}" | ||
| cp target/${{ matrix.target }}/release/codex-cli "$dest/codex-cli-${{ matrix.target }}" | ||
|
|
||
| zstd -T0 -19 --rm "$dest"/* | ||
|
|
||
| - uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: ${{ matrix.target }} | ||
| path: codex-rs/dist/${{ matrix.target }}/* | ||
|
|
||
| release: | ||
| needs: build | ||
| name: release | ||
| runs-on: ubuntu-24.04 | ||
| env: | ||
| RELEASE_TAG: codex-rs-${{ github.sha }}-${{ github.run_attempt }}-${{ github.ref_name }} | ||
|
|
||
| steps: | ||
| - uses: actions/download-artifact@v4 | ||
| with: | ||
| path: dist | ||
|
|
||
| - name: List | ||
| run: ls -R dist/ | ||
|
|
||
| - uses: softprops/action-gh-release@v2 | ||
| with: | ||
| tag_name: ${{ env.RELEASE_TAG }} | ||
| files: dist/** | ||
| # TODO(ragona): I'm going to leave these as prerelease/draft for now. | ||
| # It gives us 1) clarity that these are not yet a stable version, and | ||
| # 2) allows a human step to review the release before publishing the draft. | ||
| prerelease: true | ||
| draft: true | ||
|
|
||
| - uses: facebook/dotslash-publish-release@v2 | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| with: | ||
| tag: ${{ env.RELEASE_TAG }} | ||
| config: .github/dotslash-config.json | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| [package] | ||
| name = "codex-cli" | ||
| version = "0.1.0" | ||
| version = { workspace = true } | ||
| edition = "2021" | ||
|
|
||
| [[bin]] | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| [package] | ||
| name = "codex-exec" | ||
| version = "0.1.0" | ||
| version = { workspace = true } | ||
| edition = "2021" | ||
|
|
||
| [[bin]] | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| [package] | ||
| name = "codex-repl" | ||
| version = "0.1.0" | ||
| version = { workspace = true } | ||
| edition = "2021" | ||
|
|
||
| [[bin]] | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.