diff --git a/.github/workflows/auto-rebase-with-github-token.yaml b/.github/workflows/auto-rebase-with-github-token.yaml new file mode 100644 index 000000000..baf2f50e4 --- /dev/null +++ b/.github/workflows/auto-rebase-with-github-token.yaml @@ -0,0 +1,71 @@ +name: Auto Rebase wuth Github Token + +on: + push: + branches: + - dev + workflow_dispatch: + +jobs: + rebase: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + persist-credentials: false + token: ${{ secrets.GITHUB_TOKEN }} # Usa il token predefinito di GitHub + fetch-depth: 0 # Fetch completo per avere tutta la cronologia + + - name: Fetch open pull requests + run: | + gh auth setup-git + gh pr list --state open --json number,headRepositoryOwner,headRefName --jq '.[] | "\(.number) \(.headRepositoryOwner.login) \(.headRefName)"' > pr_details.txt + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Usa il token predefinito di GitHub + + - name: Rebase pull requests + run: | + while read pr_number pr_owner pr_branch; do + echo "Processing PR #$pr_number" + + # Add the contributor's fork as a remote + git remote add contributor https://github.com/$pr_owner/$(gh repo view --json name -q '.name').git + + # Fetch the contributor's branches + git fetch contributor + + # Checkout the branch from the contributor's fork + git checkout -b contributor-branch contributor/$pr_branch + + # Set the committer name and email to match the PR author + PR_AUTHOR_NAME=$(gh pr view $pr_number --json author --jq '.author.login') + PR_AUTHOR_EMAIL="${PR_AUTHOR_NAME}@users.noreply.github.com" + + git config user.name "$PR_AUTHOR_NAME" + git config user.email "$PR_AUTHOR_EMAIL" + + # Rebase the branch on top of the main branch + git fetch origin main + git rebase origin/main || { + echo "Conflict detected. Aborting rebase and continuing." + git rebase --abort + continue + } + + # Push the rebased branch back to the contributor's fork + git push --force-with-lease contributor contributor-branch:$pr_branch + + # Remove the remote + git remote remove contributor + + # Restart the check suite for the pull request + PR_HEAD_SHA=$(gh pr view $pr_number --json headRefOid --jq '.headRefOid') + curl -X POST \ + -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + https://api.github.com/repos/${{ github.repository }}/check-suites/$PR_HEAD_SHA/rerequest + done < pr_details.txt + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Usa il token predefinito di GitHub diff --git a/.github/workflows/auto-rebase.yaml b/.github/workflows/auto-rebase.yaml new file mode 100644 index 000000000..36786f2c4 --- /dev/null +++ b/.github/workflows/auto-rebase.yaml @@ -0,0 +1,74 @@ +name: Auto Rebase + +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + rebase: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + persist-credentials: false + token: ${{ secrets.GITGAB_SRI_PERSONAL_TOKEN }} # Use GitHub's default token + fetch-depth: 0 # Fetch full history to have the entire commit history + + - name: Fetch open pull requests with label + run: | + gh auth setup-git + gh pr list --state open --label "ready-to-be-merged" --json number,headRepositoryOwner,headRefName --jq '.[] | "\(.number) \(.headRepositoryOwner.login) \(.headRefName)"' > pr_details.txt + env: + GITHUB_TOKEN: ${{ secrets.GITGAB_SRI_PERSONAL_TOKEN }} # Use GitHub's default token + + - name: Rebase pull requests + run: | + while read pr_number pr_owner pr_branch; do + echo "Processing PR #$pr_number" + + # Add the contributor's fork as a remote + git remote add contributor https://github.com/$pr_owner/$(gh repo view --json name -q '.name').git + + # Fetch the contributor's branches + git fetch contributor + + # Create a unique branch name for this PR + unique_branch_name="contributor-branch-$pr_number" + + # Checkout the branch from the contributor's fork + git checkout -b $unique_branch_name contributor/$pr_branch + + # Set the committer name and email to match the PR author + PR_AUTHOR_NAME=$(gh pr view $pr_number --json author --jq '.author.login') + PR_AUTHOR_EMAIL="${PR_AUTHOR_NAME}@users.noreply.github.com" + + git config user.name "$PR_AUTHOR_NAME" + git config user.email "$PR_AUTHOR_EMAIL" + + # Rebase the branch on top of the main branch + git fetch origin main + git rebase origin/main || { + echo "Conflict detected. Aborting rebase and continuing." + git rebase --abort + continue + } + + # Push the rebased branch back to the contributor's fork + git push --force-with-lease contributor $unique_branch_name:$pr_branch + + # Remove the remote + git remote remove contributor + + # Ensure we are not on the branch to be deleted + git checkout main + + # Delete the local unique branch + git branch -D $unique_branch_name + + done < pr_details.txt + env: + GITHUB_TOKEN: ${{ secrets.GITGAB_SRI_PERSONAL_TOKEN }} # Use GitHub's default token diff --git a/.github/workflows/auto-update-pr.yaml b/.github/workflows/auto-update-pr.yaml new file mode 100644 index 000000000..6486563de --- /dev/null +++ b/.github/workflows/auto-update-pr.yaml @@ -0,0 +1,67 @@ +name: Auto Update Approved PRs with Conflict Handling + +on: + push: + branches: + - main # Sostituisci con il tuo branch base se diverso + workflow_dispatch: + +jobs: + update-pr: + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 # Necessario per operazioni di rebase + + - name: Install GitHub CLI + uses: cli/cli-action@v2 + + - name: Fetch All Branches + run: git fetch --all + + - name: Get List of Open PRs + id: get_open_prs + run: | + gh pr list --state open --json number,headRefName,baseRefName,isDraft,mergeable --jq '.[] | select(.baseRefName == "main" and .mergeable == "MERGEABLE") | .number' > pr_numbers.txt + + - name: Check PR Reviews and Handle Conflicts + id: check_pr_reviews_and_conflicts + run: | + for pr in $(cat pr_numbers.txt); do + reviews=$(gh pr view $pr --json reviews --jq '.reviews[] | select(.state == "APPROVED")') + if [ -n "$reviews" ]; then + echo "PR #$pr has approved reviews." + + # Check for conflicts during rebase + branch_name=$(gh pr view $pr --json headRefName --jq '.headRefName') + git checkout $branch_name + git fetch origin + git rebase origin/main + if [ $? -eq 0 ]; then + echo "PR #$pr rebase successful." + echo $pr >> approved_pr_numbers.txt + else + echo "PR #$pr has conflicts. Skipping rebase." + fi + else + echo "PR #$pr does not have approved reviews." + fi + done + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Rebase Approved PRs on Main + if: fileExists('approved_pr_numbers.txt') + run: | + while read -r pr; do + echo "Updating PR #$pr..." + branch_name=$(gh pr view $pr --json headRefName --jq '.headRefName') + git checkout $branch_name + git rebase origin/main + git push --force-with-lease + done < approved_pr_numbers.txt + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/autorebase.yaml b/.github/workflows/autorebase.yaml new file mode 100644 index 000000000..b3daf2c16 --- /dev/null +++ b/.github/workflows/autorebase.yaml @@ -0,0 +1,33 @@ +name: Automatic Rebase +on: + issue_comment: + types: [created] +jobs: + rebase: + name: Rebase + runs-on: ubuntu-latest + if: >- + github.event.issue.pull_request != '' && + ( + contains(github.event.comment.body, '/rebase') || + contains(github.event.comment.body, '/autosquash') + ) + steps: + - name: Checkout the latest code + uses: actions/checkout@v3 + with: + #persist-credentials: false + token: ${{ secrets.GITGAB_SRI_PERSONAL_TOKEN }} + fetch-depth: 0 # otherwise, you will fail to push refs to dest repo + + - name: Configure git + run: | + git config --local user.name "github-actions[bot]" + git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" + + - name: Automatic Rebase + uses: cirrus-actions/rebase@1.8 + with: + autosquash: ${{ contains(github.event.comment.body, '/autosquash') || contains(github.event.comment.body, '/rebase-autosquash') }} + env: + GITHUB_TOKEN: ${{ secrets.GITGAB_SRI_PERSONAL_TOKEN }} diff --git a/.github/workflows/clippy-lint.yaml b/.github/workflows/clippy-lint.yaml deleted file mode 100644 index fa2c45fac..000000000 --- a/.github/workflows/clippy-lint.yaml +++ /dev/null @@ -1,42 +0,0 @@ -on: - push: - branches: - - main - - dev - pull_request: - branches: - - main - - dev - -name: Clippy Lint - -jobs: - clippy-check: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: - - macos-latest - - ubuntu-latest - include: - - os: macos-latest - target: x86_64-apple-darwin - - os: ubuntu-latest - target: x86_64-unknown-linux-musl - - steps: - - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: 1.75.0 - override: true - components: clippy - - name: Run Clippy on different workspaces and crates - run: | - cargo clippy --manifest-path=benches/Cargo.toml -- -D warnings -A dead-code - cargo clippy --manifest-path=common/Cargo.toml -- -D warnings -A dead-code - cargo clippy --manifest-path=protocols/Cargo.toml -- -D warnings -A dead-code - cargo clippy --manifest-path=roles/Cargo.toml -- -D warnings -A dead-code - cargo clippy --manifest-path=utils/Cargo.toml -- -D warnings -A dead-code - cargo clippy --manifest-path=utils/message-generator/Cargo.toml -- -D warnings -A dead-code diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml deleted file mode 100644 index 5c20325c1..000000000 --- a/.github/workflows/coverage.yaml +++ /dev/null @@ -1,48 +0,0 @@ -# Performs test coverage of project's libraries using cargo-tarpaulin and generates results using codecov.io. -# The following flags are set inside `tarpaulin.toml`: -# `features = "..."`: Includes the code with the listed features. The following features result in a -# tarpaulin error and are NOT included: derive, alloc, arbitrary-derive, attributes, and -# with_serde -# `run-types = [ "Lib" ]`: Only tests the package's library unit tests. Includes protocols, and utils (without the -# exclude-files flag, it includes this example because it contains a lib.rs file) -# `exclude-files = [ "examples/*" ]`: Excludes all projects in examples directory (specifically added to -# ignore examples that that contain a lib.rs file like interop-cpp) -# `timeout = "120s"`: If unresponsive for 120 seconds, action will fail -# `fail-under = 20`: If code coverage is less than 20%, action will fail -# `out = ["Xml"]`: Required for codecov.io to generate coverage result -# All message-generator test flags are in tests in test/message-generator/test -# This test loops through every test in test/message-generator/test, and runs each one, collecting -# code coverage data for anything in the roles/ directory that is relevant to SV2(pool, mining-proxy) - -name: Test Coverage - -on: - push: - branches: [ main, dev ] - pull_request: - branches: [ main, dev ] - -jobs: - tarpaulin-test: - - name: Tarpaulin Test - runs-on: ubuntu-latest - container: - image: xd009642/tarpaulin:0.27.1-nightly - options: --security-opt seccomp=unconfined - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Generate code coverage - run: | - ./scripts/tarpaulin.sh - - - name: Archive Tarpaulin code coverage results - uses: actions/upload-artifact@v4 - with: - name: tarpaulin-report - path: | - protocols/cobertura.xml - roles/cobertura.xml - utils/cobertura.xml diff --git a/.github/workflows/fmt.yaml b/.github/workflows/fmt.yaml index b0b3ecc18..f2341811f 100644 --- a/.github/workflows/fmt.yaml +++ b/.github/workflows/fmt.yaml @@ -7,6 +7,10 @@ on: branches: - main - dev + workflow_run: + workflows: ["Auto Rebase wuth Github Token"] # Nome del workflow di rebase + types: + - completed name: Rustfmt diff --git a/.github/workflows/lockfiles.yaml b/.github/workflows/lockfiles.yaml deleted file mode 100644 index e87f016a7..000000000 --- a/.github/workflows/lockfiles.yaml +++ /dev/null @@ -1,30 +0,0 @@ -name: Lockfiles - -# Trigger the workflow on push or pull request events for the dev and main branches -on: - push: - branches: - - dev - - main - pull_request: - branches: - - dev - - main - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - - name: Build with locked dependencies - run: | - cargo build --manifest-path=roles/Cargo.toml --locked - cargo build --manifest-path=utils/Cargo.toml --locked \ No newline at end of file diff --git a/.github/workflows/mg.yaml b/.github/workflows/mg.yaml deleted file mode 100644 index 8ee27a9c3..000000000 --- a/.github/workflows/mg.yaml +++ /dev/null @@ -1,221 +0,0 @@ -# Runs all Message Generator tests in separate jobs - -name: MG Test - -on: - push: - branches: [ main, dev ] - pull_request: - branches: [ main, dev ] - -jobs: - bad-pool-config-test: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Install cargo-llvm-cov - run: cargo install cargo-llvm-cov - - name: Run bad-pool-config-test - run: sh ./test/message-generator/test/bad-pool-config-test/bad-pool-config-test.sh - - interop-jd-translator: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Run interop-jd-translator - run: sh ./test/message-generator/test/interop-jd-translator/interop-jd-translator.sh - - interop-proxy-with-multi-ups: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Run interop-proxy-with-multi-ups - run: sh ./test/message-generator/test/interop-proxy-with-multi-ups/interop-proxy-with-multi-ups.sh - - interop-proxy-with-multi-ups-extended: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Run interop-proxy-with-multi-ups-extended - run: sh ./test/message-generator/test/interop-proxy-with-multi-ups-extended/interop-proxy-with-multi-ups-extended.sh - - jds-do-not-fail-on-wrong-tsdatasucc: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Run jds-do-not-fail-on-wrong-tsdatasucc - run: sh ./test/message-generator/test/jds-do-not-fail-on-wrong-tsdatasucc/jds-do-not-fail-on-wrong-tsdatasucc.sh - - jds-do-not-panic-if-jdc-close-connection: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Run jds-do-not-panic-if-jdc-close-connection - run: sh ./test/message-generator/test/jds-do-not-panic-if-jdc-close-connection/jds-do-not-panic-if-jdc-close-connection.sh - - jds-do-not-stackoverflow-when-no-token: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Run jds-do-not-stackoverflow-when-no-token - run: sh ./test/message-generator/test/jds-do-not-stackoverflow-when-no-token/jds-do-not-stackoverflow-when-no-token.sh - - jds-receive-solution-while-processing-declared-job: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Install cargo-llvm-cov - run: cargo install cargo-llvm-cov - - name: Run jds-receive-solution-while-processing-declared-job - run: sh ./test/message-generator/test/jds-receive-solution-while-processing-declared-job/jds-receive-solution-while-processing-declared-job.sh - - pool-sri-test-1-standard: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Install cargo-llvm-cov - run: cargo install cargo-llvm-cov - - name: Run pool-sri-test-1-standard - run: sh ./test/message-generator/test/pool-sri-test-1-standard/pool-sri-test-1-standard.sh - - pool-sri-test-close-channel: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Run pool-sri-test-close-channel - run: sh ./test/message-generator/test/pool-sri-test-close-channel/pool-sri-test-close-channel.sh - - pool-sri-test-extended_0: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Install cargo-llvm-cov - run: cargo install cargo-llvm-cov - - name: Run pool-sri-test-extended_0 - run: sh ./test/message-generator/test/pool-sri-test-extended_0/pool-sri-test-extended_0.sh - - pool-sri-test-extended_1: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Install cargo-llvm-cov - run: cargo install cargo-llvm-cov - - name: Run pool-sri-test-extended_1 - run: sh ./test/message-generator/test/pool-sri-test-extended_1/pool-sri-test-extended_1.sh - - pool-sri-test-reject-auth: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Install cargo-llvm-cov - run: cargo install cargo-llvm-cov - - name: Run pool-sri-test-reject-auth - run: sh ./test/message-generator/test/pool-sri-test-reject-auth/pool-sri-test-reject-auth.sh - - standard-coverage: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Install cargo-llvm-cov - run: cargo install cargo-llvm-cov - - name: Run standard-coverage - run: sh ./test/message-generator/test/standard-coverage-test/standard-coverage-test.sh - - sv1-test: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Run sv1-test - run: sh ./test/message-generator/test/sv1-test/sv1-test.sh - - translation-proxy-broke-pool: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Run translation-proxy-broke-pool - run: sh ./test/message-generator/test/translation-proxy-broke-pool/translation-proxy-broke-pool.sh - - translation-proxy: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Install cargo-llvm-cov - run: cargo install cargo-llvm-cov - - name: Run translation-proxy - run: sh ./test/message-generator/test/translation-proxy/translation-proxy.sh - - translation-proxy-old-share: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Run translation-proxy-old-share - run: sh ./test/message-generator/test/translation-proxy-old-share/translation-proxy-old-share.sh - - mg-aggregate-results: - name: "Aggregate MG Test Results" - runs-on: ubuntu-latest - if: always() - needs: [ - bad-pool-config-test, - interop-jd-translator, - interop-proxy-with-multi-ups, - interop-proxy-with-multi-ups-extended, - jds-do-not-fail-on-wrong-tsdatasucc, - jds-do-not-panic-if-jdc-close-connection, - jds-do-not-stackoverflow-when-no-token, - jds-receive-solution-while-processing-declared-job, - pool-sri-test-1-standard, - pool-sri-test-close-channel, - pool-sri-test-extended_0, - pool-sri-test-extended_1, - pool-sri-test-reject-auth, - standard-coverage, - sv1-test, - translation-proxy-broke-pool, - translation-proxy, - translation-proxy-old-share - ] - steps: - - name: Aggregate Results - run: | - if [ "${{ needs.bad-pool-config-test.result }}" != "success" ] || - [ "${{ needs.interop-jd-translator.result }}" != "success" ] || - [ "${{ needs.interop-proxy-with-multi-ups.result }}" != "success" ] || - [ "${{ needs.interop-proxy-with-multi-ups-extended.result }}" != "success" ] || - [ "${{ needs.jds-do-not-fail-on-wrong-tsdatasucc.result }}" != "success" ] || - [ "${{ needs.jds-do-not-panic-if-jdc-close-connection.result }}" != "success" ] || - [ "${{ needs.jds-do-not-stackoverflow-when-no-token.result }}" != "success" ] || - [ "${{ needs.jds-receive-solution-while-processing-declared-job.result }}" != "success" ] || - [ "${{ needs.pool-sri-test-1-standard.result }}" != "success" ] || - [ "${{ needs.pool-sri-test-close-channel.result }}" != "success" ] || - [ "${{ needs.pool-sri-test-extended_0.result }}" != "success" ] || - [ "${{ needs.pool-sri-test-extended_1.result }}" != "success" ] || - [ "${{ needs.pool-sri-test-reject-auth.result }}" != "success" ] || - [ "${{ needs.standard-coverage.result }}" != "success" ] || - [ "${{ needs.sv1-test.result }}" != "success" ] || - [ "${{ needs.translation-proxy-broke-pool.result }}" != "success" ] || - [ "${{ needs.translation-proxy.result }}" != "success" ] || - [ "${{ needs.translation-proxy-old-share.result }}" != "success" ]; then - echo "One or more jobs failed." - exit 1 - else - echo "All MG tests completed successfully" - fi \ No newline at end of file diff --git a/.github/workflows/release-libs.yaml b/.github/workflows/release-libs.yaml deleted file mode 100644 index 49418675d..000000000 --- a/.github/workflows/release-libs.yaml +++ /dev/null @@ -1,141 +0,0 @@ -# This workflow is used to publish SV2 crates to crates.io -# The workflow tries to update all the library crates, so if a crate is not to updated, the step will fail -# for that each step have continue-on-error set to true. -# Since each step can fail, the output ot the action must be manually checked to make sure that all -# the library intended to be published are published. -# Running cargo release in the various workspace help to prepare the version number and everything. -# ATTENTION -# Is very important to check the output manually cause when too many crates are updated crates.io could fail -# and ask to rerun the action later - -name: Release Libs - -on: - push: - branches: - - main - -jobs: - libs_publish: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - name: Login - run: cargo login ${{ secrets.CRATES_IO_DEPLOY_KEY }} - - name: Publish crate common - continue-on-error: true - run: | - cd common - cargo publish - - name: Publish crate buffer_sv2 - continue-on-error: true - run: | - cd utils/buffer - cargo publish - - name: Publish crate no_serde_sv2_derive_codec - continue-on-error: true - run: | - cd protocols/v2/binary-sv2/no-serde-sv2/derive_codec - cargo publish - - name: Publish crate no_serde_sv2_codec - continue-on-error: true - run: | - cd protocols/v2/binary-sv2/no-serde-sv2/codec - cargo publish - - name: Publish crate serde_sv2 - continue-on-error: true - run: | - cd protocols/v2/binary-sv2/serde-sv2 - cargo publish - - name: Publish crate binary_sv2 - continue-on-error: true - run: | - cd protocols/v2/binary-sv2/binary-sv2 - cargo publish - - name: Publish crate const_sv2 - continue-on-error: true - run: | - cd protocols/v2/const-sv2 - cargo publish - - name: Publish crate framing_sv2 - continue-on-error: true - run: | - cd protocols/v2/framing-sv2 - cargo publish - - name: Publish crate noise_sv2 - continue-on-error: true - run: | - cd protocols/v2/noise-sv2 - cargo publish - - name: Publish crate codec_sv2 - continue-on-error: true - run: | - cd protocols/v2/codec-sv2 - cargo publish - - name: Publish crate common_messages - continue-on-error: true - run: | - cd protocols/v2/subprotocols/common-messages - cargo publish - - name: Publish crate job_declaration - continue-on-error: true - run: | - cd protocols/v2/subprotocols/job-declaration - cargo publish - - name: Publish crate mining - continue-on-error: true - run: | - cd protocols/v2/subprotocols/mining - cargo publish - - name: Publish crate template_distribution - continue-on-error: true - run: | - cd protocols/v2/subprotocols/template-distribution - cargo publish - - name: Publish crate sv2_ffi - continue-on-error: true - run: | - cd protocols/v2/sv2-ffi - cargo publish --all-features - - name: Publish crate roles_logic_sv2 - continue-on-error: true - run: | - cd protocols/v2/roles-logic-sv2 - cargo publish - - name: Publish crate v1 - continue-on-error: true - run: | - cd protocols/v1 - cargo publish - - name: Publish crate bip32-key-derivation - continue-on-error: true - run: | - cd utils/bip32-key-derivation - cargo publish - - name: Publish crate error-handling - continue-on-error: true - run: | - cd utils/error-handling - cargo publish - - name: Publish crate key-utils - continue-on-error: true - run: | - cd utils/key-utils - cargo publish - - name: Publish crate network_helpers_sv2 - continue-on-error: true - run: | - cd roles/roles-utils/network-helpers - cargo publish - - name: Publish crate rpc_sv2 - continue-on-error: true - run: | - cd roles/roles-utils/rpc - cargo publish \ No newline at end of file diff --git a/.github/workflows/run-and-track-benchmarks-on-main.yaml b/.github/workflows/run-and-track-benchmarks-on-main.yaml deleted file mode 100644 index 33be08bc5..000000000 --- a/.github/workflows/run-and-track-benchmarks-on-main.yaml +++ /dev/null @@ -1,124 +0,0 @@ -name: Run and Track Benchmarks On Main - -on: - push: - branches: - - main - -jobs: - benchmark_sv1_criterion_with_bencher: - name: Track sv1 criterion benchmarks with Bencher - runs-on: ubuntu-latest - env: - BENCHER_PROJECT: stratum-v2-sri - BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }} - BENCHER_ADAPTER: rust_criterion - BENCHER_TESTBED: sv1 - steps: - - name: Set up Rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: 1.75.0 - override: true - - name: Checkout repository - uses: actions/checkout@v2 - - - uses: actions/checkout@v4 - - uses: bencherdev/bencher@main - - name: Benchmark with Bencher - run: | - cd benches - bencher run \ - --github-actions ${{ secrets.GITHUB_TOKEN }} \ - "cargo bench --bench criterion_sv1_benchmark" - - benchmark_sv2_criterion_with_bencher: - name: Track sv2 criterion benchmarks with Bencher - runs-on: ubuntu-latest - env: - BENCHER_PROJECT: stratum-v2-sri - BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }} - BENCHER_ADAPTER: rust_criterion - BENCHER_TESTBED: sv2 - steps: - - name: Set up Rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: 1.75.0 - override: true - - name: Checkout repository - uses: actions/checkout@v2 - - - uses: actions/checkout@v4 - - uses: bencherdev/bencher@main - - name: Benchmark with Bencher - run: | - cd benches - bencher run \ - --github-actions ${{ secrets.GITHUB_TOKEN }} \ - "cargo bench --bench criterion_sv2_benchmark" - - benchmark_sv1_iai_with_bencher: - name: Track sv1 iai benchmarks with Bencher - runs-on: ubuntu-latest - env: - BENCHER_PROJECT: stratum-v2-sri - BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }} - BENCHER_ADAPTER: rust_iai - BENCHER_TESTBED: sv1 - steps: - - name: Set up Rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: 1.75.0 - override: true - - name: Checkout repository - uses: actions/checkout@v4 - - name: Install Valgrind - run: | - sudo apt-get update - sudo apt-get install -y valgrind=1:3.18.1-1ubuntu2 - - - uses: actions/checkout@v4 - - uses: bencherdev/bencher@main - - name: Benchmark with Bencher - run: | - cd benches - bencher run \ - --github-actions ${{ secrets.GITHUB_TOKEN }} \ - "cargo bench --bench iai_sv1_benchmark" - - benchmark_sv2_iai_with_bencher: - name: Track sv2 iai benchmarks with Bencher - runs-on: ubuntu-latest - env: - BENCHER_PROJECT: stratum-v2-sri - BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }} - BENCHER_ADAPTER: rust_iai - BENCHER_TESTBED: sv2 - steps: - - name: Set up Rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: 1.75.0 - override: true - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Install Valgrind - run: | - sudo apt-get update - sudo apt-get install -y valgrind=1:3.18.1-1ubuntu2 - - - uses: actions/checkout@v4 - - uses: bencherdev/bencher@main - - name: Benchmark with Bencher - run: | - cd benches - bencher run \ - --github-actions ${{ secrets.GITHUB_TOKEN }} \ - "cargo bench --bench iai_sv2_benchmark" \ No newline at end of file diff --git a/.github/workflows/run-benchmarks.yaml b/.github/workflows/run-benchmarks.yaml deleted file mode 100644 index 150188218..000000000 --- a/.github/workflows/run-benchmarks.yaml +++ /dev/null @@ -1,125 +0,0 @@ -name: Run and Cache Benchmarks - -on: - pull_request: - branches: - - main - - dev - -jobs: - benchmark_sv1_criterion: - name: Run and cache criterion sv1 benchmarks - runs-on: ubuntu-latest - steps: - - name: Set up Rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: 1.75.0 - override: true - - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Run Benchmarks - run: | - cd benches - cargo bench --bench criterion_sv1_benchmark > criterion_sv1_benchmarks.txt - - - name: Upload Benchmark Results - uses: actions/upload-artifact@v4 - with: - name: criterion_sv1_benchmarks.txt - path: ./benches/criterion_sv1_benchmarks.txt - - - benchmark_sv2_criterion: - name: Run and cache criterion sv2 benchmarks - runs-on: ubuntu-latest - steps: - - name: Set up Rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: 1.75.0 - override: true - - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Run Benchmarks - run: | - cd benches - cargo bench --bench criterion_sv2_benchmark > criterion_sv2_benchmarks.txt - - - name: Upload Benchmark Results - uses: actions/upload-artifact@v4 - with: - name: criterion_sv2_benchmarks.txt - path: ./benches/criterion_sv2_benchmarks.txt - - benchmark_sv1_iai: - name: Run and cache iai sv1 benchmarks - runs-on: ubuntu-latest - steps: - - name: Set up Rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: 1.75.0 - override: true - - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Install Valgrind - run: | - sudo apt-get update - sudo apt-get install -y valgrind=1:3.18.1-1ubuntu2 - - - name: Run Benchmarks - run: | - cd benches - cargo bench --bench iai_sv1_benchmark > iai_sv1_benchmarks.txt - - - name: Upload Benchmark Results - uses: actions/upload-artifact@v4 - with: - name: iai_sv1_benchmarks.txt - path: ./benches/iai_sv1_benchmarks.txt - - benchmark_sv2_iai: - name: Run and cache iai sv2 benchmarks - runs-on: ubuntu-latest - steps: - - name: Set up Rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: 1.75.0 - override: true - - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Install Valgrind - run: | - sudo apt-get update - sudo apt-get install -y valgrind=1:3.18.1-1ubuntu2 - - - name: Run Benchmarks - run: | - cd benches - cargo bench --bench iai_sv2_benchmark > iai_sv2_benchmarks.txt - - - name: Upload Benchmark Results - uses: actions/upload-artifact@v4 - with: - name: iai_sv2_benchmarks.txt - path: ./benches/iai_sv2_benchmarks.txt - - - name: Upload GitHub Pull Request Event - uses: actions/upload-artifact@v4 - with: - name: event.json - path: ${{ github.event_path }} diff --git a/.github/workflows/rust-msrv.yaml b/.github/workflows/rust-msrv.yaml deleted file mode 100644 index 3384e4a2f..000000000 --- a/.github/workflows/rust-msrv.yaml +++ /dev/null @@ -1,37 +0,0 @@ -on: - push: - branches: - - main - - dev - pull_request: - branches: - - main - - dev - -name: MSRV 1.75 Check - -jobs: - - build: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - rust: - - 1.75.0 # MSRV - - steps: - - uses: actions/checkout@v2 - - uses: Swatinem/rust-cache@v1.2.0 - - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.rust }} - override: true - - name: Build Benches - run: cargo build --manifest-path=benches/Cargo.toml - - name: Build Protocols - run: cargo build --manifest-path=protocols/Cargo.toml - - name: Build Roles - run: cargo build --manifest-path=roles/Cargo.toml - - name: Build Utils - run: cargo build --manifest-path=utils/Cargo.toml diff --git a/.github/workflows/semver-check.yaml b/.github/workflows/semver-check.yaml deleted file mode 100644 index 9a2a45ad3..000000000 --- a/.github/workflows/semver-check.yaml +++ /dev/null @@ -1,131 +0,0 @@ -name: Semver Check - -on: - push: - branches: - - "main" - - "dev" - pull_request: - branches: - - "main" - - "dev" - -jobs: - semver-check: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - - name: Cache Cargo registry - uses: actions/cache@v2 - with: - path: ~/.cargo/registry - key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo-registry- - - - name: Cache Cargo index - uses: actions/cache@v2 - with: - path: ~/.cargo/git - key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo-index- - - - name: Install dependencies - run: sudo apt-get update && sudo apt-get install -y cmake - - - name: Install cargo-semver-checks - run: cargo install cargo-semver-checks --locked - - - name: Run semver checks for common - working-directory: common - run: cargo semver-checks - - - name: Run semver checks for utils/buffer - working-directory: utils/buffer - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/binary-sv2/no-serde-sv2/codec - working-directory: protocols/v2/binary-sv2/no-serde-sv2/codec - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/binary-sv2/serde-sv2 - working-directory: protocols/v2/binary-sv2/serde-sv2 - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/binary-sv2/binary-sv2 - working-directory: protocols/v2/binary-sv2/binary-sv2 - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/const-sv2 - working-directory: protocols/v2/const-sv2 - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/framing-sv2 - working-directory: protocols/v2/framing-sv2 - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/noise-sv2 - working-directory: protocols/v2/noise-sv2 - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/codec-sv2 - working-directory: protocols/v2/codec-sv2 - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/subprotocols/common-messages - working-directory: protocols/v2/subprotocols/common-messages - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/subprotocols/job-declaration - working-directory: protocols/v2/subprotocols/job-declaration - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/subprotocols/mining - working-directory: protocols/v2/subprotocols/mining - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/subprotocols/template-distribution - working-directory: protocols/v2/subprotocols/template-distribution - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/sv2-ffi - working-directory: protocols/v2/sv2-ffi - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/roles-logic-sv2 - working-directory: protocols/v2/roles-logic-sv2 - run: cargo semver-checks --default-features - - - name: Run semver checks for protocols/v1 - working-directory: protocols/v1 - run: cargo semver-checks - - - name: Run semver checks for utils/bip32-key-derivation - working-directory: utils/bip32-key-derivation - run: cargo semver-checks - - - name: Run semver checks for utils/error-handling - working-directory: utils/error-handling - run: cargo semver-checks - - - name: Run semver checks for utils/key-utils - working-directory: utils/key-utils - run: cargo semver-checks - - - name: Run semver checks for roles/roles-utils/network-helpers - working-directory: roles/roles-utils/network-helpers - run: cargo semver-checks - - - name: Run semver checks for roles/roles-utils/rpc - working-directory: roles/roles-utils/rpc - run: cargo semver-checks \ No newline at end of file diff --git a/.github/workflows/sv2-header-check.yaml b/.github/workflows/sv2-header-check.yaml deleted file mode 100644 index 732bd316b..000000000 --- a/.github/workflows/sv2-header-check.yaml +++ /dev/null @@ -1,32 +0,0 @@ -on: - push: - branches: [ main, dev ] - pull_request: - branches: [ main, dev ] - -# Check sv2.h file is up to date with commit -name: sv2.h Header Check - -jobs: - sv2_header_check: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: - - ubuntu-latest - include: - - os: ubuntu-latest - target: x86_64-unknown-linux-musl - - steps: - - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 - - with: - profile: minimal - toolchain: 1.65.0 - override: true - - name: Check sv2 header file is up to date with commit - run: | - echo Check sv2 header file is up to date with commit - sh ./scripts/sv2-header-check.sh diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml deleted file mode 100644 index 5b669ebc0..000000000 --- a/.github/workflows/test.yaml +++ /dev/null @@ -1,93 +0,0 @@ -on: - push: - branches: - - main - - dev - pull_request: - branches: - - main - - dev - -name: Test, Prop Tests, Example Tests - -jobs: - ci: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: - - macos-latest - - ubuntu-latest - include: - - os: macos-latest - target: x86_64-apple-darwin - - os: ubuntu-latest - target: x86_64-unknown-linux-musl - - steps: - - name: Install stable toolchain & components - uses: actions/checkout@v4 - with: - profile: minimal - toolchain: nightly - override: true - - - name: Build - run: | - cargo build --manifest-path=benches/Cargo.toml - cargo build --manifest-path=common/Cargo.toml - cargo build --manifest-path=protocols/Cargo.toml - cargo build --manifest-path=roles/Cargo.toml - cargo build --manifest-path=utils/Cargo.toml - - - name: Run sv1-client-and-server example - run: | - cargo run --manifest-path=examples/sv1-client-and-server/Cargo.toml --bin client_and_server -- 60 - - - name: interop-test - run: | - if [ ${{ matrix.os }} == "ubuntu-latest" ]; then - ./run.sh 30 - else - echo "Skipping interop-test on ${{ matrix.os }} - not supported" - fi - working-directory: examples/interop-cpp/ - - # TODO this is only usefull if we want to build c bindings with guix - #- name: interop-no-cargo-test - # run: | - # if [ ${{ matrix.os }} == "ubuntu-latest" ]; then - # ./run.sh 30 - # else - # echo "Skipping interop-test on ${{ matrix.os }} - not supported" - # fi - # working-directory: examples/interop-cpp-no-cargo/ - - - name: fuzz tests - run: | - if [ ${{ matrix.os }} == "ubuntu-latest" ]; then - ./run.sh 30 - else - echo "Skipping fuzz test on ${{ matrix.os }} - not supported" - fi - working-directory: utils/buffer/fuzz - - - name: Test - run: | - cargo test --manifest-path=benches/Cargo.toml - cargo test --manifest-path=common/Cargo.toml - cargo test --manifest-path=protocols/Cargo.toml - cargo test --manifest-path=roles/Cargo.toml - cargo test --manifest-path=utils/Cargo.toml - - - name: Property based testing - run: | - cargo test --manifest-path=protocols/Cargo.toml --features prop_test - - - name: Run ping-pong-with-noise example - run: | - cargo run --manifest-path=examples/ping-pong-with-noise/Cargo.toml --bin ping_pong_with_noise -- 10 - - - name: Run ping-pong-without-noise example - run: | - cargo run --manifest-path=examples/ping-pong-without-noise/Cargo.toml --bin ping_pong_without_noise -- 10 diff --git a/.github/workflows/track-benchmarks.yaml b/.github/workflows/track-benchmarks.yaml deleted file mode 100644 index 1a81de933..000000000 --- a/.github/workflows/track-benchmarks.yaml +++ /dev/null @@ -1,264 +0,0 @@ -name: Track Benchmarks - -on: - workflow_run: - workflows: [Run and Cache Benchmarks] - types: - - completed - -jobs: - track_sv1_criterion_with_bencher: - if: github.event.workflow_run.conclusion == 'success' - runs-on: ubuntu-latest - env: - BENCHER_PROJECT: stratum-v2-sri - BENCHER_ADAPTER: rust_criterion - BENCHER_TESTBED: sv1 - BENCHMARK_RESULTS: criterion_sv1_benchmarks.txt - PR_EVENT: event.json - steps: - - name: Download Benchmark Results - uses: actions/github-script@v6 - with: - script: | - async function downloadArtifact(artifactName) { - let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: context.payload.workflow_run.id, - }); - let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { - return artifact.name == artifactName - })[0]; - if (!matchArtifact) { - core.setFailed(`Failed to find artifact: ${artifactName}`); - } - let download = await github.rest.actions.downloadArtifact({ - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: matchArtifact.id, - archive_format: 'zip', - }); - let fs = require('fs'); - fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/${artifactName}.zip`, Buffer.from(download.data)); - } - await downloadArtifact(process.env.BENCHMARK_RESULTS); - await downloadArtifact(process.env.PR_EVENT); - - name: Unzip Benchmark Results - run: | - unzip $BENCHMARK_RESULTS.zip - unzip $PR_EVENT.zip - - name: Export PR Event Data - uses: actions/github-script@v6 - with: - script: | - let fs = require('fs'); - let prEvent = JSON.parse(fs.readFileSync(process.env.PR_EVENT, {encoding: 'utf8'})); - core.exportVariable("PR_HEAD", `${prEvent.number}/merge`); - core.exportVariable("PR_BASE", prEvent.pull_request.base.ref); - core.exportVariable("PR_DEFAULT", prEvent.pull_request.base.repo.default_branch); - core.exportVariable("PR_NUMBER", prEvent.number); - - uses: bencherdev/bencher@main - - name: Track Benchmarks with Bencher - run: | - bencher run \ - --if-branch '${{ env.PR_HEAD }}' \ - --else-if-branch '${{ env.PR_BASE }}' \ - --else-if-branch '${{ env.PR_DEFAULT }}' \ - --ci-number '${{ env.PR_NUMBER }}' \ - --github-actions "${{ secrets.GITHUB_TOKEN }}" \ - --token "${{ secrets.BENCHER_API_TOKEN }}" \ - --err \ - --file "$BENCHMARK_RESULTS" - - track_sv2_criterion_with_bencher: - if: github.event.workflow_run.conclusion == 'success' - runs-on: ubuntu-latest - env: - BENCHER_PROJECT: stratum-v2-sri - BENCHER_ADAPTER: rust_criterion - BENCHER_TESTBED: sv2 - BENCHMARK_RESULTS: criterion_sv2_benchmarks.txt - PR_EVENT: event.json - steps: - - name: Download Benchmark Results - uses: actions/github-script@v6 - with: - script: | - async function downloadArtifact(artifactName) { - let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: context.payload.workflow_run.id, - }); - let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { - return artifact.name == artifactName - })[0]; - if (!matchArtifact) { - core.setFailed(`Failed to find artifact: ${artifactName}`); - } - let download = await github.rest.actions.downloadArtifact({ - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: matchArtifact.id, - archive_format: 'zip', - }); - let fs = require('fs'); - fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/${artifactName}.zip`, Buffer.from(download.data)); - } - await downloadArtifact(process.env.BENCHMARK_RESULTS); - await downloadArtifact(process.env.PR_EVENT); - - name: Unzip Benchmark Results - run: | - unzip $BENCHMARK_RESULTS.zip - unzip $PR_EVENT.zip - - name: Export PR Event Data - uses: actions/github-script@v6 - with: - script: | - let fs = require('fs'); - let prEvent = JSON.parse(fs.readFileSync(process.env.PR_EVENT, {encoding: 'utf8'})); - core.exportVariable("PR_HEAD", prEvent.pull_request.head.ref); - core.exportVariable("PR_BASE", prEvent.pull_request.base.ref); - core.exportVariable("PR_DEFAULT", prEvent.pull_request.base.repo.default_branch); - core.exportVariable("PR_NUMBER", prEvent.number); - - uses: bencherdev/bencher@main - - name: Track Benchmarks with Bencher - run: | - bencher run \ - --if-branch '${{ env.PR_HEAD }}' \ - --else-if-branch '${{ env.PR_BASE }}' \ - --else-if-branch '${{ env.PR_DEFAULT }}' \ - --ci-number '${{ env.PR_NUMBER }}' \ - --github-actions "${{ secrets.GITHUB_TOKEN }}" \ - --token "${{ secrets.BENCHER_API_TOKEN }}" \ - --err \ - --file "$BENCHMARK_RESULTS" - - track_sv1_iai_with_bencher: - if: github.event.workflow_run.conclusion == 'success' - runs-on: ubuntu-latest - env: - BENCHER_PROJECT: stratum-v2-sri - BENCHER_ADAPTER: rust_iai - BENCHER_TESTBED: sv1 - BENCHMARK_RESULTS: iai_sv1_benchmarks.txt - PR_EVENT: event.json - steps: - - name: Download Benchmark Results - uses: actions/github-script@v6 - with: - script: | - async function downloadArtifact(artifactName) { - let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: context.payload.workflow_run.id, - }); - let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { - return artifact.name == artifactName - })[0]; - if (!matchArtifact) { - core.setFailed(`Failed to find artifact: ${artifactName}`); - } - let download = await github.rest.actions.downloadArtifact({ - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: matchArtifact.id, - archive_format: 'zip', - }); - let fs = require('fs'); - fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/${artifactName}.zip`, Buffer.from(download.data)); - } - await downloadArtifact(process.env.BENCHMARK_RESULTS); - await downloadArtifact(process.env.PR_EVENT); - - name: Unzip Benchmark Results - run: | - unzip $BENCHMARK_RESULTS.zip - unzip $PR_EVENT.zip - - name: Export PR Event Data - uses: actions/github-script@v6 - with: - script: | - let fs = require('fs'); - let prEvent = JSON.parse(fs.readFileSync(process.env.PR_EVENT, {encoding: 'utf8'})); - core.exportVariable("PR_HEAD", prEvent.pull_request.head.ref); - core.exportVariable("PR_BASE", prEvent.pull_request.base.ref); - core.exportVariable("PR_DEFAULT", prEvent.pull_request.base.repo.default_branch); - core.exportVariable("PR_NUMBER", prEvent.number); - - uses: bencherdev/bencher@main - - name: Track Benchmarks with Bencher - run: | - bencher run \ - --if-branch '${{ env.PR_HEAD }}' \ - --else-if-branch '${{ env.PR_BASE }}' \ - --else-if-branch '${{ env.PR_DEFAULT }}' \ - --ci-number '${{ env.PR_NUMBER }}' \ - --github-actions "${{ secrets.GITHUB_TOKEN }}" \ - --token "${{ secrets.BENCHER_API_TOKEN }}" \ - --err \ - --file "$BENCHMARK_RESULTS" - - track_sv2_iai_with_bencher: - if: github.event.workflow_run.conclusion == 'success' - runs-on: ubuntu-latest - env: - BENCHER_PROJECT: stratum-v2-sri - BENCHER_ADAPTER: rust_iai - BENCHER_TESTBED: sv2 - BENCHMARK_RESULTS: iai_sv2_benchmarks.txt - PR_EVENT: event.json - steps: - - name: Download Benchmark Results - uses: actions/github-script@v6 - with: - script: | - async function downloadArtifact(artifactName) { - let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: context.payload.workflow_run.id, - }); - let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { - return artifact.name == artifactName - })[0]; - if (!matchArtifact) { - core.setFailed(`Failed to find artifact: ${artifactName}`); - } - let download = await github.rest.actions.downloadArtifact({ - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: matchArtifact.id, - archive_format: 'zip', - }); - let fs = require('fs'); - fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/${artifactName}.zip`, Buffer.from(download.data)); - } - await downloadArtifact(process.env.BENCHMARK_RESULTS); - await downloadArtifact(process.env.PR_EVENT); - - name: Unzip Benchmark Results - run: | - unzip $BENCHMARK_RESULTS.zip - unzip $PR_EVENT.zip - - name: Export PR Event Data - uses: actions/github-script@v6 - with: - script: | - let fs = require('fs'); - let prEvent = JSON.parse(fs.readFileSync(process.env.PR_EVENT, {encoding: 'utf8'})); - core.exportVariable("PR_HEAD", prEvent.pull_request.head.ref); - core.exportVariable("PR_BASE", prEvent.pull_request.base.ref); - core.exportVariable("PR_DEFAULT", prEvent.pull_request.base.repo.default_branch); - core.exportVariable("PR_NUMBER", prEvent.number); - - uses: bencherdev/bencher@main - - name: Track Benchmarks with Bencher - run: | - bencher run \ - --if-branch '${{ env.PR_HEAD }}' \ - --else-if-branch '${{ env.PR_BASE }}' \ - --else-if-branch '${{ env.PR_DEFAULT }}' \ - --ci-number '${{ env.PR_NUMBER }}' \ - --github-actions "${{ secrets.GITHUB_TOKEN }}" \ - --token "${{ secrets.BENCHER_API_TOKEN }}" \ - --err \ - --file "$BENCHMARK_RESULTS" \ No newline at end of file diff --git a/README.md b/README.md index b1b2cd119..49f644b2c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,8 @@ - +# TEST +## TEST2 +### TEST3 +#### TEST4 +##### TEST5


SRI diff --git a/RELEASE.md b/RELEASE.md index 754d55edf..a0d6e4c57 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,3 +1,4 @@ +TEST ## Changelog The changelog is a file that contains a curated, chronologically ordered list of