diff --git a/.github/workflows/CICD.yaml b/.github/workflows/CICD.yaml new file mode 100644 index 0000000000..6a37d39c18 --- /dev/null +++ b/.github/workflows/CICD.yaml @@ -0,0 +1,372 @@ +name: CICD + +env: + MIN_SUPPORTED_RUST_VERSION: "1.45.0" + CICD_INTERMEDIATES_DIR: "_cicd-intermediates" + +on: + workflow_dispatch: + pull_request: + push: + branches: + - main + tags: + - '*' + +jobs: + min_version: + name: Minimum supported rust version + runs-on: ubuntu-20.04 + steps: + - name: Checkout source code + uses: actions/checkout@v2 + + - name: Install rust toolchain (v${{ env.MIN_SUPPORTED_RUST_VERSION }}) + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ env.MIN_SUPPORTED_RUST_VERSION }} + default: true + profile: minimal # minimal component installation (ie, no documentation) + components: clippy, rustfmt + - name: Ensure `cargo fmt` has been run + uses: actions-rs/cargo@v1 + with: + command: fmt + args: -- --check + - name: Run clippy (on minimum supported rust version to prevent warnings we can't fix) + uses: actions-rs/cargo@v1 + with: + command: clippy + args: --locked --all-targets --all-features + - name: Run tests + uses: actions-rs/cargo@v1 + with: + command: test + args: --locked + + test_with_new_syntaxes_and_themes: + name: Run tests with updated syntaxes and themes + runs-on: ubuntu-20.04 + steps: + - name: Git checkout + uses: actions/checkout@v2 + with: + submodules: true # we need all syntax and theme submodules + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + default: true + profile: minimal + - name: Build and install rustpython + uses: actions-rs/cargo@v1 + with: + command: install + args: --locked --path . + - name: Rebuild binary assets (syntaxes and themes) + run: bash assets/create.sh + - name: Build and install rustpython with updated assets + uses: actions-rs/cargo@v1 + with: + command: install + args: --locked --path . + - name: Run unit tests with new syntaxes and themes + uses: actions-rs/cargo@v1 + with: + command: test + args: --locked --release + - name: Run ignored-by-default unit tests with new syntaxes and themes + uses: actions-rs/cargo@v1 + with: + command: test + args: --locked --release -- --ignored + - name: Syntax highlighting regression test + run: tests/syntax-tests/regression_test.sh + - name: List of languages + run: rustpython --list-languages + - name: List of themes + run: rustpython --list-themes + - name: Check documentation + env: + RUSTDOCFLAGS: -D warnings + uses: actions-rs/cargo@v1 + with: + command: doc + args: --locked --no-deps --document-private-items --all-features + + build: + name: ${{ matrix.job.os }} (${{ matrix.job.target }}) + runs-on: ${{ matrix.job.os }} + strategy: + fail-fast: false + matrix: + job: + - { os: ubuntu-20.04, target: arm-unknown-linux-gnueabihf , use-cross: true } + - { os: ubuntu-20.04, target: arm-unknown-linux-musleabihf, use-cross: true } + - { os: ubuntu-20.04, target: aarch64-unknown-linux-gnu , use-cross: true } + - { os: ubuntu-20.04, target: i686-unknown-linux-gnu , use-cross: true } + - { os: ubuntu-20.04, target: i686-unknown-linux-musl , use-cross: true } + - { os: ubuntu-20.04, target: x86_64-unknown-linux-gnu } + - { os: ubuntu-20.04, target: x86_64-unknown-linux-musl , use-cross: true } + - { os: macos-10.15 , target: x86_64-apple-darwin } + # - { os: windows-2019, target: i686-pc-windows-gnu } ## disabled; error: linker `i686-w64-mingw32-gcc` not found + - { os: windows-2019, target: i686-pc-windows-msvc } + - { os: windows-2019, target: x86_64-pc-windows-gnu } + - { os: windows-2019, target: x86_64-pc-windows-msvc } + steps: + - name: Checkout source code + uses: actions/checkout@v2 + + - name: Install prerequisites + shell: bash + run: | + case ${{ matrix.job.target }} in + arm-unknown-linux-*) sudo apt-get -y update ; sudo apt-get -y install gcc-arm-linux-gnueabihf ;; + aarch64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt-get -y install gcc-aarch64-linux-gnu ;; + esac + + - name: Extract crate information + shell: bash + run: | + echo "PROJECT_NAME=$(sed -n 's/^name = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV + echo "PROJECT_VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV + echo "PROJECT_MAINTAINER=$(sed -n 's/^authors = \["\(.*\)"\]/\1/p' Cargo.toml)" >> $GITHUB_ENV + echo "PROJECT_HOMEPAGE=$(sed -n 's/^homepage = "\(.*\)"/\1/p' Cargo.toml)" >> $GITHUB_ENV + + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: ${{ matrix.job.target }} + override: true + profile: minimal # minimal component installation (ie, no documentation) + + - name: Show version information (Rust, cargo, GCC) + shell: bash + run: | + gcc --version || true + rustup -V + rustup toolchain list + rustup default + cargo -V + rustc -V + + - name: Build + uses: actions-rs/cargo@v1 + with: + use-cross: ${{ matrix.job.use-cross }} + command: build + args: --locked --release --target=${{ matrix.job.target }} + + - name: Strip debug information from executable + id: strip + shell: bash + run: | + # Figure out suffix of binary + EXE_suffix="" + case ${{ matrix.job.target }} in + *-pc-windows-*) EXE_suffix=".exe" ;; + esac; + + # Figure out what strip tool to use if any + STRIP="strip" + case ${{ matrix.job.target }} in + arm-unknown-linux-*) STRIP="arm-linux-gnueabihf-strip" ;; + aarch64-unknown-linux-gnu) STRIP="aarch64-linux-gnu-strip" ;; + *-pc-windows-msvc) STRIP="" ;; + esac; + + # Setup paths + BIN_DIR="${{ env.CICD_INTERMEDIATES_DIR }}/stripped-release-bin/" + mkdir -p "${BIN_DIR}" + BIN_NAME="${{ env.PROJECT_NAME }}${EXE_suffix}" + BIN_PATH="${BIN_DIR}/${BIN_NAME}" + + # Copy the release build binary to the result location + cp "target/${{ matrix.job.target }}/release/${BIN_NAME}" "${BIN_DIR}" + + # Also strip if possible + if [ -n "${STRIP}" ]; then + "${STRIP}" "${BIN_PATH}" + fi + + # Let subsequent steps know where to find the (stripped) bin + echo ::set-output name=BIN_PATH::${BIN_PATH} + echo ::set-output name=BIN_NAME::${BIN_NAME} + + - name: Create tarball + id: package + shell: bash + run: | + PKG_suffix=".tar.gz" ; case ${{ matrix.job.target }} in *-pc-windows-*) PKG_suffix=".zip" ;; esac; + PKG_BASENAME=${PROJECT_NAME}-v${PROJECT_VERSION}-${{ matrix.job.target }} + PKG_NAME=${PKG_BASENAME}${PKG_suffix} + echo ::set-output name=PKG_NAME::${PKG_NAME} + + PKG_STAGING="${{ env.CICD_INTERMEDIATES_DIR }}/package" + ARCHIVE_DIR="${PKG_STAGING}/${PKG_BASENAME}/" + mkdir -p "${ARCHIVE_DIR}" + mkdir -p "${ARCHIVE_DIR}/autocomplete" + + # Binary + cp "${{ steps.strip.outputs.BIN_PATH }}" "$ARCHIVE_DIR" + + # Man page + cp 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/manual/rustpython.1 "$ARCHIVE_DIR" + + # README, LICENSE and CHANGELOG files + cp "README.md" "LICENSE-MIT" "LICENSE-APACHE" "CHANGELOG.md" "$ARCHIVE_DIR" + + # Autocompletion files + cp 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/rustpython.bash "$ARCHIVE_DIR/autocomplete/${{ env.PROJECT_NAME }}.bash" + cp 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/rustpython.fish "$ARCHIVE_DIR/autocomplete/${{ env.PROJECT_NAME }}.fish" + cp 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/rustpython.zsh "$ARCHIVE_DIR/autocomplete/${{ env.PROJECT_NAME }}.zsh" + + # base compressed package + pushd "${PKG_STAGING}/" >/dev/null + case ${{ matrix.job.target }} in + *-pc-windows-*) 7z -y a "${PKG_NAME}" "${PKG_BASENAME}"/* | tail -2 ;; + *) tar czf "${PKG_NAME}" "${PKG_BASENAME}"/* ;; + esac; + popd >/dev/null + + # Let subsequent steps know where to find the compressed package + echo ::set-output name=PKG_PATH::"${PKG_STAGING}/${PKG_NAME}" + + - name: Create Debian package + id: debian-package + shell: bash + if: startsWith(matrix.job.os, 'ubuntu') + run: | + COPYRIGHT_YEARS="2018 - "$(date "+%Y") + DPKG_STAGING="${{ env.CICD_INTERMEDIATES_DIR }}/debian-package" + DPKG_DIR="${DPKG_STAGING}/dpkg" + mkdir -p "${DPKG_DIR}" + + DPKG_BASENAME=${PROJECT_NAME} + DPKG_CONFLICTS=${PROJECT_NAME}-musl + case ${{ matrix.job.target }} in *-musl) DPKG_BASENAME=${PROJECT_NAME}-musl ; DPKG_CONFLICTS=${PROJECT_NAME} ;; esac; + DPKG_VERSION=${PROJECT_VERSION} + + unset DPKG_ARCH + case ${{ matrix.job.target }} in + aarch64-*-linux-*) DPKG_ARCH=arm64 ;; + arm-*-linux-*hf) DPKG_ARCH=armhf ;; + i686-*-linux-*) DPKG_ARCH=i686 ;; + x86_64-*-linux-*) DPKG_ARCH=amd64 ;; + *) DPKG_ARCH=notset ;; + esac; + + DPKG_NAME="${DPKG_BASENAME}_${DPKG_VERSION}_${DPKG_ARCH}.deb" + echo ::set-output name=DPKG_NAME::${DPKG_NAME} + + # Binary + install -Dm755 "${{ steps.strip.outputs.BIN_PATH }}" "${DPKG_DIR}/usr/bin/${{ steps.strip.outputs.BIN_NAME }}" + + # Man page + install -Dm644 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/manual/rustpython.1 "${DPKG_DIR}/usr/share/man/man1/${{ env.PROJECT_NAME }}.1" + gzip -n --best "${DPKG_DIR}/usr/share/man/man1/${{ env.PROJECT_NAME }}.1" + + # Autocompletion files + install -Dm644 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/rustpython.fish "${DPKG_DIR}/usr/share/fish/vendor_completions.d/${{ env.PROJECT_NAME }}.fish" + install -Dm644 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/rustpython.zsh "${DPKG_DIR}/usr/share/zsh/vendor-completions/_${{ env.PROJECT_NAME }}" + + # README and LICENSE + install -Dm644 "README.md" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/README.md" + install -Dm644 "LICENSE-MIT" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/LICENSE-MIT" + install -Dm644 "LICENSE-APACHE" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/LICENSE-APACHE" + install -Dm644 "CHANGELOG.md" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/changelog" + gzip -n --best "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/changelog" + + cat > "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/copyright" < "${DPKG_DIR}/DEBIAN/control" < - -p rustpython-bytecode - -p rustpython-common - -p rustpython-compiler - -p rustpython-parser - -p rustpython-vm - -p rustpython-jit - -p rustpython-derive - -p rustpython - -jobs: - rust_tests: - name: Run rust tests - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [macos-latest, ubuntu-latest, windows-latest] - fail-fast: false - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - - name: Set up the Windows environment - shell: bash - run: | - choco install llvm openssl - echo "OPENSSL_DIR=C:\Program Files\OpenSSL-Win64" >>$GITHUB_ENV - if: runner.os == 'Windows' - - name: Set up the Mac environment - run: brew install autoconf automake libtool - if: runner.os == 'macOS' - - uses: Swatinem/rust-cache@v1 - - name: run rust tests - uses: actions-rs/cargo@v1 - with: - command: test - args: --verbose ${{ env.CARGO_ARGS }} ${{ env.NON_WASM_PACKAGES }} - - name: check compilation without threading - uses: actions-rs/cargo@v1 - with: - command: check - args: ${{ env.CARGO_ARGS }} --no-default-features - - exotic_targets: - name: Ensure compilation on exotic targets - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - target: aarch64-linux-android - - - name: Check compilation for android - uses: actions-rs/cargo@v1 - with: - command: check - args: --target aarch64-linux-android - - - name: Prepare repository for redox compilation - run: bash scripts/redox/uncomment-cargo.sh - - name: Check compilation for Redox - uses: coolreader18/redoxer-action@v1 - with: - command: check - - snippets_cpython: - name: Run snippets and cpython tests - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [macos-latest, ubuntu-latest, windows-latest] - fail-fast: false - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - - uses: actions/setup-python@v2 - with: - python-version: 3.8 - - name: Set up the Windows environment - shell: bash - run: | - choco install llvm openssl - echo "OPENSSL_DIR=C:\Program Files\OpenSSL-Win64" >>$GITHUB_ENV - if: runner.os == 'Windows' - - name: Set up the Mac environment - run: brew install autoconf automake libtool - if: runner.os == 'macOS' - - uses: Swatinem/rust-cache@v1 - - name: build rustpython - uses: actions-rs/cargo@v1 - with: - command: build - args: --release --verbose ${{ env.CARGO_ARGS }} - - uses: actions/setup-python@v2 - with: - python-version: 3.8 - - name: Install pipenv - run: | - python -V - python -m pip install --upgrade pip - python -m pip install pipenv - - run: pipenv install --python 3.8 - working-directory: ./extra_tests - - name: run snippets - run: pipenv run pytest -v - working-directory: ./extra_tests - - if: runner.os == 'Linux' - name: run cpython tests - run: target/release/rustpython -m test -v - - if: runner.os == 'macOS' - name: run cpython tests (macOS lightweight) - run: - target/release/rustpython -m test -v - - if: runner.os == 'Windows' - name: run cpython tests (windows partial - fixme) - run: - target/release/rustpython -m test -v -x - test_argparse test_json test_bytes test_long test_pwd test_bool test_cgi test_complex - test_exception_hierarchy test_glob test_iter test_list test_os test_pathlib - test_py_compile test_set test_shutil test_sys test_unicode test_unittest test_venv - test_zipimport test_importlib test_io - - if: runner.os == 'Linux' - name: check that --install-pip succeeds - run: | - mkdir site-packages - target/release/rustpython --install-pip -t site-packages - - lint: - name: Check Rust code with rustfmt and clippy - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - components: rustfmt - override: true - - name: run rustfmt - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check - - name: run clippy - uses: actions-rs/cargo@v1 - with: - command: clippy - args: ${{ env.CARGO_ARGS }} ${{ env.NON_WASM_PACKAGES }} -- -Dwarnings - - name: run clippy on wasm - uses: actions-rs/cargo@v1 - with: - command: clippy - args: --manifest-path=wasm/lib/Cargo.toml -- -Dwarnings - - uses: actions/setup-python@v2 - with: - python-version: 3.8 - - name: install flake8 - run: python -m pip install flake8 - - name: run lint - run: flake8 . --count --exclude=./.*,./Lib,./vm/Lib,./benches/ --select=E9,F63,F7,F82 --show-source --statistics - - name: install prettier - run: yarn global add prettier && echo "$(yarn global bin)" >>$GITHUB_PATH - - name: check wasm code with prettier - # prettier doesn't handle ignore files very well: https://github.com/prettier/prettier/issues/8506 - run: cd wasm && git ls-files -z | xargs -0 prettier --check -u - miri: - name: Run tests under miri - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: nightly - components: miri - override: true - - name: Run tests under miri - # miri-ignore-leaks because the type-object circular reference means that there will always be - # a memory leak, at least until we have proper cyclic gc - run: MIRIFLAGS='-Zmiri-ignore-leaks' cargo +nightly miri test -p rustpython-vm -- miri_test - - wasm: - name: Check the WASM package and demo - needs: rust_tests - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Cache cargo dependencies - uses: actions/cache@v2 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - target - key: ${{ runner.os }}-wasm_opt3-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-debug_opt3-${{ hashFiles('**/Cargo.lock') }} - - name: install wasm-pack - run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh - - name: install geckodriver - run: | - wget https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux32.tar.gz - mkdir geckodriver - tar -xzf geckodriver-v0.24.0-linux32.tar.gz -C geckodriver - - uses: actions/setup-python@v2 - with: - python-version: 3.8 - - name: Install pipenv - run: | - python -V - python -m pip install --upgrade pip - python -m pip install pipenv - - run: pipenv install - working-directory: ./wasm/tests - - uses: actions/setup-node@v1 - - name: run test - run: | - export PATH=$PATH:`pwd`/../../geckodriver - npm install - npm run test - working-directory: ./wasm/demo - - name: build notebook demo - if: github.ref == 'refs/heads/release' - run: | - npm install - npm run dist - mv dist ../demo/dist/notebook - working-directory: ./wasm/notebook - - name: Deploy demo to Github Pages - if: success() && github.ref == 'refs/heads/release' - uses: peaceiris/actions-gh-pages@v2 - env: - ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEMO_DEPLOY_KEY }} - PUBLISH_DIR: ./wasm/demo/dist - EXTERNAL_REPOSITORY: RustPython/demo - PUBLISH_BRANCH: master diff --git a/.github/workflows/cron-ci.yaml b/.github/workflows/cron-ci.yaml deleted file mode 100644 index 5af5c11935..0000000000 --- a/.github/workflows/cron-ci.yaml +++ /dev/null @@ -1,157 +0,0 @@ -on: - schedule: - - cron: '0 0 * * 6' - workflow_dispatch: - -name: Periodic checks/tasks - -jobs: - codecov: - name: Collect code coverage data - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: nightly - override: true - components: llvm-tools-preview - - run: sudo apt-get install lcov - - uses: actions-rs/cargo@v1 - with: - command: build - args: --release --verbose - env: - RUSTC_WRAPPER: './scripts/codecoverage-rustc-wrapper.sh' - - uses: actions/setup-python@v2 - with: - python-version: 3.8 - - name: Install pipenv - run: | - python -V - python -m pip install --upgrade pip - python -m pip install pipenv - - run: pipenv install - working-directory: ./extra_tests - - name: run snippets - run: LLVM_PROFILE_FILE="$PWD/snippet-%p.profraw" pipenv run pytest -v - working-directory: ./extra_tests - - name: run cpython tests - run: LLVM_PROFILE_FILE="$PWD/regrtest.profraw" target/release/rustpython -m test -v - env: - RUSTPYTHONPATH: ${{ github.workspace }}/Lib - - name: prepare code coverage data - run: | - rusttool() { - local tool=$1; shift; "$(rustc --print target-libdir)/../bin/llvm-$tool" "$@" - } - rusttool profdata merge extra_tests/snippet-*.profraw regrtest.profraw --output codecov.profdata - rusttool cov export --instr-profile codecov.profdata target/release/rustpython --format lcov >codecov.lcov - lcov -r codecov.lcov '/*' -o codecov.lcov - - name: upload to Codecov - uses: codecov/codecov-action@v1 - with: - file: ./codecov.lcov - - testdata: - name: Collect regression test data - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: build rustpython - uses: actions-rs/cargo@v1 - with: - command: build - args: --release --verbose - - name: collect tests data - run: cargo run --release extra_tests/jsontests.py - env: - RUSTPYTHONPATH: ${{ github.workspace }}/Lib - - name: upload tests data to the website - env: - SSHKEY: ${{ secrets.ACTIONS_TESTS_DATA_DEPLOY_KEY }} - GITHUB_ACTOR: ${{ github.actor }} - run: | - echo "$SSHKEY" >~/github_key - chmod 600 ~/github_key - export GIT_SSH_COMMAND="ssh -i ~/github_key" - - git clone git@github.com:RustPython/rustpython.github.io.git website - cd website - cp ../extra_tests/cpython_tests_results.json ./_data/regrtests_results.json - git add ./_data/regrtests_results.json - git -c user.name="Github Actions" -c user.email="actions@github.com" commit -m "Update regression test results" --author="$GITHUB_ACTOR" - git push - - whatsleft: - name: Collect what is left data - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: build rustpython - uses: actions-rs/cargo@v1 - with: - command: build - args: --release --verbose - - name: Collect what is left data - run: | - chmod +x ./whats_left.sh - ./whats_left.sh > whats_left.temp - env: - RUSTPYTHONPATH: ${{ github.workspace }}/Lib - - name: Upload data to the website - env: - SSHKEY: ${{ secrets.ACTIONS_TESTS_DATA_DEPLOY_KEY }} - GITHUB_ACTOR: ${{ github.actor }} - run: | - echo "$SSHKEY" >~/github_key - chmod 600 ~/github_key - export GIT_SSH_COMMAND="ssh -i ~/github_key" - - git clone git@github.com:RustPython/rustpython.github.io.git website - cd website - [ -f ./_data/whats_left.temp ] && cp ./_data/whats_left.temp ./_data/whats_left_lastrun.temp - cp ../whats_left.temp ./_data/whats_left.temp - git add -A - git -c user.name="Github Actions" -c user.email="actions@github.com" commit -m "Update what is left results" --author="$GITHUB_ACTOR" - git push - - benchmark: - name: Collect benchmark data - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - run: cargo install cargo-criterion - - name: build benchmarks - run: cargo build --release --benches - - name: collect execution benchmark data - run: cargo criterion --bench execution - - name: collect microbenchmarks data - run: cargo criterion --bench microbenchmarks - - name: restructure generated files - run: | - cd ./target/criterion/reports - find -type d -name cpython | xargs rm -rf - find -type d -name rustpython | xargs rm -rf - find -mindepth 2 -maxdepth 2 -name violin.svg | xargs rm -rf - find -type f -not -name violin.svg | xargs rm -rf - for file in $(find -type f -name violin.svg); do mv $file $(echo $file | sed -E "s_\./([^/]+)/([^/]+)/violin\.svg_./\1/\2.svg_"); done - find -mindepth 2 -maxdepth 2 -type d | xargs rm -rf - cd .. - mv reports/* . - rmdir reports - - name: upload benchmark data to the website - env: - SSHKEY: ${{ secrets.ACTIONS_TESTS_DATA_DEPLOY_KEY }} - run: | - echo "$SSHKEY" >~/github_key - chmod 600 ~/github_key - export GIT_SSH_COMMAND="ssh -i ~/github_key" - - git clone git@github.com:RustPython/rustpython.github.io.git website - cd website - rm -rf ./assets/criterion - cp -r ../target/criterion ./assets/criterion - git add ./assets/criterion - git -c user.name="Github Actions" -c user.email="actions@github.com" commit -m "Update benchmark results" - git push