Skip to content

Commit

Permalink
[ci] Fix agdb_ci not updating all versions #1238 (#1239)
Browse files Browse the repository at this point in the history
* fix version

* update logic

* remove agdb_ci tests

* update

* fix
  • Loading branch information
michaelvlach authored Sep 5, 2024
1 parent 19f7ca1 commit 10a297f
Show file tree
Hide file tree
Showing 209 changed files with 1,035 additions and 1,300 deletions.
16 changes: 3 additions & 13 deletions .github/workflows/agdb_ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,6 @@ jobs:
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo clippy --package agdb_ci --all-targets --all-features -- -D warnings

agdb_ci_coverage:
runs-on: ubuntu-latest
needs: diff
if: needs.diff.outputs.diff == 'true'
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: taiki-e/install-action@cargo-llvm-cov
- run: rustup component add llvm-tools-preview
- run: cargo llvm-cov --package agdb_ci --all-features --fail-uncovered-functions 0 --fail-uncovered-lines 0 --show-missing-lines

agdb_ci_format:
runs-on: ubuntu-latest
needs: diff
Expand All @@ -53,8 +42,9 @@ jobs:
if: needs.diff.outputs.diff == 'true'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: |
cargo run --release --package agdb_ci
git diff --name-only
if [[ "$(git diff --name-only)" != "" ]]; then echo "ERROR: Version changed but some packages have not been updated. Have you forgotten to run agdb_ci?"; exit 1; fi
if [[ "$(git diff --name-only)" != "" ]]; then git diff; git diff --name-only; echo "ERROR: Some packages have not been updated. Have you forgotten to run agdb_ci?"; exit 1; fi
2 changes: 1 addition & 1 deletion .github/workflows/agdb_server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: threshold=10; count=0; while cargo test --release --package agdb_server &> test.log && [[ "$count" != "$threshold" ]]; do count=$((count+1)); echo -n "."; done; cat test.log; echo "$count of $threshold tests run"
- run: threshold=2; count=0; while cargo test --release --package agdb_server &> test.log && [[ "$count" != "$threshold" ]]; do count=$((count+1)); echo -n "."; done; cat test.log; echo "$count of $threshold tests run"

