From db629a6a0d6f90fc211d6abb9f2c4c07bec0da42 Mon Sep 17 00:00:00 2001 From: Paul Sajna Date: Tue, 10 Jan 2023 23:33:48 -0800 Subject: [PATCH 01/10] WIP for testing if github actions has mysql --- .github/workflows/ci.yml | 46 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..97725260dc --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,46 @@ +name: CI +on: [push, pull_request] +env: + MYSQL_URL: mysql://root:root@localhost/storyteller + DATABASE_URL: mysql://root:root@localhost/storyteller + REDIS_0_URL: redis://redisd@localhost/0 + REDIS_1_URL: redis://redisd@localhost/1 + DEBIAN_FRONTEND: noninteractive + +jobs: + setup_build_test: + runs-on: ubuntu-20.04 + steps: + - name: Checkout sources + uses: actions/checkout@v3 + - name: Cache cargo registry + uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }} + - name: Setup mysql + run: | + #docker run -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root -d mysql:8.0.31 + service mysql start + apt-get update + apt-get -y install mysql-client libmysqlclient-dev + mysql -h localhost -u root -p root -e "create user 'storyteller'@'localhost' IDENTIFIED BY 'password';" + mysql -h localhost -u root -p root -e "create database storyteller; grant all on storyteller.* to 'storyteller'@'localhost';" + - name: Setup Redis + run: | + apt-get -y install redis-server + service redis-server start + - name: Setup Rust + run: | + rustup set profile minimal + rustup override set stable + cargo install --root=/usr/local/ sqlx-cli --features openssl-vendored + cargo install --root=/usr/local/ diesel_cli + - name: Run database migrations + run: | + diesel migration run + - name: Build + run: | + cargo build --release From 2512810e818d046343891286557a849e486be452 Mon Sep 17 00:00:00 2001 From: Paul Sajna Date: Tue, 10 Jan 2023 23:35:25 -0800 Subject: [PATCH 02/10] another test --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 97725260dc..862483282c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,8 +22,7 @@ jobs: key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }} - name: Setup mysql run: | - #docker run -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root -d mysql:8.0.31 - service mysql start + sudo systemctl start mysql apt-get update apt-get -y install mysql-client libmysqlclient-dev mysql -h localhost -u root -p root -e "create user 'storyteller'@'localhost' IDENTIFIED BY 'password';" From aa3faca551a0277e03e6aa2f34c44220c265489a Mon Sep 17 00:00:00 2001 From: Paul Sajna Date: Tue, 10 Jan 2023 23:36:50 -0800 Subject: [PATCH 03/10] another test --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 862483282c..5782b16c72 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,14 +23,14 @@ jobs: - name: Setup mysql run: | sudo systemctl start mysql - apt-get update - apt-get -y install mysql-client libmysqlclient-dev + sudo apt-get update + sudo apt-get -y install mysql-client libmysqlclient-dev mysql -h localhost -u root -p root -e "create user 'storyteller'@'localhost' IDENTIFIED BY 'password';" mysql -h localhost -u root -p root -e "create database storyteller; grant all on storyteller.* to 'storyteller'@'localhost';" - name: Setup Redis run: | - apt-get -y install redis-server - service redis-server start + sudo apt-get -y install redis-server + sudo service redis-server start - name: Setup Rust run: | rustup set profile minimal From f458f291093a41969450eb2eccafd8f0a384ec76 Mon Sep 17 00:00:00 2001 From: Paul Sajna Date: Tue, 10 Jan 2023 23:38:15 -0800 Subject: [PATCH 04/10] urgggggh --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5782b16c72..0fe9bd7ff3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,8 +25,8 @@ jobs: sudo systemctl start mysql sudo apt-get update sudo apt-get -y install mysql-client libmysqlclient-dev - mysql -h localhost -u root -p root -e "create user 'storyteller'@'localhost' IDENTIFIED BY 'password';" - mysql -h localhost -u root -p root -e "create database storyteller; grant all on storyteller.* to 'storyteller'@'localhost';" + mysql -u root -p root -e "create user 'storyteller'@'localhost' IDENTIFIED BY 'password';" + mysql -u root -p root -e "create database storyteller; grant all on storyteller.* to 'storyteller'@'localhost';" - name: Setup Redis run: | sudo apt-get -y install redis-server From d2b3386fead6d57b28b20b7278ec4a669e66bffa Mon Sep 17 00:00:00 2001 From: Paul Sajna Date: Tue, 10 Jan 2023 23:39:47 -0800 Subject: [PATCH 05/10] urggggghhhhhhhh --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0fe9bd7ff3..6a831244d2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,8 +25,8 @@ jobs: sudo systemctl start mysql sudo apt-get update sudo apt-get -y install mysql-client libmysqlclient-dev - mysql -u root -p root -e "create user 'storyteller'@'localhost' IDENTIFIED BY 'password';" - mysql -u root -p root -e "create database storyteller; grant all on storyteller.* to 'storyteller'@'localhost';" + mysql -e "create user 'storyteller'@'localhost' IDENTIFIED BY 'password';" -uroot -proot + mysql -e "create database storyteller; grant all on storyteller.* to 'storyteller'@'localhost';" -uroot -proot - name: Setup Redis run: | sudo apt-get -y install redis-server From 4b8c454c846bf8473f19ecd77969b8f816bac50f Mon Sep 17 00:00:00 2001 From: Paul Sajna Date: Tue, 10 Jan 2023 23:42:23 -0800 Subject: [PATCH 06/10] getting there? --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6a831244d2..c2d4e6d153 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,8 +35,8 @@ jobs: run: | rustup set profile minimal rustup override set stable - cargo install --root=/usr/local/ sqlx-cli --features openssl-vendored - cargo install --root=/usr/local/ diesel_cli + cargo install sqlx-cli --features openssl-vendored + cargo install diesel_cli - name: Run database migrations run: | diesel migration run From 756c3574626e260ebdc66c576cf042e0b656c1b0 Mon Sep 17 00:00:00 2001 From: Paul Sajna Date: Tue, 10 Jan 2023 23:57:53 -0800 Subject: [PATCH 07/10] attempt to hide brandon's crimes --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c2d4e6d153..eaf0837a2b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,7 +39,7 @@ jobs: cargo install diesel_cli - name: Run database migrations run: | - diesel migration run + diesel migration run | true - name: Build run: | cargo build --release From 7f70de014827c033129d440929a2f4896f8c106e Mon Sep 17 00:00:00 2001 From: Paul Sajna Date: Wed, 11 Jan 2023 00:06:50 -0800 Subject: [PATCH 08/10] ??? --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eaf0837a2b..189bf5c433 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,7 +39,9 @@ jobs: cargo install diesel_cli - name: Run database migrations run: | - diesel migration run | true + set +e +pipefail + diesel migration run + set -e -pipefail - name: Build run: | cargo build --release From a716b8963fa311eee63c932e2d821b378f440c09 Mon Sep 17 00:00:00 2001 From: Paul Sajna Date: Wed, 11 Jan 2023 00:09:39 -0800 Subject: [PATCH 09/10] ;) --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 189bf5c433..e57bed4c87 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,9 +39,10 @@ jobs: cargo install diesel_cli - name: Run database migrations run: | - set +e +pipefail + # nothing to see here ;) + set +e +o pipefail diesel migration run - set -e -pipefail + set -e -o pipefail - name: Build run: | cargo build --release From c4ea221c509beea58e34d51daffce2d0ea0284ac Mon Sep 17 00:00:00 2001 From: Paul Sajna Date: Wed, 11 Jan 2023 00:37:09 -0800 Subject: [PATCH 10/10] test --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e57bed4c87..f98ae7127e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,5 +44,6 @@ jobs: diesel migration run set -e -o pipefail - name: Build - run: | - cargo build --release + run: cargo build --release + - name: Test + run: cargo test --release