tools/trace-parser: Add Rust trace.dat parser #746
Workflow file for this run
This file contains 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
name: autobranch | |
on: | |
# Whenever a pull request is labeled or unlabeled. | |
pull_request_target: | |
types: [labeled, unlabeled, synchronize] | |
# To be able to manually trigger the job from GitHub UI | |
workflow_dispatch: | |
# Run the workflow when the base branch is updated. | |
# | |
# Note that a push from a workflow will by default not trigger a push event: | |
# https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow | |
push: | |
branches: | |
- 'main' | |
permissions: | |
# Necessary to be able to push to the repo | |
contents: write | |
jobs: | |
autobranch: | |
name: autobranch | |
# Ensure jobs queue in order, so that we don't get race conditions while | |
# pushing the branch | |
concurrency: autobranch | |
# Set the type of machine to run on | |
# https://github.com/actions/virtual-environments | |
runs-on: ubuntu-latest | |
if: | | |
( | |
github.event_name == 'pull_request_target' && | |
( | |
( | |
github.event.action == 'synchronize' && | |
contains(github.event.pull_request.labels.*.name, 'autobranch') | |
) || | |
( | |
( | |
github.event.action == 'labeled' || | |
github.event.action == 'unlabeled' | |
) && | |
github.event.label.name == 'autobranch' | |
) | |
) | |
) || | |
github.event_name != 'pull_request_target' | |
steps: | |
# Checks out a copy of your repository on the virtual machine | |
- uses: actions/checkout@v3 | |
with: | |
# Ensure the tools we run come from trusted source. We don't need to | |
# get the current PR as it will be fetched by batch-rebase directly | |
# anyway. | |
repository: ARM-software/lisa | |
path: origin-repo | |
ref: main | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Setup git | |
run: | | |
cd origin-repo && | |
git config --global user.name 'GitHub Action' | |
git config --global user.email 'GitHub Action' | |
git remote -v | |
git branch --list --remotes | |
- name: Create autobranch branches | |
run: | | |
set -e | |
cd origin-repo && | |
export LC_ALL=C | |
source init_env && | |
function update_branch() { | |
local label=$1 | |
local branch=$2 | |
local force_branch=$3 | |
local worktree=../${branch}-repo | |
local patch=${branch}-update.patch | |
lisa-combine-pr --repo 'ARM-Software/lisa' --pr-label "$label" --branch "$force_branch" && | |
git fetch origin "$branch" && | |
# Work in a separate worktree so that there is no risk of folders | |
# added to PATH by init_env being manipulated | |
git worktree add "$worktree" --checkout "$branch" && | |
git -C "$worktree" diff --binary "HEAD..$force_branch" > "$patch" && | |
if [[ -s "$patch" ]]; then | |
# Apply the patch to the index as well, so that any file created | |
# is automatically added to the commit we are about to create. | |
git -C "$worktree" apply --index "../origin-repo/$patch" && | |
git -C "$worktree" commit --all -m "Autocommit to $branch branch on $(date) tracking $force_branch" | |
git push --force origin "$force_branch" | |
git push origin "$branch" | |
else | |
echo "Empty patch, $branch and $force_branch branches are up to date." | |
fi | |
} | |
ret=0 | |
function keepgoing { | |
"$@" || ret=1 | |
} | |
keepgoing update_branch for-master-autobranch master master-force | |
keepgoing update_branch for-preview-autobranch preview preview-force | |
exit $ret |