From bfbff5958d0a86bc85d7816015e622a04b32f731 Mon Sep 17 00:00:00 2001 From: lAmeR1 Date: Tue, 16 Jul 2024 23:58:38 +0200 Subject: [PATCH] regex changed and new github workflows --- .github/workflows/docker-branches.yml | 44 +++++++++++++++++++++++++++ .github/workflows/docker-release.yml | 44 +++++++++++++++++++++++++++ endpoints/get_address_transactions.py | 4 +-- 3 files changed, 89 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/docker-branches.yml create mode 100644 .github/workflows/docker-release.yml diff --git a/.github/workflows/docker-branches.yml b/.github/workflows/docker-branches.yml new file mode 100644 index 0000000..5f15b26 --- /dev/null +++ b/.github/workflows/docker-branches.yml @@ -0,0 +1,44 @@ +name: Docker Image +on: + push: + branches-ignore: + - main + +jobs: + build: + strategy: + matrix: + os: [ubuntu-latest] + arch: [amd64, arm64] + + runs-on: ${{ matrix.os }} + + steps: + - name: Add SHORT_SHA env property with commit short sha + run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-7`" >> $GITHUB_ENV + - name: Checkout code + uses: actions/checkout@v2 + + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: lamer1 + password: ${{ secrets.DOCKER_ACCESS_TOKEN }} + + - name: Set up QEMU (for ARM64 emulation) + if: matrix.arch == 'arm64' + run: | + sudo apt-get install -y qemu-user-static + + - name: Set up Docker Buildx (for multi-platform builds) + uses: docker/setup-buildx-action@v1 + + - name: Build and push Docker image + run: | + docker buildx build \ + --platform linux/amd64,linux/arm64 \ + -t kaspanet/kaspa-rest-server:${SHORT_SHA} \ + -t kaspanet/kaspa-rest-server:${GITHUB_REF_NAME} \ + --push . + + docker buildx imagetools inspect kaspanet/kaspa-rest-server:${SHORT_SHA} diff --git a/.github/workflows/docker-release.yml b/.github/workflows/docker-release.yml new file mode 100644 index 0000000..af20011 --- /dev/null +++ b/.github/workflows/docker-release.yml @@ -0,0 +1,44 @@ +name: Docker Image +on: + release: + types: [ published ] + +jobs: + build: + strategy: + matrix: + os: [ ubuntu-latest ] + arch: [ amd64, arm64 ] + + runs-on: ${{ matrix.os }} + + steps: + - name: Add SHORT_SHA env property with commit short sha + run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-7`" >> $GITHUB_ENV + - name: Checkout code + uses: actions/checkout@v2 + + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: lamer1 + password: ${{ secrets.DOCKER_ACCESS_TOKEN }} + + - name: Set up QEMU (for ARM64 emulation) + if: matrix.arch == 'arm64' + run: | + sudo apt-get install -y qemu-user-static + + - name: Set up Docker Buildx (for multi-platform builds) + uses: docker/setup-buildx-action@v1 + + - name: Build and push Docker image + run: | + docker buildx build \ + --platform linux/amd64,linux/arm64 \ + -t kaspanet/kaspa-rest-server:${{github.ref_name}} \ + -t kaspanet/kaspa-rest-server:latest \ + --build-arg version=${{github.ref_name}} \ + --push . + + docker buildx imagetools inspect kaspanet/kaspa-rest-server:latest diff --git a/endpoints/get_address_transactions.py b/endpoints/get_address_transactions.py index 04e12bf..061ab5d 100644 --- a/endpoints/get_address_transactions.py +++ b/endpoints/get_address_transactions.py @@ -10,7 +10,7 @@ from sqlalchemy.future import select from starlette.responses import Response -from constants import ADDRESS_EXAMPLE +from constants import ADDRESS_EXAMPLE, REGEX_KASPA_ADDRESS from dbsession import async_session from endpoints import sql_db_only from endpoints.get_transactions import search_for_transactions, TxSearch, TxModel @@ -22,8 +22,6 @@ " Light fetches only the address and amount. Full fetches the whole TransactionOutput and " \ "adds it into each TxInput." -REGEX_KASPA_ADDRESS = "^kaspa(test)?\:[a-z0-9]{61,63}$" - class TransactionsReceivedAndSpent(BaseModel): tx_received: str