Metrics #1065
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
schedule: | |
- cron: "23 03 * * *" | |
push: | |
branches: | |
- try_to_fix_metrics_job | |
name: Metrics | |
env: | |
CARGO_INCREMENTAL: 0 | |
CARGO_NET_RETRY: 10 | |
RUSTUP_MAX_RETRIES: 10 | |
jobs: | |
metrics: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
backend: ["postgres", "sqlite", "mysql"] | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
key: metrics-${{matrix.backend}}-cargo-${{ hashFiles('diesel_bench/Cargo.toml')}} | |
- name: Install postgres (Linux) | |
if: matrix.backend == 'postgres' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libpq-dev postgresql | |
echo "host all all 127.0.0.1/32 md5" > sudo tee -a /etc/postgresql/10/main/pg_hba.conf | |
sudo service postgresql restart && sleep 3 | |
sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'postgres';" | |
sudo service postgresql restart && sleep 3 | |
echo 'DATABASE_URL=postgres://postgres:postgres@localhost/' >> $GITHUB_ENV | |
- name: Install sqlite (Linux) | |
if: matrix.backend == 'sqlite' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libsqlite3-dev | |
echo 'SQLITE_DATABASE_URL=/tmp/test.db' >> $GITHUB_ENV | |
echo 'DATABASE_URL=sqlite:///tmp/test.db' >> $GITHUB_ENV | |
- name: Install mysql (Linux) | |
if: matrix.backend == 'mysql' | |
run: | | |
sudo systemctl start mysql.service | |
sudo apt-get update | |
sudo apt-get -y install libmysqlclient-dev | |
mysql -e "create database diesel_test; create database diesel_unit_test; grant all on \`diesel_%\`.* to 'root'@'localhost';" -uroot -proot | |
echo 'DATABASE_URL=mysql://root:root@localhost/diesel_test' >> $GITHUB_ENV | |
- name: Install rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- name: Run Benchmarks (Postgres) | |
if: matrix.backend == 'postgres' | |
run: cargo +stable bench --manifest-path diesel_bench/Cargo.toml --no-default-features --features "postgres sqlx-bench sqlx/postgres rust_postgres futures sea-orm sea-orm/sqlx-postgres criterion/async_tokio quaint quaint/postgresql quaint/serde-support serde diesel-async diesel-async/postgres wtx" | |
- name: Run Benchmarks (Sqlite) | |
if: matrix.backend == 'sqlite' | |
run: cargo +stable bench --manifest-path diesel_bench/Cargo.toml --no-default-features --features "sqlite sqlx-bench sqlx/sqlite tokio rusqlite futures sea-orm sea-orm/sqlx-sqlite criterion/async_tokio" | |
- name: Run Benchmarks (Mysql) | |
if: matrix.backend == 'mysql' | |
run: cargo +stable bench --manifest-path diesel_bench/Cargo.toml --no-default-features --features "mysql sqlx-bench sqlx/mysql tokio rustorm rustorm/with-mysql rustorm_dao rust_mysql futures sea-orm sea-orm/sqlx-mysql criterion/async_tokio quaint quaint/mysql quaint/serde-support serde diesel-async diesel-async/mysql" | |
- name: Push metrics | |
env: | |
SSH_AUTH_SOCK: /tmp/ssh_agent.sock | |
run: | | |
sudo apt-get -y install git | |
mkdir ~/.ssh -p | |
ssh-agent -a $SSH_AUTH_SOCK > /dev/null | |
ssh-keyscan github.com >> ~/.ssh/known_hosts | |
echo "${{ secrets.METRIC_ACCESS_KEY }}" >> ~/.ssh/id_ed25519 | |
chmod 600 ~/.ssh/id_ed25519 | |
df -h | |
rm diesel_bench/target/release -rf | |
# delete unwanted files from criterion | |
find diesel_bench/target/criterion/ -iname '*.json' -delete | |
find diesel_bench/target/criterion/ -type d -name "base" -exec rm -rv {} \; || true | |
find diesel_bench/target/criterion/ -type d -empty -delete | |
# free some space on the runner | |
df -h | |
sudo rm -rf /usr/share/dotnet | |
df -h | |
sudo rm -rf /opt/ghc | |
df -h | |
sudo rm -rf "/usr/local/share/boost" | |
df -h | |
sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
df -h | |
pwd | |
git clone --depth 1 [email protected]:diesel-rs/metrics.git | |
df -h | |
cd metrics | |
export FOLDER_NAME=$(date +%Y%m%d-%H%M%S) | |
mkdir -p metrics/$FOLDER_NAME-$GITHUB_SHA-${{matrix.backend}} | |
mv ../diesel_bench/target/criterion/* metrics/$FOLDER_NAME-$GITHUB_SHA-${{matrix.backend}} | |
git add metrics/$FOLDER_NAME-$GITHUB_SHA-${{matrix.backend}} | |
git -c user.name=Bot -c [email protected] commit --message "📈" | |
git push origin master | |
- name: cleanup | |
if: always() | |
env: | |
SSH_AUTH_SOCK: /tmp/ssh_agent.sock | |
run: | | |
rm -rf diesel_bench/target/criterion | |
ssh-add -D | |
rm -Rf ~/.ssh |