Read all necessary attributes to properly get labels for CME, Iseq, and cfunc #928< 10BC0 /span>
Workflow file for this run
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
# originally copied from https://github.com/BurntSushi/ripgrep/blob/master/.github/workflows/ci.yml | |
name: ci | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
tags: | |
- v* | |
schedule: | |
- cron: '0 0 * * 0' | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
format: | |
name: Check code formatting | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@4305c38b25d97ef35a8ad1f985ccf2d2242004f2 # stable branch | |
- name: Install rustfmt | |
run: rustup component add rustfmt | |
- name: Run cargo fmt | |
run: | | |
cargo fmt --all -- --check | |
build: | |
name: Build | |
env: | |
CARGO: cargo | |
TARGET_FLAGS: --target ${{ matrix.target }} | |
RUST_BACKTRACE: full | |
timeout-minutes: 30 | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
build: | |
- linux-x86_64 | |
- linux-aarch64 | |
- macos | |
- windows | |
include: | |
- build: linux-x86_64 | |
os: ubuntu-24.04 | |
ruby-version: 3.4.6 | |
run-tests: 'true' | |
target: x86_64-unknown-linux-gnu | |
- build: linux-aarch64 | |
os: ubuntu-24.04-arm | |
ruby-version: 3.4.6 | |
run-tests: 'true' | |
target: aarch64-unknown-linux-gnu | |
- build: macos | |
os: macos-14 | |
ruby-version: 3.4.6 | |
run-tests: 'true' | |
target: x86_64-apple-darwin | |
- build: windows | |
os: windows-2022 | |
ruby-version: 3.4.5 | |
run-tests: 'true' | |
target: x86_64-pc-windows-msvc | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby-version }} | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@4305c38b25d97ef35a8ad1f985ccf2d2242004f2 # stable branch | |
- name: Install Rust toolchain target | |
run: | | |
rustup target add ${{ matrix.target }} | |
- name: Cargo Cache | |
uses: Swatinem/rust-cache@v2.7.8 | |
with: | |
cache-on-failure: "true" | |
key: "${{ matrix.os }}-${{ matrix.target }}" | |
prefix-key: "20230109" | |
- name: Show command used for Cargo | |
run: | | |
echo "cargo command is: ${{ env.CARGO }}" | |
echo "target flag is: ${{ env.TARGET_FLAGS }}" | |
- name: Build rbspy | |
run: ${{ env.CARGO }} build --release --locked --workspace --all-targets ${{ env.TARGET_FLAGS }} | |
- name: Prepare binary for upload | |
if: runner.os != 'windows' | |
run: | | |
cp target/${{ matrix.target }}/release/rbspy rbspy-${{ matrix.target }} | |
- name: Prepare binary for upload | |
if: runner.os == 'windows' | |
run: | | |
copy target/${{ matrix.target }}/release/rbspy.exe rbspy-${{ matrix.target }}.exe | |
- name: Upload Linux and macOS Binaries | |
if: runner.os != 'windows' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: rbspy-${{ matrix.target }} | |
path: rbspy-${{ matrix.target }} | |
- name: Upload Windows Binaries | |
if: runner.os == 'windows' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: rbspy-${{ matrix.target }}.exe | |
path: rbspy-${{ matrix.target }}.exe | |
- name: Run tests | |
timeout-minutes: 5 | |
run: ${{ env.CARGO }} test --release ${{ env.TARGET_FLAGS }} | |
if: runner.os == 'linux' && matrix.run-tests == 'true' | |
- name: Run tests | |
timeout-minutes: 5 | |
run: sudo "PATH=$PATH" ${{ env.CARGO }} test --release ${{ env.TARGET_FLAGS }} | |
if: runner.os == 'macOS' && matrix.run-tests == 'true' | |
- name: Run tests | |
timeout-minutes: 5 | |
run: ${{ env.CARGO }} test --release ${{ env.TARGET_FLAGS }} -- --skip core::ruby_version::tests::test_get_ruby_stack_trace | |
if: runner.os == 'windows' && matrix.run-tests == 'true' | |
- name: Run rbspy with alternative mallocs | |
if: runner.os == 'linux' && matrix.run-tests == 'true' | |
run: | | |
set -e | |
sudo apt install -y libjemalloc2 libtcmalloc-minimal4 | |
os_triple="$(echo ${{ matrix.target }} | sed 's/unknown-linux-gnu/linux-gnu/')" | |
target/${{ matrix.target }}/release/rbspy record env LD_PRELOAD=/usr/lib/$os_triple/libjemalloc.so.2 ruby ci/ruby-programs/short_program.rb | |
target/${{ matrix.target }}/release/rbspy record env LD_PRELOAD=/usr/lib/$os_triple/libtcmalloc_minimal.so.4 ruby ci/ruby-programs/short_program.rb | |
build-linux-cross: | |
name: Build | |
runs-on: ubuntu-24.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
target: | |
- aarch64-musl | |
- x86_64-musl | |
include: | |
- target: aarch64-musl | |
triple: aarch64-unknown-linux-musl | |
- target: x86_64-musl | |
triple: x86_64-unknown-linux-musl | |
container: | |
image: docker://messense/rust-musl-cross:${{ matrix.target }} | |
env: | |
RUSTUP_HOME: /root/.rustup | |
CARGO_HOME: /root/.cargo | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cargo Cache | |
uses: Swatinem/rust-cache@v2.7.8 | |
with: | |
prefix-key: "20230109" | |
- name: Build | |
run: cargo build --release --locked | |
- name: Prepare binary for upload | |
run: | | |
cp target/*/release/rbspy rbspy-${{ matrix.triple }} | |
- name: Upload Binaries | |
uses: actions/upload-artifact@v4 | |
with: | |
name: rbspy-${{ matrix.triple }} | |
path: rbspy-${{ matrix.triple }} | |
build-freebsd: | |
name: Build (FreeBSD) | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@4305c38b25d97ef35a8ad1f985ccf2d2242004f2 # stable branch | |
- uses: Swatinem/rust-cache@v2.7.8 | |
- name: Cache cross binary | |
id: cache-cross | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/cross | |
key: ${{ runner.os }}-cross-${{ hashFiles('**/Cargo.toml') }} | |
restore-keys: | | |
${{ runner.os }}-cross- | |
- name: Install cross | |
run: | | |
if [ ! -f "$HOME/.cargo/bin/cross" ]; then | |
cargo install cross --git https://github.com/cross-rs/cross --rev 51f46f296253d8122c927c5bb933e3c4f27cc317 | |
fi | |
cross --version | |
- name: Cargo Cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }} | |
restore-keys: | | |
${{ runner.os }}-cargo- | |
- name: Cross-compile rbspy | |
run: | | |
cross build --release --target x86_64-unknown-freebsd | |
cp target/x86_64-unknown-freebsd/release/rbspy rbspy | |
rm -rf target/x86_64-unknown-freebsd/release/deps/rbspy-* | |
cross test --release --no-run --target x86_64-unknown-freebsd | |
- name: Launch Firecracker VM | |
uses: acj/freebsd-firecracker-action@v0.5.0 | |
with: | |
verbose: false | |
pre-run: | | |
rm -rf .cargo | |
ln -s $HOME/.cargo .cargo | |
include_path="$(mktemp)" | |
cat <<EOF > $include_path | |
rbspy | |
target | |
target/x86_64-unknown-freebsd | |
target/x86_64-unknown-freebsd/release | |
target/x86_64-unknown-freebsd/release/rbspy | |
target/x86_64-unknown-freebsd/release/deps | |
target/x86_64-unknown-freebsd/release/deps/rbspy-* | |
ci | |
ci/ruby-programs | |
ci/ruby-programs/infinite_on_cpu.rb | |
ci/ruby-programs/infinite_off_cpu.rb | |
ci/ruby-programs/ruby_forks.rb | |
.cargo | |
.cargo/registry | |
.cargo/registry/src | |
.cargo/registry/src/index.* | |
.cargo/registry/src/index.*/rbspy-testdata-* | |
.cargo/registry/src/index.*/rbspy-testdata-*/data | |
.cargo/registry/src/index.*/rbspy-testdata-*/data/ruby-coredump-*.gz | |
EOF | |
rsync -r -e "ssh" \ | |
--relative \ | |
--copy-links \ | |
--include-from "$include_path" \ | |
--exclude "*" \ | |
. firecracker: | |
rm -f "$exclude_path" | |
run-in-vm: | | |
mkdir -p /home/runner | |
ln -s $(pwd)/.cargo /home/runner/.cargo | |
# Workaround for package mismatch warning when new releases come out | |
export IGNORE_OSVERSION=yes | |
pkg install -y ruby | |
./rbspy --version | |
skip_tests="--skip core::ruby_spy::tests --skip sampler::tests" | |
failed=0 | |
for testbin in $(find target/x86_64-unknown-freebsd/release/deps -type f -perm -u+x ! -name "*.d" -print); do | |
if ! $testbin $skip_tests; then | |
failed=1 | |
fi | |
done | |
if [ $failed -ne 0 ]; then | |
exit 1 | |
fi | |
post-run: "" | |
- name: Prepare binary for upload | |
run: | | |
mv rbspy rbspy-x86_64-unknown-freebsd | |
- name: Upload Binaries | |
uses: actions/upload-artifact@v4 | |
with: | |
name: rbspy-x86_64-unknown-freebsd | |
path: rbspy-x86_64-unknown-freebsd | |
release: | |
name: Create draft release | |
runs-on: ubuntu-24.04 | |
if: "startsWith(github.ref, 'refs/tags/')" | |
needs: [build, build-freebsd, build-linux-cross] | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
path: raw-artifacts | |
- name: Prepare binary archives | |
run: | | |
set -euo pipefail | |
mkdir staging | |
mv $(find raw-artifacts -type f | xargs) staging | |
mkdir archives | |
cd staging | |
for target in $(ls); do | |
if echo "$target" | grep -q ".exe" 2>/dev/null; then | |
echo "Found Windows binary for target $target" | |
zip -j ../archives/$target.zip $target | |
else | |
echo "Found unix binary for target $target" | |
chmod a+x $target | |
tar czf ../archives/$target.tar.gz $target | |
fi | |
done | |
- name: Calculate checksums | |
run: | | |
set -euo pipefail | |
cd archives | |
for file in *; do | |
sha256sum "$file" | awk '{print $1}' > "$file.sha256" | |
done | |
- uses: marvinpinto/action-automatic-releases@919008cf3f741b179569b7a6fb4d8860689ab7f0 # v1.1.1 | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
draft: true | |
prerelease: false | |
files: | | |
archives/* |