Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge refring's fork #1

Open
wants to merge 202 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
202 commits
Select commit Hold shift + click to select a range
387d0bc
Initial commit
refring Aug 30, 2023
afffb46
Added add_aux_pow method
refring Aug 30, 2023
f27e629
Added type hints for arrays with int and string values
refring Aug 30, 2023
eafd6b2
Added DaemonRpcClient and RegtestRpcClient
refring Aug 30, 2023
c7785bb
Added all methods to WalletRpcClient
refring Aug 30, 2023
1d3a451
Converted files to PSR-12
refring Aug 30, 2023
96445dd
Changed parameter for onGetBlockHash to an int instead of array
refring Aug 31, 2023
1f019b0
Added the following exceptions: InvalidAddressException, InvalidBlock…
refring Sep 1, 2023
9b63109
Added __toString for StringResultTrait
refring Sep 1, 2023
288f8ea
Started writing integration tests for an empty blockchain
refring Sep 1, 2023
5e3ef03
Make sure that GetBlockHeadersRangeResponse::headers is serialized to…
refring Sep 3, 2023
5a1c18c
Added error code matching based on partial string matching
refring Sep 3, 2023
b2166e8
Added more tests to EmptyBlockchainTest
refring Sep 3, 2023
a0993f7
Added AddressHelper class for tests
refring Sep 3, 2023
4f60fcc
Added monero-integrations/monerophp dev dependency, it will be used i…
refring Sep 7, 2023
4b00573
Use an own fork of monerophp which fixed mnemonic autoloading issues
refring Sep 7, 2023
0ea70b8
Refactored AddressHelper to TestHelper and updated monerorpc so that …
refring Sep 7, 2023
deb6280
Added BlockNotAcceptedException and InvalidBlockTemplateBlobException…
refring Sep 7, 2023
56bdc97
Added NonEmptyBlockchainTest integration test
refring Sep 7, 2023
c75ba01
Fixed tests in DaemonRpcDeserializationTest for get_block and submit_…
refring Sep 8, 2023
85af519
Added ResponseStatus enum
refring Sep 8, 2023
96fa7cd
Added HexDifficulty to GetMinerDataResponse
refring Sep 8, 2023
0efb780
All DaemonRpcDeserializationTest are succeeding now
refring Sep 8, 2023
3d22d7b
Made GetBlockRequest more concise by supporting BlockHash OR BlockHei…
refring Sep 8, 2023
eaea495
Made all DaemonRpcSerializationTest tests succeed
refring Sep 8, 2023
ce9fbd8
Made all WalletRpcSerializationTest tests succeed
refring Sep 8, 2023
6b1d338
Fixed all failing tests
refring Sep 8, 2023
a10a617
Added github actions config for tests
refring Sep 8, 2023
5c72849
Added tests for github actions
refring Sep 8, 2023
8e6c9b5
Ran pint and added pint test to github actions
refring Sep 8, 2023
2bc50c3
Fixed GetTransferByTxidResponse unused imports
refring Sep 8, 2023
f985127
Removed some obsolete generated classes
refring Sep 8, 2023
a6f2719
Added documentation to WalletRpcClient and DaemonRpcClient methods an…
refring Sep 10, 2023
eaeaa55
Made phpstan checks pass on level 'max' and github action config for …
refring Sep 10, 2023
7bf3b1c
Added support for rpc authentication with integration tests included
refring Sep 10, 2023
c873ef8
Added README.md
refring Sep 11, 2023
88084b0
Added linting of files and moved formatting test to lint.yml
refring Sep 11, 2023
151fabd
Changed tests to also generate code coverage
refring Sep 11, 2023
32f1f8f
Updated the README.md
refring Sep 11, 2023
071ece6
Use the BlockHash type for the blockhashes in the Chain class
refring Sep 11, 2023
9c44216
Renamed KeyImage to SignedKeyImage
refring Sep 11, 2023
fd45b4d
Only run lint, phpstan and phpunit tests with composer:test
refring Sep 11, 2023
1625c8e
Added WalletExistsException
refring Sep 11, 2023
dac1019
Added InvalidLanguageException
refring Sep 11, 2023
43abbab
Added some tests to BasicWalletTest
refring Sep 11, 2023
347c74c
Introduced Address class, which for now is just a string
refring Sep 12, 2023
eb7111c
Enabled php-http/discovery, added information on how to use different…
refring Sep 13, 2023
607b361
Added a test for connection failure
refring Sep 13, 2023
7f807e2
Replaced all occurrences of string addresses with the Address class f…
refring Sep 13, 2023
fcc4337
Added sockets to tests extensions
refring Sep 13, 2023
fb4d5d9
Ran rector with PHP_81 ruleset
refring Sep 13, 2023
0a6b080
Ran rector with CODING_STYLE ruleset and added failOnDeprecation to p…
refring Sep 13, 2023
e6818ef
Fixed method signatures which had "Optional parameter declared before…
refring Sep 13, 2023
8574c98
Use symfony/http-client for tests
refring Sep 13, 2023
dec3603
Added NoWalletFileException and tests for WalletRpcClient::closeWallet()
refring Sep 13, 2023
4ea984c
Added OpenWalletException and tests for WalletRpcClient::openWallet()
refring Sep 13, 2023
d62209d
Added pint.json
refring Sep 13, 2023
505f0ec
Added strict_types=1 to all files using pint
refring Sep 13, 2023
8e95138
Fixed TestHelper::getRandomWalletName() which broke after adding stri…
refring Sep 13, 2023
5927836
Some changes to the README and CHANGELOG
refring Sep 13, 2023
5b576eb
Updated the README and composer description a bit
refring Sep 13, 2023
3b55e08
Renamed Transfer to IncomingTransfer, and TransferType to IncomingTra…
refring Sep 14, 2023
1fb9f04
Added Transfer and TransferType for GetTransfersResponse, fixed seria…
refring Sep 14, 2023
0346451
Fixed GetBalanceResponse::perSubaddress serialization
refring Sep 14, 2023
372c649
Fixed serialization for GetAddressResponse::addresses
refring Sep 14, 2023
c9161c0
Changed wallet Response classes according to the current wallet_rpc_s…
refring Sep 14, 2023
25a957e
Changed daemon Response classes according to the current core_rpc_ser…
refring Sep 15, 2023
688e33d
Let WalletRpcClient:transfer() accept a single Recipient
refring Sep 15, 2023
1a675bf
Added namespace to README examples and removed finished roadmap items
refring Sep 15, 2023
7e1ba50
Updated CHANGELOG
refring Sep 15, 2023
7aa9b07
Added KeyPairHelper
refring Sep 16, 2023
f9a1d33
Added AddressIndexOutOfBoundException and AttributeNotFoundException
refring Sep 16, 2023
90c13f2
Added some tests to BasicWalletTest
refring Sep 16, 2023
1a31354
Added displayDetailsOnTestsThatTriggerDeprecations=true to phpunit co…
refring Sep 16, 2023
9dc8ce0
Updated monerophp to solve deprecation notices
refring Sep 17, 2023
943a1b5
Let WalletRpcClient::validateAddress() allow an string (openalias add…
refring Sep 17, 2023
d406015
Added TagNotFoundException
refring Sep 17, 2023
b8db6d5
Added tests to BasicWalletTest
refring Sep 17, 2023
3804f72
Added some more tests to BasicWalletTest
refring Sep 17, 2023
310378d
Added tests for makeUri and parseUri methods
refring Sep 17, 2023
f0f0234
Make tests run against monerod 0.18.1.2 and php 8.3
refring Sep 18, 2023
f779d8a
Implemented /pop_blocks method
refring Sep 19, 2023
31c41c6
Implemented /pop_blocks method and added a test
refring Sep 19, 2023
938b905
Implemented /get_net_stats method and added a test
refring Sep 19, 2023
0bc97a7
Cleaned up some code related to the 'other' daemon methods
refring Sep 20, 2023
21361f4
Renamed Builder to ClientBuilder
refring Sep 20, 2023
30ab730
Introduced support for injecting a psr/log compatible logger to log t…
refring Sep 20, 2023
7a5e6cb
Added RpcClientType::DAEMON_OTHER
refring Sep 20, 2023
8296e90
Removed monolog package
refring Sep 20, 2023
1569ce8
Updated CHANGELOG.md
refring Sep 20, 2023
aa4dcd5
Updated dependencies
refring Sep 20, 2023
456e77f
Use the LoggerAwareTrait in ClientBuilder
refring Sep 20, 2023
9e962fb
Added EmptyOtherRpcRequest trait and changed GetNetStatsRequest to us…
refring Sep 20, 2023
f04cb6b
Added DaemonOtherClient::getHeight()
refring Sep 20, 2023
a4d6abc
Removed irrelevant newlines from DaemonRpc classes
refring Sep 25, 2023
5551177
Various (mostly) cosmetic fixes:
refring Sep 25, 2023
b4e98ea
Added IndexOutOfRangeException
refring Sep 25, 2023
05c8cb0
Added integration tests for address_book methods, also removed the pa…
refring Sep 25, 2023
9608cdc
ClientBuilder: Made build() private and added buildRegtestClient()
refring Sep 26, 2023
ea2f27b
PhpUnit: Make sure EmptyBlockchainTest runs first
refring Sep 26, 2023
065042a
Tests: Use mnemonics instead of private spend keys for the tests
refring Sep 26, 2023
0bf7721
Tests: rollback the chain after running NonEmptyBlockchainTest
refring Sep 26, 2023
78f3124
Added .dependabot.yml
refring Sep 26, 2023
d863104
Added security.yml Github Action, which uses 'symfonycorp/security-ch…
refring Sep 26, 2023
55d532f
Tests: Make sure the gmp extension is loaded for the tests since mone…
refring Sep 26, 2023
57fc139
Renamed .dependabot.yml to dependabot.yml
refring Sep 26, 2023
200c23e
Bump actions/checkout from 3 to 4
dependabot[bot] Sep 26, 2023
735eec2
Bump rector/rector from 0.16.0 to 0.18.4
dependabot[bot] Sep 26, 2023
bcb34b6
Bump actions/cache from 1 to 3
dependabot[bot] Sep 26, 2023
109396e
Bump symfonycorp/security-checker-action from 4 to 5
dependabot[bot] Sep 26, 2023
adbb608
Bump psr/http-client from 1.0.2 to 1.0.3
dependabot[bot] Sep 26, 2023
4231aa9
Added (de)serialization tests for AddAuxPow and made AddAuxPowRespons…
refring Sep 26, 2023
bd8b996
Added serialization tests for SweepSingleRequest
refring Sep 26, 2023
47aebda
Added InvalidPaymentIdException
refring Sep 26, 2023
4e9db38
Tests: Added tests for WalletRpcClient::makeIntegratedAddress() and W…
refring Sep 26, 2023
b0c5bd8
Added InvalidOriginalPasswordException
refring Sep 27, 2023
87249f6
Tests: Added tests for WalletRpcClient::changeWalletPassword(), Tests…
refring Sep 27, 2023
6c10d12
Removed the DaemonOtherClient and RegtestRpcClient classes to make th…
refring Sep 28, 2023
46a1e67
Updated CHANGELOG.md for v0.6
refring Sep 28, 2023
8b84663
Added InvalidDestinationException
refring Sep 29, 2023
fc87562
Added TransferType::BLOCK
refring Sep 29, 2023
bfb2faa
Set default ringsize to 16 for WalletRpcClient::transfer()
refring Sep 29, 2023
b25b879
Added TransferTest
refring Sep 29, 2023
02e61e3
Added GITHUB_TOKEN for shivammathur/setup-php to solve intermittent r…
refring Sep 29, 2023
0cb7ded
Bugfix: Make sure to reset JsonRpcClient::endPointPath after calling …
refring Oct 1, 2023
72cf919
Added REGTEST/fakechain nettype
refring Oct 1, 2023
f3e03b7
Make sure Transfer::destinations is properly serialized
refring Oct 1, 2023
19c63d7
WalletRpcClient::getBalance() now uses accountIndex 0 be default
refring Oct 1, 2023
325513b
Added some more tests to TransferTest and some small updates to README
refring Oct 1, 2023
0917501
Give the properties in GetTransfersResponse a default value so the le…
refring Oct 1, 2023
fa86b2b
Added ResponseStatus::FAILED
refring Oct 1, 2023
8a0cee2
Added DaemonRpcClient::sendRawTransaction()
refring Oct 1, 2023
d02326b
Added some more tests to TransferTest
refring Oct 1, 2023
ff2efe9
Added unit test classes DaemonOtherDeserializationTest and DaemonOthe…
refring Oct 3, 2023
917d3e8
Added missing fields to SendRawTransactionResponse and added serializ…
refring Oct 3, 2023
186d142
Added DaemonRpcClient::getAltBlocksHashes()
refring Oct 3, 2023
5090c23
Added DaemonRpcClient::isKeyImageSpent()
refring Oct 3, 2023
2dbbea7
Added DaemonRpcClient::startMining()
refring Oct 3, 2023
59c06e8
Added DaemonRpcClient::stopMining()
refring Oct 3, 2023
b6a19e1
Added DaemonRpcClient::miningStatus()
refring Oct 3, 2023
6e32db2
Added a helper method for all the json_encode(json_decode()) calls
refring Oct 3, 2023
77e8997
Use own fork of pjson dependency which supports arrays of backend enu…
refring Oct 4, 2023
2af9f67
Added SpentStatus enum and use it in IsKeyImageSpentResponse
refring Oct 4, 2023
1049990
Added DaemonRpcClient::saveBlockchain()
refring Oct 4, 2023
f325c82
Added DaemonRpcClient::setLogHashRate()
refring Oct 4, 2023
4e97ad8
Added DaemonRpcClient::setLogLevel()
refring Oct 4, 2023
c7abd67
Added DaemonRpcClient::setLogCategories()
refring Oct 4, 2023
5efc4c0
Added missing methods to README
refring Oct 4, 2023
30fc606
Added DaemonRpcClient::setLimit()
refring Oct 4, 2023
b7136e6
Added DaemonRpcClient::getLimit()
refring Oct 4, 2023
1f5c102
Added DaemonRpcClient::outPeers()
refring Oct 4, 2023
ce79efb
Added DaemonRpcClient::inPeers()
refring Oct 4, 2023
05ffd44
Renamed PeerStructure class to SyncPeer
refring Oct 4, 2023
7730660
Added BigInt class
refring Oct 4, 2023
518d1c9
Added Peer class
refring Oct 4, 2023
4ec3a09
Added DaemonRpcClient::getPeerList()
refring Oct 4, 2023
064f045
Use flag JSON_BIGINT_AS_STRING in JsonRpcClient::handleRequest()
refring Oct 4, 2023
dc42a12
Added DaemonRpcClient::update()
refring Oct 4, 2023
8f013ed
Added DaemonRpcClient::setBootstrapDaemon()
refring Oct 5, 2023
5f68223
BigInt::getValue() can return a int or string
refring Oct 5, 2023
c7b2a05
Added DaemonRpcAccessResponseFields and DaemonStandardResponseFields …
refring Oct 5, 2023
40fac0b
Replaced DaemonBaseResponse with DaemonStandardResponseFields and Rpc…
refring Oct 5, 2023
e93dbf7
Renamed GetLastBlockHeaderBaseResponse to GetLastBlockHeaderResponse
refring Oct 5, 2023
4f814cb
Added Amount class
refring Oct 5, 2023
e73eb96
Renamed Recipient to Destination and it now requires an Amount instea…
refring Oct 5, 2023
98b69c8
Replaced int values for amounts with Amount and introduced JsonSerial…
refring Oct 5, 2023
fcf6d7b
RpcRequest no longer checks if $parameters is empty when serialized, …
refring Oct 5, 2023
e07c299
Cleaned up some comments on some off the WalletRpc classes
refring Oct 6, 2023
05b0727
Updated square/pjson to an own fork that supports a custom trait whic…
refring Oct 6, 2023
40d1692
Replaced JsonSerialize with JsonSerializeBigInt trait, which outputs …
refring Oct 6, 2023
b54f788
WalletRpcClient::getTransfers() will now return all types of transfer…
refring Oct 7, 2023
571e548
Use Amount instead of int for piconeros in the following classes:
refring Oct 8, 2023
a6f3f33
Updated tests to use Amount class where needed
refring Oct 8, 2023
9971547
Added JsonSerializeBigInt
refring Oct 8, 2023
064bee1
Made RpcRequest::parameters public, so it can be accessed by BigIntPr…
refring Oct 8, 2023
3fe1a45
Added DaemonRpcClient::getTransactionPoolStats()
refring Oct 8, 2023
07e7bef
Added DaemonRpcClient::getOuts()
refring Oct 11, 2023
84a519c
Initialize response and model class array properties with an empty array
refring Oct 11, 2023
98b469f
Make classes implement JsonDataSerializable so that we don't have to …
refring Oct 11, 2023
4b11d86
Added DaemonRpcClient::getTransactions()
refring Oct 11, 2023
f1387c1
Added DaemonRpcClient::stopDaemon()
refring Oct 11, 2023
6e72090
JsonSerializeBigInt: adjusted regex so that it also works for json st…
refring Oct 11, 2023
8c7bc18
Added DaemonRpcClient::getTransactionPool()
refring Oct 11, 2023
0ecddb4
Updated package name to refring/monero-rpc-php
refring Oct 11, 2023
88644f5
Restructured 'model' class namespaces and put most of them in wallet/…
refring Oct 12, 2023
13b0f30
Used BlockHash in more places
refring Oct 12, 2023
3ebab3d
README: Added another example and removed warning about the API
refring Oct 12, 2023
8358768
WalletRpcClient: Made $accountIndex optional for some methods and set…
refring Oct 12, 2023
99678c2
Updated README and CHANGELOG
refring Oct 13, 2023
974244a
Added note about composer minumum-stability dev, this is needed becau…
refring Oct 13, 2023
1c2c34a
Changed containers to refring/monero-containers and updated to monero…
refring Oct 13, 2023
19caf09
Updated square/pjson to 0.4.0 and ran composer update
refring Nov 2, 2023
350d081
No longer needed to set minimum-stability to dev so removed it from t…
refring Nov 2, 2023
1d35ddf
Removed print_r() statement from test
refring Nov 2, 2023
0163cf9
Require ext-bcmath in composer.json and updated dependencies
refring Nov 29, 2023
f8030f6
Accept a TransferPriority enum for the priority param in the sweepAll…
refring Feb 21, 2024
37ddfda
Require ctype php extension for github actions phpunit tests
refring Feb 21, 2024
631cae0
Bump codecov/codecov-action from 3 to 4
dependabot[bot] Feb 5, 2024
0b44bc1
Bump actions/cache from 3 to 4
dependabot[bot] Jan 22, 2024
0aee26c
feat: fork and change namespace, docs, workflows
recanman Jun 3, 2024
935255a
feat: fork and change namespace, docs, workflows
recanman Jun 3, 2024
bb8e695
fix: change branch name
recanman Jun 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
; This file is for unifying the coding style for different editors and IDEs.
; More information at http://editorconfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.yml]
indent_size = 2
51 changes: 51 additions & 0 deletions .github/workflows/phpcbf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Run PHP CodeSniffer

# Run PHPCBF to fix changes then annotate PHPCS
# NB: Pull requests from forks do not have access to repository secrets so cannot commit changes.

on:
push:
branches:
- main

jobs:
php-codesniffer:
runs-on: ubuntu-latest

permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write

strategy:
matrix:
php: [ '8.0' ]

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer, cs2pr
extensions: zip

- name: Run composer install
continue-on-error: true
run: composer install

- name: Run PHPCBF to fix what it can
continue-on-error: true
run: vendor/bin/phpcbf

- name: Run PHPCS to add annotations to the code
continue-on-error: true
run: vendor/bin/phpcs -q -n --report=checkstyle | cs2pr

- name: Commit PHPCBF changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "chore: run PHPCBF [skip ci]"

62 changes: 62 additions & 0 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Run PHPStan

# Run PHPStan to annotate the code

on:
push:
branches:
- main

jobs:
phpstan:
runs-on: ubuntu-latest

strategy:
matrix:
php: [ '8.0' ]

permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer, cs2pr
extensions: zip

- name: Run composer install
continue-on-error: true
run: composer install

- name: Run PHPStan to add annotations to the code
id: run-phpstan
continue-on-error: true
run: |
vendor/bin/phpstan analyse -c phpstan.neon --memory-limit 1G --no-progress --error-format=checkstyle | cs2pr

- name: Get PhpStan level
id: phpstan-level
run: |
LEVEL=$(cat phpstan.neon | grep level | sed "s/[^0-9]*//")
echo "level=$LEVEL" >> "$GITHUB_OUTPUT"

- name: Check success
if: steps.run-phpstan.outcome == 'success'
run: curl -o .github/phpstan.svg https://img.shields.io/badge/PHPStan-Level%20${{ steps.phpstan-level.outputs.level}}-2a5ea7.svg

- name: Check failures
if: steps.run-phpstan.outcome != 'success'
run: curl -o .github/phpstan.svg https://img.shields.io/badge/PHPStan-Level%20${{ steps.phpstan-level.outputs.level}}❌-lightgrey.svg

- name: Commit README badge changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
file_pattern: ".github/phpstan.svg"
commit_message: "chore: update PHPStan badge [skip ci]"
38 changes: 38 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Release
on:
push:
tags:
- "v*.*.*"
branches:
- main

jobs:
release:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Update changelog
id: changelog
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
tag: ${{ github.ref_name }}

- name: Create release
uses: ncipollo/[email protected]
with:
allowUpdates: true
draft: false
makeLatest: true
name: ${{ github.ref_name }}
body: ${{ steps.changelog.outputs.changes }}
token: ${{ github.token }}

- name: Commit CHANGELOG.md
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: main
commit_message: 'chore: update CHANGELOG.md for ${{ github.ref_name }} [skip ci]'
file_pattern: CHANGELOG.md
34 changes: 34 additions & 0 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Security

on:
# Run on all pushes and on all pull requests.
push:
pull_request:
# Also run this workflow every Monday at 6:00.
schedule:
- cron: '0 6 * * 1'
# Allow manually triggering the workflow.
workflow_dispatch:

# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
security:
name: 'Security check'
runs-on: ubuntu-latest

# Don't run the cronjob in this workflow on forks.
if: github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository_owner == 'refactor-ring')

