Skip to content

Commit

Permalink
setup CI
Browse files Browse the repository at this point in the history
  • Loading branch information
g-plane committed Aug 22, 2024
1 parent eecac91 commit b91b93b
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: CI

on:
push:
branches:
- main
tags-ignore:
- "**"
pull_request:
branches:
- main

jobs:
test:
name: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- run: cargo test --all-features

docs:
name: documentation
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install mdbook
run: |
tag=$(curl 'https://api.github.com/repos/rust-lang/mdbook/releases/latest' | jq -r '.tag_name')
url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz"
mkdir mdbook
curl -sSL $url | tar -xz --directory=./mdbook
echo `pwd`/mdbook >> $GITHUB_PATH
- run: mdbook build docs
- name: Deploy Production
run: netlify deploy --dir=docs/book --site=pretty-graphql --prod
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
30 changes: 30 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Release

on:
push:
tags:
- "v*.*.*"

permissions:
contents: write

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup target add wasm32-unknown-unknown
- run: |
cargo build --release -p dprint_plugin_graphql --target wasm32-unknown-unknown
cp target/wasm32-unknown-unknown/release/dprint_plugin_graphql.wasm dprint_plugin/deployment/plugin.wasm
- name: Publish dprint plugin
uses: softprops/action-gh-release@v1
with:
files: |
dprint_plugin/deployment/plugin.wasm
dprint_plugin/deployment/schema.json
- name: Publish crates
run: cargo publish -p pretty_graphql
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

0 comments on commit b91b93b

Please sign in to comment.