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

Create rust.yml for CI #78

Closed
wants to merge 13 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions .github/workflows/check_verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Check And Verify

on:
pull_request:
branches: [ "main" ]
types: [opened, synchronize, reopened]

push:
branches:
- main

env:
CI: true
CARGO_TERM_COLOR: always
RUST_LOG: info

jobs:

verify_pull_request:
if: github.ref != 'refs/heads/main'
runs-on: ubuntu-latest

steps:
- name: checkout subgraph
uses: actions/checkout@master
with:
repository: datafast-network/subgraph-testing
token: ${{ secrets.PA_TOKEN }}
ref: main
command: |
cd subgraph-testing
yarn install
yarn codegen
yarn build
cd ..

- name: Setup environment
uses: the-guild-org/shared-config/setup@main
with:
nodeVersion: 20
packageManager: pnpm
packageManagerVersion: 8.10.4

- name: Install and build subgraph
run: pnpm build

- name: Checkout sources
uses: actions/checkout@v2

- name: Install Protoc
uses: arduino/setup-protoc@v2

- name: Install stable toolchain with rustfmt available
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy

- name: Check with fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

- name: Check with clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-features

- name: Check with cargo check
uses: actions-rs/cargo@v1
with:
command: check
args: --all-features

- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
39 changes: 39 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build And Publish Image

on:
push:
branches:
- main

env:
IMAGE_NAME: datafast-runtime
REGISTRY: ${{ vars.REGISTRY }}

jobs:
build_and_push:
if: github.ref == 'refs/heads/main'
runs-on: self-hosted
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.PA_TOKEN }}

- name: Extract metadata
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker images
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Loading