fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1name: metrics 2on: 3 push: 4 branches: 5 - master 6 7env: 8 CARGO_INCREMENTAL: 0 9 CARGO_NET_RETRY: 10 10 RUSTFLAGS: "-D warnings -W unreachable-pub" 11 RUSTUP_MAX_RETRIES: 10 12 13jobs: 14 setup_cargo: 15 if: github.repository == 'rust-lang/rust-analyzer' 16 runs-on: ubuntu-latest 17 steps: 18 - name: Install Rust toolchain 19 run: | 20 rustup update --no-self-update stable 21 rustup component add rustfmt rust-src 22 rustup default stable 23 - name: Cache cargo 24 uses: actions/cache@v3 25 with: 26 path: | 27 ~/.cargo/bin/ 28 ~/.cargo/registry/index/ 29 ~/.cargo/registry/cache/ 30 ~/.cargo/git/db/ 31 key: ${{ runner.os }}-cargo-${{ github.sha }} 32 33 build_metrics: 34 runs-on: ubuntu-latest 35 needs: setup_cargo 36 37 steps: 38 - name: Checkout repository 39 uses: actions/checkout@v3 40 41 - name: Restore cargo cache 42 uses: actions/cache@v3 43 with: 44 path: | 45 ~/.cargo/bin/ 46 ~/.cargo/registry/index/ 47 ~/.cargo/registry/cache/ 48 ~/.cargo/git/db/ 49 key: ${{ runner.os }}-cargo-${{ github.sha }} 50 51 - name: Collect build metrics 52 run: cargo xtask metrics build 53 54 - name: Cache target 55 uses: actions/cache@v3 56 with: 57 path: target/ 58 key: ${{ runner.os }}-target-${{ github.sha }} 59 60 - name: Upload build metrics 61 uses: actions/upload-artifact@v3 62 with: 63 name: build-${{ github.sha }} 64 path: target/build.json 65 if-no-files-found: error 66 67 other_metrics: 68 strategy: 69 matrix: 70 names: [self, ripgrep-13.0.0, webrender-2022, diesel-1.4.8, hyper-0.14.18] 71 runs-on: ubuntu-latest 72 needs: [setup_cargo, build_metrics] 73 74 steps: 75 - name: Checkout repository 76 uses: actions/checkout@v3 77 78 - name: Restore cargo cache 79 uses: actions/cache@v3 80 with: 81 path: | 82 ~/.cargo/bin/ 83 ~/.cargo/registry/index/ 84 ~/.cargo/registry/cache/ 85 ~/.cargo/git/db/ 86 key: ${{ runner.os }}-cargo-${{ github.sha }} 87 88 - name: Restore target cache 89 uses: actions/cache@v3 90 with: 91 path: target/ 92 key: ${{ runner.os }}-target-${{ github.sha }} 93 94 - name: Collect metrics 95 run: cargo xtask metrics "${{ matrix.names }}" 96 97 - name: Upload metrics 98 uses: actions/upload-artifact@v3 99 with: 100 name: ${{ matrix.names }}-${{ github.sha }} 101 path: target/${{ matrix.names }}.json 102 if-no-files-found: error 103 104 generate_final_metrics: 105 runs-on: ubuntu-latest 106 needs: [build_metrics, other_metrics] 107 steps: 108 - name: Checkout repository 109 uses: actions/checkout@v3 110 111 - name: Download build metrics 112 uses: actions/download-artifact@v3 113 with: 114 name: build-${{ github.sha }} 115 116 - name: Download self metrics 117 uses: actions/download-artifact@v3 118 with: 119 name: self-${{ github.sha }} 120 121 - name: Download ripgrep-13.0.0 metrics 122 uses: actions/download-artifact@v3 123 with: 124 name: ripgrep-13.0.0-${{ github.sha }} 125 126 - name: Download webrender-2022 metrics 127 uses: actions/download-artifact@v3 128 with: 129 name: webrender-2022-${{ github.sha }} 130 131 - name: Download diesel-1.4.8 metrics 132 uses: actions/download-artifact@v3 133 with: 134 name: diesel-1.4.8-${{ github.sha }} 135 136 - name: Download hyper-0.14.18 metrics 137 uses: actions/download-artifact@v3 138 with: 139 name: hyper-0.14.18-${{ github.sha }} 140 141 - name: Combine json 142 run: | 143 git clone --depth 1 https://$METRICS_TOKEN@github.com/rust-analyzer/metrics.git 144 jq -s ".[0] * .[1] * .[2] * .[3] * .[4] * .[5]" build.json self.json ripgrep-13.0.0.json webrender-2022.json diesel-1.4.8.json hyper-0.14.18.json -c >> metrics/metrics.json 145 cd metrics 146 git add . 147 git -c user.name=Bot -c user.email=dummy@example.com commit --message 📈 148 git push origin master 149 env: 150 METRICS_TOKEN: ${{ secrets.METRICS_TOKEN }}