diff --git a/.github/workflows/check_pr.yml b/.github/workflows/check_pr.yml new file mode 100644 index 0000000..60901b6 --- /dev/null +++ b/.github/workflows/check_pr.yml @@ -0,0 +1,45 @@ +name: "Check PR" + +on: + pull_request: + push: + branches: + - main + - master + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + Check_Build: + name: "Check Build" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install system dependencies + run: sudo apt-get update && sudo apt-get install -y libdbus-1-dev pkg-config libudev-dev + - name: Install mise + uses: jdx/mise-action@v2 + - name: Cache Dependencies + uses: Swatinem/rust-cache@v2.7.3 + - name: "Install WASM Target" + run: rustup target add wasm32-unknown-unknown + - name: "Build Contract (Optimized)" + run: make build + + Check_Tests: + name: "Run Tests" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install system dependencies + run: sudo apt-get update && sudo apt-get install -y libdbus-1-dev pkg-config libudev-dev + - name: Install mise + uses: jdx/mise-action@v2 + - name: Cache Dependencies + uses: Swatinem/rust-cache@v2.7.3 + - name: "Install WASM Target" + run: rustup target add wasm32-unknown-unknown + - name: "Run All Tests" + run: make test diff --git a/Makefile b/Makefile index 5185464..bd83f80 100644 --- a/Makefile +++ b/Makefile @@ -5,26 +5,11 @@ test: build build: mkdir -p target/wasm32-unknown-unknown/optimized - - cargo rustc --manifest-path=Cargo.toml --crate-type=cdylib --target=wasm32-unknown-unknown --release + cargo rustc --manifest-path=Cargo.toml --crate-type=cdylib --target=wasm32-unknown-unknown --release stellar contract optimize \ --wasm target/wasm32-unknown-unknown/release/oracle_aggregator.wasm \ --wasm-out target/wasm32-unknown-unknown/optimized/oracle_aggregator.wasm - cd target/wasm32-unknown-unknown/optimized/ && \ - for i in *.wasm ; do \ - ls -l "$$i"; \ - done - -fmt: - cargo fmt --all - -clean: - cargo clean - -generate-js: - stellar contract bindings typescript --overwrite \ - --contract-id CBWH54OKUK6U2J2A4J2REJEYB625NEFCHISWXLOPR2D2D6FTN63TJTWN \ - --wasm ./target/wasm32-unknown-unknown/optimized/oracle_aggregator.wasm --output-dir ./js/aggregator/ \ - --rpc-url http://localhost:8000 --network-passphrase "Standalone Network ; February 2017" --network Standalone - +deploy-testnet: build + stellar contract deploy --network $$STELLAR_NETWORK --source $$STELLAR_SOURCE --wasm $$WASM -- --admin $$ADMIN --base $$BASE --decimals $$DECIMALS --max-age $$MAX_AGE + diff --git a/README.md b/README.md index 66e9104..5dae4c5 100644 --- a/README.md +++ b/README.md @@ -57,4 +57,4 @@ The aggregator attempts to fetch the price from the source oracle as defined by Oracle Aggregator has not had an audit conducted. If an audit is conducted, it will appear here. -Oracle Aggregator is made available under the MIT License, which disclaims all warranties in relation to the project and which limits the liability of those that contribute and maintain the project, including Script3. You acknowledge that you are solely responsible for any use of Oracle Aggregator and you assume all risks associated with any such use. +Oracle Aggregator is made available under the MIT License, which disclaims all warranties in relation to the project and which limits the liability of those that contribute and maintain the project, including Script3. You acknowledge that you are solely responsible for any use of Oracle Aggregator and you assume all risks associated with any such use. \ No newline at end of file diff --git a/mise.toml b/mise.toml new file mode 100644 index 0000000..a7c614c --- /dev/null +++ b/mise.toml @@ -0,0 +1,12 @@ +[tools] +"cargo:stellar-cli" = "23.1.4" + +[env] +STELLAR_NETWORK = "testnet" +STELLAR_SOURCE = "blend-test-net" +WASM = "target/wasm32-unknown-unknown/optimized/oracle_aggregator.wasm" +ADMIN = "GBH62ESUWAJGVIDWMQTIJ4T24IWIGMYM2LGGVCBZGAZY7EYHDYMMA7HX" +BASE = '{"Other":"USD"}' +DECIMALS = 14 +MAX_AGE = 600 +ORACLE_TESTNET_ID = "CCNAFGAGXRP4RURGW6ISNTT2H7EA5HMNC6VKFHPL3Q2ALEADEMPMPZZ3"