Skip to content

Commit 547cf3e

Browse files
authored
Add GitHub workflows for CI and Book (#487)
1 parent 389fd5c commit 547cf3e

File tree

2 files changed

+223
-0
lines changed

2 files changed

+223
-0
lines changed

.github/workflows/book.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Book
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'docs/book/**'
7+
push:
8+
paths:
9+
- 'docs/book/**'
10+
11+
jobs:
12+
tests:
13+
name: Test code examples
14+
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v2
20+
21+
- name: Install rust
22+
uses: actions-rs/toolchain@v1
23+
with:
24+
toolchain: stable
25+
profile: minimal
26+
override: true
27+
28+
- name: Test via skeptic
29+
uses: actions-rs/cargo@v1
30+
with:
31+
command: test
32+
args: --manifest-path docs/book/tests/Cargo.toml
33+
34+
deploy:
35+
name: Deploy book on gh-pages
36+
needs: [tests]
37+
if: github.ref == 'refs/heads/master'
38+
39+
runs-on: ubuntu-latest
40+
41+
steps:
42+
- name: Checkout
43+
uses: actions/checkout@v2
44+
45+
- name: Install mdBook
46+
uses: peaceiris/actions-mdbook@v1
47+
48+
- name: Render book
49+
run: |
50+
mdbook build -d gh-pages/master docs/book
51+
52+
- name: Deploy
53+
uses: peaceiris/[email protected]
54+
with:
55+
emptyCommits: false
56+
keepFiles: true
57+
env:
58+
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
59+
PUBLISH_BRANCH: gh-pages
60+
PUBLISH_DIR: docs/book/gh-pages

.github/workflows/ci.yml

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
name: CI
2+
3+
on: [pull_request, push]
4+
5+
jobs:
6+
###################################################
7+
# Formatting
8+
###################################################
9+
10+
format:
11+
name: Check formatting
12+
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v2
18+
19+
- name: Install rust
20+
uses: actions-rs/toolchain@v1
21+
with:
22+
toolchain: stable
23+
components: rustfmt
24+
profile: minimal
25+
override: true
26+
27+
- name: Run rustfmt
28+
uses: actions-rs/cargo@v1
29+
with:
30+
command: fmt
31+
args: -- --check
32+
33+
###################################################
34+
# Main Builds
35+
###################################################
36+
37+
build:
38+
runs-on: ${{ matrix.os }}
39+
40+
strategy:
41+
fail-fast: false
42+
matrix:
43+
rust: [stable, beta, nightly]
44+
os: [ubuntu-latest, windows-latest, macOS-latest]
45+
46+
steps:
47+
- name: Checkout
48+
uses: actions/checkout@v2
49+
50+
- name: Install rust
51+
uses: actions-rs/toolchain@v1
52+
with:
53+
toolchain: ${{ matrix.rust }}
54+
profile: minimal
55+
override: true
56+
57+
- name: Install cargo-make (Linux)
58+
if: runner.os == 'Linux'
59+
run: |
60+
_build/cargo-make.sh "0.20.0" "x86_64-unknown-linux-musl"
61+
62+
- name: Install cargo-make (macOS)
63+
if: runner.os == 'macOS'
64+
run: |
65+
_build/cargo-make.sh "0.20.0" "x86_64-apple-darwin"
66+
67+
- name: Install cargo-make (Windows)
68+
if: runner.os == 'Windows'
69+
run: |
70+
_build\cargo-make.ps1 -version "0.20.0" -target "x86_64-pc-windows-msvc"
71+
72+
- name: Build and run tests
73+
env:
74+
RUSTFLAGS: "-C link-dead-code"
75+
CARGO_MAKE_RUN_CODECOV: true
76+
run: |
77+
cargo make workspace-ci-flow --no-workspace
78+
79+
###################################################
80+
# WASM Builds
81+
###################################################
82+
83+
wasm:
84+
runs-on: ${{ matrix.os }}
85+
86+
strategy:
87+
matrix:
88+
os: [ubuntu-latest, windows-latest, macOS-latest]
89+
90+
steps:
91+
- name: Checkout
92+
uses: actions/checkout@v2
93+
94+
- name: Install rust
95+
uses: actions-rs/toolchain@v1
96+
with:
97+
toolchain: stable
98+
target: wasm32-unknown-unknown
99+
profile: minimal
100+
override: true
101+
102+
- name: Check
103+
uses: actions-rs/cargo@v1
104+
with:
105+
command: check
106+
args: --target wasm32-unknown-unknown --package juniper --package juniper_codegen
107+
108+
###################################################
109+
# Releases
110+
###################################################
111+
112+
release:
113+
name: Check release automation
114+
115+
runs-on: ubuntu-latest
116+
117+
steps:
118+
- name: Checkout
119+
uses: actions/checkout@v2
120+
with:
121+
fetch-depth: 20
122+
123+
- name: Install rust
124+
uses: actions-rs/toolchain@v1
125+
with:
126+
toolchain: stable
127+
profile: minimal
128+
override: true
129+
130+
- name: Install cargo-make
131+
run: |
132+
_build/cargo-make.sh "0.20.0" "x86_64-unknown-linux-musl"
133+
134+
- name: Install cargo-release
135+
uses: actions-rs/cargo@v1
136+
with:
137+
command: install
138+
args: --version=0.11.2 cargo-release
139+
140+
- name: Setup git
141+
run: |
142+
git config --global user.email "[email protected]"
143+
git config --global user.name "Release Test Bot"
144+
145+
- name: Dry run mode
146+
env:
147+
RELEASE_LEVEL: minor
148+
run: |
149+
cargo make release-dry-run
150+
151+
- name: Local test mode
152+
env:
153+
RELEASE_LEVEL: minor
154+
run: |
155+
cargo make release-local-test
156+
157+
- name: Echo local changes
158+
run: |
159+
git --no-pager log -p HEAD...HEAD~20
160+
161+
- name: Run tests
162+
run: |
163+
cargo make workspace-ci-flow --no-workspace

0 commit comments

Comments
 (0)