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

Upgrade fall 2023 #1

Merged
merged 16 commits into from
Feb 16, 2024
Merged
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
7 changes: 6 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,22 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: clippy, rustfmt

- name: Check format
run: cargo fmt --all -- --check

- name: Check with clippy
run: cargo clippy --all

- name: Build
run: cargo build --all --verbose

- name: Run tests
run: cargo test --all --verbose
17 changes: 11 additions & 6 deletions .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,29 @@ jobs:
cover:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4

- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Install libsqlite3-dev
run: |
sudo apt-get update
sudo apt-get install -y libsqlite3-dev

- name: Run cargo-tarpaulin
uses: actions-rs/[email protected]
with:
version: '0.14.3'
version: "0.14.3"
args: --out Xml --all
- name: Upload to codecov.io
uses: codecov/[email protected]
with:
token: ${{secrets.CODECOV_TOKEN}}

# - name: Upload to codecov.io
# uses: codecov/[email protected]
# with:
# token: ${{secrets.CODECOV_TOKEN}}

- name: Archive code coverage results
uses: actions/upload-artifact@v1
with:
Expand Down
144 changes: 36 additions & 108 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,124 +2,52 @@ name: Release

on:
push:
branches:
- release
tags:
- v*
workflow_dispatch:

jobs:
graphgate-docker:
runs-on: ubuntu-latest
strategy:
fail-fast: false
# matrix:
# images:
# - platform: linux/amd64
# dockerfile: ./Dockerfile
# target: x86_64-unknown-linux-musl
# - platform: linux/arm64
# dockerfile: ./Dockerfile
# target: aarch64-unknown-linux-musl
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Get version
run: echo PACKAGE_VERSION=$(sed -nE 's/^\s*version = "(.*?)"/\1/p' Cargo.toml) >> $GITHUB_ENV
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
push: true
context: .
tags: |
scott829/graphgate:${{ env.PACKAGE_VERSION }}
scott829/graphgate:latest
-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}

examples-docker:
runs-on: ubuntu-latest
needs: graphgate-docker
steps:
- name: Checkout
uses: actions/checkout@v2
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push ${{ matrix.package.name }}
uses: docker/build-push-action@v2
with:
push: true
context: .
file: Dockerfile-examples
tags: scott829/graphgate-examples:latest
- name: Deploy to Kubernetes
uses: WyriHaximus/github-action-helm3@v2
with:
kubeconfig: '${{ secrets.K8S_CONFIG }}'
exec: |
helm uninstall -n graphgate graphgate
helm upgrade --create-namespace -i -n graphgate graphgate examples/helm
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

standalone-demo-docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
-
name: Login to DockerHub
uses: docker/login-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push ${{ matrix.package.name }}
uses: docker/build-push-action@v2
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
context: .
file: Dockerfile-standalone-demo
tags: scott829/graphgate-standalone-demo:latest

publish:
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 1
matrix:
package:
- name: graphgate-schema
registryName: graphgate-schema
path: crates/schema
- name: graphgate-validation
registryName: graphgate-validation
path: crates/validation
- name: graphgate-planner
registryName: graphgate-planner
path: crates/planner
- name: graphgate-handler
registryName: graphgate-handler
path: crates/handler
- name: graphgate
registryName: graphgate
path: .
steps:
- name: Checkout
uses: actions/checkout@v2
- name: get version
working-directory: ${{ matrix.package.path }}
run: echo PACKAGE_VERSION=$(sed -nE 's/^\s*version = "(.*?)"/\1/p' Cargo.toml) >> $GITHUB_ENV
- name: check published version
run: echo PUBLISHED_VERSION=$(cargo search ${{ matrix.package.registryName }} --limit 1 | sed -nE 's/^[^"]*"//; s/".*//1p' -) >> $GITHUB_ENV
- name: cargo login
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
run: cargo login ${{ secrets.CRATES_TOKEN }}
- name: cargo package
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
working-directory: ${{ matrix.package.path }}
run: |
cargo package
echo "We will publish:" $PACKAGE_VERSION
echo "This is current latest:" $PUBLISHED_VERSION
- name: Publish ${{ matrix.package.name }}
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
working-directory: ${{ matrix.package.path }}
run: |
echo "# Cargo Publish"
cargo publish --no-verify
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/${{ github.repository }}/graphgate:${{ env.PACKAGE_VERSION }}
ghcr.io/${{ github.repository }}/graphgate:latest
9 changes: 9 additions & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
edition = "2021"
newline_style = "Unix"
# comments
normalize_comments = true
wrap_comments = true
format_code_in_doc_comments = true
# imports
imports_granularity = "Crate"
group_imports = "StdExternalCrate"
Loading
Loading