From bd6699faae43c3b9db3f9f07d7d4b0b74b98909b Mon Sep 17 00:00:00 2001 From: Raul Victor Trombin Date: Fri, 10 Nov 2023 15:35:37 -0300 Subject: [PATCH 1/5] github: action: docs: Move documentation from root to doc --- .github/workflows/action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index acfcb8f..24dac14 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -34,6 +34,8 @@ jobs: override: true - name: Build docs run: cargo doc + - name: Move documentation + run: mkdir -p pages/doc87 && mv target/doc/* pages/doc/ - name: Deploy uses: peaceiris/actions-gh-pages@v3 if: ${{ github.ref == 'refs/heads/master' }} From 85b8c605e5fc30471d4503aeec38b029f5114f09 Mon Sep 17 00:00:00 2001 From: Raul Victor Trombin Date: Fri, 10 Nov 2023 15:36:31 -0300 Subject: [PATCH 2/5] Cargo: Update documentation link --- .github/workflows/action.yml | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index 24dac14..4b64dce 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -35,13 +35,13 @@ jobs: - name: Build docs run: cargo doc - name: Move documentation - run: mkdir -p pages/doc87 && mv target/doc/* pages/doc/ + run: mkdir -p pages/doc && mv target/doc/* pages/doc/ - name: Deploy uses: peaceiris/actions-gh-pages@v3 if: ${{ github.ref == 'refs/heads/master' }} with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./target/doc + publish_dir: ./pages deploy: needs: build diff --git a/Cargo.toml b/Cargo.toml index 33cd24d..a64040b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ version = "0.2.0" edition = "2021" license = "MIT" description = "A Rust library for interacting with the AK09915 magnetometer" -homepage = "https://docs.bluerobotics.com/AK09915-rs/ak09915_rs" +homepage = "https://docs.bluerobotics.com/AK09915-rs/doc/ak09915_rs" documentation = "https://docs.rs/ak09915_rs" repository = "https://github.com/bluerobotics/AK09915-rs" readme = "README.md" From ad303e6afe155f9cc50861ac617b45a2d6baff3a Mon Sep 17 00:00:00 2001 From: Raul Victor Trombin Date: Fri, 10 Nov 2023 15:42:24 -0300 Subject: [PATCH 3/5] github: action: Save cache data to gh-page --- .github/workflows/action.yml | 41 ++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index 4b64dce..e0aae15 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -43,6 +43,47 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./pages + bench: + needs: build + if: ${{ github.repository_owner == 'bluerobotics' }} + runs-on: raspbian-armv7-kernel-5.10.33 + steps: + - uses: actions/checkout@master + - uses: dtolnay/rust-toolchain@stable + - name: Rust | Cache + uses: Swatinem/rust-cache@v2 + with: + prefix-key: "rust-cache" + shared-key: "benchmark" + - name: Cargo Bench + run: cargo bench --jobs 1 --bench bench -- --output-format bencher | tee output.txt + - name: Compare results & store cached results + uses: benchmark-action/github-action-benchmark@v1.18.0 + with: + tool: 'cargo' + output-file-path: output.txt + summary-always: true + alert-threshold: "110%" + fail-on-alert: true + external-data-json-path: ./cache/benchmark-data.json + skip-fetch-gh-pages: "true" + - name: Update data file + if: ${{ github.ref == 'refs/heads/master' }} + run: | + git config user.name "GitHub Actions Bot" + git config user.email "actions@github.com" + git fetch origin gh-pages + git checkout gh-pages + if [ ! -d "dev/cache" ]; then + echo "Cache folder does not exist, creating it" + mkdir -p dev/cache + fi + cp cache/benchmark-data.json dev/cache/benchmark-data.json + tree cache + git add dev/cache/benchmark-data.json + git commit -m "Update benchmark-data file" + git push origin gh-pages + deploy: needs: build runs-on: ubuntu-latest From abef9d0d70454f847d62310be5a32d1d2683a208 Mon Sep 17 00:00:00 2001 From: Raul Victor Trombin Date: Fri, 10 Nov 2023 16:02:00 -0300 Subject: [PATCH 4/5] github: action: docs: Copy and keep other folders --- .github/workflows/action.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index e0aae15..696d46b 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -36,6 +36,17 @@ jobs: run: cargo doc - name: Move documentation run: mkdir -p pages/doc && mv target/doc/* pages/doc/ + - name: Get previous benchmark data + if: ${{ github.ref == 'refs/heads/master' }} + run: | + echo "Fetching gh-pages branch" + git fetch origin gh-pages + echo "Checking out gh-pages branch" + git checkout gh-pages + echo "Copying data file from gh-pages to cache" + mkdir -p pages/dev && cp -r dev/* pages/dev/ || { echo "Failed to copy dev folder" ; exit 1; } + echo "Checking out current previous branch" + git checkout - - name: Deploy uses: peaceiris/actions-gh-pages@v3 if: ${{ github.ref == 'refs/heads/master' }} From 51a70d3b9175b267fa74d3587900f0ff1f6faf9c Mon Sep 17 00:00:00 2001 From: Raul Victor Trombin Date: Fri, 10 Nov 2023 16:03:48 -0300 Subject: [PATCH 5/5] github: action: Load cache from previous benchmarks --- .github/workflows/action.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index 696d46b..907052c 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -66,6 +66,24 @@ jobs: with: prefix-key: "rust-cache" shared-key: "benchmark" + - name: Get previous benchmark data + run: | + echo "Fetching gh-pages branch" + git fetch origin gh-pages + + echo "Checking out gh-pages branch" + git checkout gh-pages + + if [ ! -d "cache" ]; then + echo "Cache folder does not exist, creating it" + mkdir cache + fi + + echo "Copying data file from gh-pages to cache" + cp dev/cache/benchmark-data.json cache/benchmark-data.json || { echo "Failed to copy data file" ; exit 1; } + + echo "Checking out current preivous branch" + git checkout - - name: Cargo Bench run: cargo bench --jobs 1 --bench bench -- --output-format bencher | tee output.txt - name: Compare results & store cached results