steps:
- name: Checkout code
uses: actions/checkout@v4

# This action checks the `composer.lock` file against known security vulnerabilities in the dependencies.
# https://github.com/marketplace/actions/the-php-security-checker
- name: Run Security Check
uses: symfonycorp/security-checker-action@v5
55 changes: 55 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: "Unit Tests"

on:
pull_request:
push:
branches:
- main

jobs:
tests:
runs-on: ${{ matrix.os }}

env:
PHP_EXTENSIONS: none, bcmath, ctype, curl, dom, json, gmp, mbstring, opcache, simplexml, sockets, tokenizer, xml, xmlwriter
PHP_INI_VALUES: memory_limit=-1, assert.exception=1, zend.assertions=1, error_reporting=-1, log_errors_max_len=0, display_errors=On

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
monero: [ 0.18.1.2, 0.18.2.2, 0.18.3.1 ]
php: [8.1, 8.2, 8.3]
dependency-version: [prefer-lowest, prefer-stable]

name: Tests PHP${{ matrix.php }} - ${{ matrix.os }} - ${{ matrix.dependency-version }} - monero ${{ matrix.monero }}

steps:
- uses: actions/checkout@v4

- name: Spin up containers
run: docker-compose -f tests/docker-compose.yml up -d
env:
MONERO_VERSION: ${{ matrix.monero }}

