From 4955799081a14b4d8b0f776f0cecf3d0a8d80c6f Mon Sep 17 00:00:00 2001 From: 0xcb9ff9 <0xcb9ff9@proton.me> Date: Mon, 5 Jun 2023 15:04:40 +0800 Subject: [PATCH] dogechain public rpc adaptation --- .github/workflows/audit.yml | 17 --- .github/workflows/build_image.yml | 62 +++++++++++ .github/workflows/ci.yml | 169 ------------------------------ docker/docker-compose.yml | 2 +- 4 files changed, 63 insertions(+), 187 deletions(-) delete mode 100644 .github/workflows/audit.yml create mode 100644 .github/workflows/build_image.yml delete mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml deleted file mode 100644 index f4fdaad071d..00000000000 --- a/.github/workflows/audit.yml +++ /dev/null @@ -1,17 +0,0 @@ -# See https://github.com/actions-rs/audit-check -name: Security audit -on: - # push: - # paths: - # - '**/Cargo.toml' - # - '**/Cargo.lock' - schedule: - - cron: '0 0 */7 * *' -jobs: - security_audit: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/audit-check@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/build_image.yml b/.github/workflows/build_image.yml new file mode 100644 index 00000000000..c89bc1cdc27 --- /dev/null +++ b/.github/workflows/build_image.yml @@ -0,0 +1,62 @@ + +name: Continuous Integration + +on: + push: + tags: + - "v*.*.*" + +env: + RELEASE_VERSION: ${GITHUB_REF#refs/*/} + +jobs: + release: + name: Build docker image + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + # https://github.com/actions/checkout/issues/1169 + - name: Workaround Git Security Warning + run: | + # Workaround a bug in github actions: + git config --global --add safe.directory "$GITHUB_WORKSPACE" + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + with: + platforms: linux/amd64 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: dogechainlab/graph-node + tags: | + type=ref,event=tag + type=sha,format=long + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USER_NAME }} + password: ${{ secrets.DOCKER_USER_PASSWORD }} + + - name: Build and push + uses: docker/build-push-action@v4 + with: + push: true + context: . + file: docker/Dockerfile + tags: ${{ steps.meta.outputs.tags }} + build-args: | + COMMIT_SHA=${GITHUB_SHA} + REPO_NAME=${GITHUB_REPOSITORY} + BRANCH_NAME=${env.GITHUB_REF_NAME} + TAG_NAME=${env.RELEASE_VERSION} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index c011ab43278..00000000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,169 +0,0 @@ -name: Continuous Integration - -on: - push: - branches: [master] - pull_request: - types: [opened, synchronize, reopened] - -env: - CARGO_TERM_COLOR: always - RUST_BACKTRACE: full - THEGRAPH_STORE_POSTGRES_DIESEL_URL: "postgresql://postgres:postgres@localhost:5432/graph_node_test" - -jobs: - unit-tests: - name: Run unit tests - runs-on: ubuntu-latest - services: - ipfs: - image: ipfs/go-ipfs:v0.10.0 - ports: - - 5001:5001 - postgres: - image: postgres - env: - POSTGRES_PASSWORD: postgres - POSTGRES_DB: graph_node_test - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - ports: - - 5432:5432 - env: - RUSTFLAGS: "-C link-arg=-fuse-ld=lld -D warnings" - steps: - - name: Checkout sources - uses: actions/checkout@v2 - - uses: Swatinem/rust-cache@v2 - - - name: Install lld - run: sudo apt-get install -y lld - - - name: Run unit tests - uses: actions-rs/cargo@v1 - with: - command: test - args: --verbose --workspace --exclude graph-tests -- --nocapture - - runner-tests: - name: Subgraph Runner integration tests - runs-on: ubuntu-latest - services: - ipfs: - image: ipfs/go-ipfs:v0.10.0 - ports: - - 5001:5001 - postgres: - image: postgres - env: - POSTGRES_PASSWORD: postgres - POSTGRES_DB: graph_node_test - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - ports: - - 5432:5432 - env: - RUSTFLAGS: "-C link-arg=-fuse-ld=lld -D warnings" - steps: - - name: Checkout sources - uses: actions/checkout@v2 - - uses: Swatinem/rust-cache@v2 - - - name: Install lld - run: sudo apt-get install -y lld - - - name: Run runner tests - id: runner-tests-1 - uses: actions-rs/cargo@v1 - env: - TESTS_GANACHE_HARD_WAIT_SECONDS: "30" - with: - command: test - args: --verbose --package graph-tests -- --skip parallel_integration_tests - - integration-tests: - name: Run integration tests - runs-on: ubuntu-latest - env: - RUSTFLAGS: "-C link-arg=-fuse-ld=lld -D warnings" - steps: - - name: Checkout sources - uses: actions/checkout@v2 - - uses: Swatinem/rust-cache@v2 - - - name: Install Node 14 - uses: actions/setup-node@v3 - with: - node-version: "14" - cache: yarn - cache-dependency-path: "tests/integration-tests/yarn.lock" - - - name: Install lld and jq - run: sudo apt-get install -y lld jq - - - name: Build graph-node - uses: actions-rs/cargo@v1 - with: - command: build - args: --bin graph-node - - # Integration tests are a bit flaky, running them twice increases the - # chances of one run succeeding. - - name: Run integration tests (round 1) - id: integration-tests-1 - uses: actions-rs/cargo@v1 - env: - N_CONCURRENT_TESTS: "4" - TESTS_GANACHE_HARD_WAIT_SECONDS: "30" - with: - command: test - args: --verbose --package graph-tests parallel_integration_tests -- --nocapture - continue-on-error: true - - name: Run integration tests (round 2) - id: integration-tests-2 - uses: actions-rs/cargo@v1 - if: ${{ steps.integration-tests-1.outcome == 'failure' }} - env: - N_CONCURRENT_TESTS: "4" - TESTS_GANACHE_HARD_WAIT_SECONDS: "30" - with: - command: test - args: --verbose --package graph-tests parallel_integration_tests -- --nocapture - - rustfmt: - name: Check rustfmt style - runs-on: ubuntu-latest - env: - RUSTFLAGS: "-D warnings" - steps: - - uses: actions/checkout@v2 - - - name: Check formatting - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check - - clippy: - name: Report Clippy warnings - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - # Unlike rustfmt, Clippy actually compiles stuff so it benefits from - # caching. - - uses: Swatinem/rust-cache@v2 - - - name: Run Clippy - uses: actions-rs/cargo@v1 - # We do *not* block builds if Clippy complains. It's just here to let us - # keep an eye out on the warnings it produces. - continue-on-error: true - with: - command: clippy - args: --no-deps diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 3f734090294..ee0b8eb864f 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,7 +1,7 @@ version: '3' services: graph-node: - image: "ghcr.io/dogechain-lab/graph-node:v0.29.0" + image: "dogechainlab/graph-node:v0.29.0" ports: - '8000:8000' - '8001:8001'