Publish sctrace in workflows
This commit is contained in:
parent
f3fb82c6f1
commit
02abae8d61
|
|
@ -0,0 +1,34 @@
|
|||
name: Publish sctrace
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
paths:
|
||||
- VERSION
|
||||
- tools/sctrace/**
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- VERSION
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
container: asterinas/asterinas:0.16.1-20250922
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Publish sctrace (dry run)
|
||||
# On pull request, set `--dry-run` to check whether they can be published
|
||||
if: github.event_name == 'pull_request'
|
||||
run: |
|
||||
./tools/github_workflows/publish_sctrace.sh --dry-run
|
||||
|
||||
- name: Publish sctrace
|
||||
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
|
||||
env:
|
||||
REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
||||
run: |
|
||||
./tools/github_workflows/publish_sctrace.sh --token ${REGISTRY_TOKEN}
|
||||
|
|
@ -157,6 +157,7 @@ update_project_dependencies() {
|
|||
update_package_version ${OSDK_TEST_RUNNER_CARGO_TOML_PATH}
|
||||
update_package_version ${OSDK_FRAME_ALLOCATOR_CARGO_TOML_PATH}
|
||||
update_package_version ${OSDK_HEAP_ALLOCATOR_CARGO_TOML_PATH}
|
||||
update_package_version ${SCTRACE_CARGO_TOML_PATH}
|
||||
|
||||
update_dep_version ${OSDK_TEST_RUNNER_CARGO_TOML_PATH} ostd
|
||||
update_dep_version ${OSDK_FRAME_ALLOCATOR_CARGO_TOML_PATH} ostd
|
||||
|
|
@ -225,6 +226,7 @@ OSDK_CARGO_TOML_PATH=${OSDK_DIR}/Cargo.toml
|
|||
OSDK_TEST_RUNNER_CARGO_TOML_PATH=${ASTER_SRC_DIR}/osdk/deps/test-kernel/Cargo.toml
|
||||
OSDK_FRAME_ALLOCATOR_CARGO_TOML_PATH=${ASTER_SRC_DIR}/osdk/deps/frame-allocator/Cargo.toml
|
||||
OSDK_HEAP_ALLOCATOR_CARGO_TOML_PATH=${ASTER_SRC_DIR}/osdk/deps/heap-allocator/Cargo.toml
|
||||
SCTRACE_CARGO_TOML_PATH=${ASTER_SRC_DIR}/tools/sctrace/Cargo.toml
|
||||
VERSION_PATH=${ASTER_SRC_DIR}/VERSION
|
||||
DOCKER_IMAGE_VERSION_PATH=${ASTER_SRC_DIR}/DOCKER_IMAGE_VERSION
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,63 @@
|
|||
#!/bin/bash
|
||||
|
||||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
set -e
|
||||
|
||||
# Publish sctrace to crates.io
|
||||
#
|
||||
# Usage: publish_sctrace.sh [--dry-run | --token REGISTRY_TOKEN]
|
||||
|
||||
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
ASTER_SRC_DIR=${SCRIPT_DIR}/../..
|
||||
|
||||
# Print help message
|
||||
print_help() {
|
||||
echo "Usage: $0 [--dry-run | --token REGISTRY_TOKEN]"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " --dry-run: Execute the publish check without actually publishing it."
|
||||
echo " --token REGISTRY_TOKEN: The token to authenticate with crates.io."
|
||||
}
|
||||
|
||||
# Parse the parameters
|
||||
DRY_RUN=""
|
||||
TOKEN=""
|
||||
while [ "$#" -gt 0 ]; do
|
||||
case "$1" in
|
||||
--dry-run)
|
||||
DRY_RUN="true"
|
||||
shift
|
||||
;;
|
||||
--token)
|
||||
TOKEN="$2"
|
||||
shift 2
|
||||
;;
|
||||
*)
|
||||
echo "Error: Invalid parameter: $1"
|
||||
print_help
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Performs the publish check or publish the crate in directory $1.
|
||||
# All the arguments after $1 are passed to `cargo publish`.
|
||||
do_publish_for() {
|
||||
pushd $ASTER_SRC_DIR/$1
|
||||
|
||||
ADDITIONAL_ARGS="${@:2}"
|
||||
RF="$RUSTFLAGS --check-cfg cfg(ktest)"
|
||||
|
||||
if [ -n "$DRY_RUN" ]; then
|
||||
# Perform checks
|
||||
RUSTFLAGS=$RF cargo publish --dry-run --allow-dirty $ADDITIONAL_ARGS
|
||||
RUSTFLAGS=$RF cargo doc $ADDITIONAL_ARGS
|
||||
else
|
||||
RUSTFLAGS=$RF cargo publish --token $TOKEN $ADDITIONAL_ARGS
|
||||
fi
|
||||
|
||||
popd
|
||||
}
|
||||
|
||||
do_publish_for tools/sctrace
|
||||
Loading…
Reference in New Issue