- name: Cache dependencies
uses: actions/cache@v4
with:
path: ~/.composer/cache/files
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: ${{ matrix.coverage-driver }}
extensions: ${{ env.PHP_EXTENSIONS }}
ini-values: ${{ env.PHP_INI_VALUES }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install Composer dependencies
run: composer update --${{ matrix.dependency-version }} --no-ansi --no-interaction --no-progress --prefer-dist

- name: Run tests with PHPUnit
run: vendor/bin/phpunit
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/.phpunit.cache
/.php-cs-fixer.cache
/.php-cs-fixer.php
/vendor/
/var/
*.swp
*.swo
playground/*
.idea
tests/_reports
54 changes: 54 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# CONTRIBUTING

Contributions are welcome, and are accepted via pull requests.
Please review these guidelines before submitting any pull requests.

## Process

1. Fork the project
1. Create a new branch
1. Code, test, commit and push
1. Open a pull request detailing your changes. Make sure to follow the [template](.github/PULL_REQUEST_TEMPLATE.md)

## Guidelines

* Please ensure the coding style running `composer lint` and running phpstan `composer test:phpstan`.
* Send a coherent commit history, making sure each individual commit in your pull request is meaningful.
* You may need to [rebase](https://git-scm.com/book/en/v2/Git-Branching-Rebasing) to avoid merge conflicts.
* Please remember that we follow [SemVer](http://semver.org/).

## Setup

Clone your fork, then install the dev dependencies:
```bash
composer install
```

## Lint

Lint your code:
```bash
composer lint
```

## Tests

Run all tests:
```bash
composer test
```

Check code quality:
```bash
composer test:phpstan
```

Unit tests:
```bash
composer test:unit
```

Integration tests:
```bash
composer test:integration
```
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 refring, 2024 Monero Integrations team

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
23 changes: 23 additions & 0 deletions PUBLISHING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Publishing a release

This document describes the process of publishing a new version of the package.

1. Update the version in the `composer.json` file.
2. Commit the changes.
- ```bash
git commit -m "chore: bump version to <version>"
```

Where `<version>` is the new version number (e.g. `1.2.3`).
3. Create a new tag.
- ```bash
git tag v<version>
```

Where `<version>` is the new version number (e.g. `1.2.3`).
4. Push the changes.
- ```bash
git push origin main --tags
```

A release will automatically be created.
Loading