agdb_server_format:
runs-on: ubuntu-latest
Expand Down
12 changes: 6 additions & 6 deletions agdb_api/php/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,18 @@ require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: Token
$config = Agnesoft\\AgdbApi\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$config = Agnesoft\AgdbApi\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Agnesoft\\AgdbApi\Api\AgdbApi(
$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$owner = 'owner_example'; // string | user name
$db = 'db_example'; // string | db name
$db_type = new \Agnesoft\\AgdbApi\Model\DbType(); // DbType
$db_type = new \Agnesoft\AgdbApi\Model\DbType(); // DbType

try {
$apiInstance->adminDbAdd($owner, $db, $db_type);
Expand Down Expand Up @@ -96,6 +96,7 @@ Class | Method | HTTP request | Description
*AgdbApi* | [**adminUserChangePassword**](docs/Api/AgdbApi.md#adminuserchangepassword) | **PUT** /api/v1/admin/user/{username}/change_password |
*AgdbApi* | [**adminUserList**](docs/Api/AgdbApi.md#adminuserlist) | **GET** /api/v1/admin/user/list |
*AgdbApi* | [**adminUserRemove**](docs/Api/AgdbApi.md#adminuserremove) | **DELETE** /api/v1/admin/user/{username}/remove |
*AgdbApi* | [**clusterStatus**](docs/Api/AgdbApi.md#clusterstatus) | **GET** /api/v1/cluster/status |
*AgdbApi* | [**dbAdd**](docs/Api/AgdbApi.md#dbadd) | **POST** /api/v1/db/{owner}/{db}/add |
*AgdbApi* | [**dbAudit**](docs/Api/AgdbApi.md#dbaudit) | **GET** /api/v1/db/{owner}/{db}/audit |
*AgdbApi* | [**dbBackup**](docs/Api/AgdbApi.md#dbbackup) | **POST** /api/v1/db/{owner}/{db}/backup |
Expand Down Expand Up @@ -209,7 +210,6 @@ Class | Method | HTTP request | Description
- [ServerDatabase](docs/Model/ServerDatabase.md)
- [ServerDatabaseRename](docs/Model/ServerDatabaseRename.md)
- [ServerDatabaseResource](docs/Model/ServerDatabaseResource.md)
- [StatusParams](docs/Model/StatusParams.md)
- [UserCredentials](docs/Model/UserCredentials.md)
- [UserLogin](docs/Model/UserLogin.md)
- [UserStatus](docs/Model/UserStatus.md)
Expand Down Expand Up @@ -238,7 +238,7 @@ vendor/bin/phpunit

This PHP package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:

- API version: `0.8.0`
- API version: `0.8.1`
- Package version: `0.7.2`
- Generator version: `7.7.0`
- Generator version: `7.8.0`
- Build package: `org.openapitools.codegen.languages.PhpClientCodegen`
45 changes: 29 additions & 16 deletions agdb_api/php/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ address: localhost:3000
basepath: \"\"
admin: admin
data_dir: agdb_server_data
cluster_token: test
cluster: []" > agdb_server.yaml

cargo build --release -p agdb_server
Expand Down Expand Up @@ -71,18 +72,35 @@ function format() {
npx prettier --plugin '@prettier/plugin-php' $1 src tests
}

function generate_api() {
function openapi() {
rm -rf lib/
rm -rf docs/

if [[ "$OSTYPE" == "msys" ]]; then
local package="Agnesoft\AgdbApi"
else
local package="Agnesoft\\\\AgdbApi"
fi

echo "PACKAGE: $package"

npx @openapitools/openapi-generator-cli generate \
-i ../../agdb_server/openapi/schema.json \
-i ../../agdb_server/openapi.json \
-g php \
-o ./ \
--additional-properties=invokerPackage="Agnesoft\AgdbApi",artifactVersion=0.7.2
for f in $(find lib/ -name '*.php'); do sed -i -e 's/Agnesoft\\\\AgdbApi/Agnesoft\\AgdbApi/g' $f; done
--additional-properties=invokerPackage=$package,artifactVersion=0.7.2

if [[ "$OSTYPE" == "msys" ]]; then
for f in $(find lib/ -name '*.*'); do sed -i -e 's~Agnesoft\\\\Agdb~Agnesoft\\Agdb~g' $f; done
for f in $(find docs/ -name '*.*'); do sed -i -e 's~Agnesoft\\\\Agdb~Agnesoft\\Agdb~g' $f; done
sed -i -e 's~Agnesoft\\\\Agdb~Agnesoft\\Agdb~g' README.md
fi

echo "Y" | composer dump-autoload -o
}

function generate_tests() {
node query_test_generator.js && prettier --plugin '@prettier/plugin-php' --write tests/QueryTest.php
function test_queries() {
node query_test_generator.js && npx prettier --plugin '@prettier/plugin-php' --write tests/QueryTest.php
}

if [[ "$1" == "coverage" ]]; then
Expand All @@ -93,16 +111,11 @@ elif [[ "$1" == "format" ]]; then
format "--write"
elif [[ "$1" == "format:check" ]]; then
format "--check"
elif [[ "$1" == "generate" ]]; then
if [[ "$2" == "api" ]]; then
generate_api
elif [[ "$2" == "tests" ]]; then
generate_tests
else
echo "Usage: $0 generate [api|tests]"
exit 1
fi
elif [[ "$1" == "openapi" ]]; then
openapi
elif [[ "$1" == "test_queries" ]]; then
test_queries
else
echo "Usage: $0 [coverage|analysis|format|format:check|generate api|generate tests]"
echo "Usage: $0 [coverage|analysis|format|format:check|openapi|test_queries]"
exit 1
fi
Loading

0 comments on commit 10a297f

Please sign in to comment.