add cu log steps
This commit is contained in:
parent
3295c03d45
commit
00fb4144f6
|
@ -16,10 +16,11 @@ defaults:
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
name: Lint
|
name: Lint
|
||||||
|
if: github.actor != 'github-actions[bot]'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
- name: Install Rust nightly
|
- name: Install Rust nightly
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
|
@ -29,19 +30,18 @@ jobs:
|
||||||
components: rustfmt, clippy
|
components: rustfmt, clippy
|
||||||
- name: Cache dependencies
|
- name: Cache dependencies
|
||||||
uses: Swatinem/rust-cache@v1
|
uses: Swatinem/rust-cache@v1
|
||||||
|
|
||||||
- name: Run fmt
|
- name: Run fmt
|
||||||
run: cargo fmt -- --check
|
run: cargo fmt -- --check
|
||||||
# The style and complexity lints have not been processed yet.
|
|
||||||
- name: Run clippy
|
- name: Run clippy
|
||||||
run: cargo clippy -- --deny=warnings --allow=clippy::style --allow=clippy::complexity
|
run: cargo clippy -- --deny=warnings --allow=clippy::style --allow=clippy::complexity
|
||||||
|
|
||||||
tests:
|
tests:
|
||||||
name: Test
|
name: Test
|
||||||
|
if: github.actor != 'github-actions[bot]'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
- name: Install Linux dependencies
|
- name: Install Linux dependencies
|
||||||
run: sudo apt-get update && sudo apt-get install -y pkg-config build-essential libudev-dev
|
run: sudo apt-get update && sudo apt-get install -y pkg-config build-essential libudev-dev
|
||||||
- name: Install Rust nightly
|
- name: Install Rust nightly
|
||||||
|
@ -52,8 +52,6 @@ jobs:
|
||||||
toolchain: ${{ env.RUST_TOOLCHAIN }}
|
toolchain: ${{ env.RUST_TOOLCHAIN }}
|
||||||
- name: Cache dependencies
|
- name: Cache dependencies
|
||||||
uses: Swatinem/rust-cache@v1
|
uses: Swatinem/rust-cache@v1
|
||||||
|
|
||||||
# Install Solana
|
|
||||||
- name: Cache Solana binaries
|
- name: Cache Solana binaries
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
|
@ -69,5 +67,73 @@ jobs:
|
||||||
solana-keygen new -o "$HOME/.config/solana/id.json" --no-passphrase --silent
|
solana-keygen new -o "$HOME/.config/solana/id.json" --no-passphrase --silent
|
||||||
- name: Build all deps
|
- name: Build all deps
|
||||||
run: cargo build-bpf
|
run: cargo build-bpf
|
||||||
- name: Run bpf tests
|
# Run bpf tests and output to runner and log
|
||||||
run: cargo test-bpf
|
- name: Run tests
|
||||||
|
run: cargo test-bpf 2> >(tee raw-test-bpf.log >&2)
|
||||||
|
- name: Save raw log
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: raw-test-bpf
|
||||||
|
path: raw-test-bpf.log
|
||||||
|
# Download logs and process them
|
||||||
|
process-logs:
|
||||||
|
name: Process logs
|
||||||
|
if: |
|
||||||
|
(github.actor != 'github-actions[bot]' && github.ref_name =='main') ||
|
||||||
|
(github.actor != 'github-actions[bot]' &&github.ref_name=='dev')
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [lint, tests]
|
||||||
|
steps:
|
||||||
|
- name: Download raw log
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: raw-test-bpf
|
||||||
|
- name: Install deps
|
||||||
|
run: |
|
||||||
|
sudo apt-get install ripgrep
|
||||||
|
curl -Lo xsv.tar.gz "https://github.com/BurntSushi/xsv/releases/latest/download/xsv-0.13.0-x86_64-unknown-linux-musl.tar.gz"
|
||||||
|
sudo tar xf xsv.tar.gz -C /usr/local/bin
|
||||||
|
- name: Setup date input
|
||||||
|
id: date
|
||||||
|
run: echo "::set-output name=today::$(date +'%Y-%m-%d')"
|
||||||
|
- name: Process raw log
|
||||||
|
run: |
|
||||||
|
rg -oNI "(Mango:|Instruction: |Program ${{ env.LOG_PROGRAM }} consumed).*$" raw-test-bpf.log \
|
||||||
|
| rg -U 'Mango: .*\nProgram ${{ env.LOG_PROGRAM }}.*' \
|
||||||
|
| awk 'NR % 2 == 1 { o=$0 ; next } { print o " " $0 }' \
|
||||||
|
| sort | uniq -u | sort > cu-per-ix.log
|
||||||
|
- name: Clean up log
|
||||||
|
run: |
|
||||||
|
rg -N 'Mango: (\w+) .* consumed (\d+) .*' cu-per-ix.log -r '${{ steps.date.outputs.today }},${{ github.repository }},$1,$2' \
|
||||||
|
| uniq | xsv sort -s 3 -N -R \
|
||||||
|
| sort -t ',' -k 3,4 -u \
|
||||||
|
| sort > cu-per-ix-clean.log
|
||||||
|
- name: Save clean log
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: cu-per-ix-clean
|
||||||
|
path: cu-per-ix-clean.log
|
||||||
|
# Push clean logs to git
|
||||||
|
push-logs:
|
||||||
|
name: Push logs
|
||||||
|
if: |
|
||||||
|
(github.actor != 'github-actions[bot]' && github.ref_name =='main') ||
|
||||||
|
(github.actor != 'github-actions[bot]' &&github.ref_name=='dev')
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [lint, tests, process-logs]
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Download clean log
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: cu-per-ix-clean
|
||||||
|
path: cu-stats/
|
||||||
|
- name: Push log to git
|
||||||
|
run: |
|
||||||
|
git config --global user.name "github-actions[bot]"
|
||||||
|
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||||
|
git add -A
|
||||||
|
git commit -m "chore: push cu test logs"
|
||||||
|
git push
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue