Skip to content

Commit d8dd507

Browse files
committed
Added inital github action support
1 parent 86852ec commit d8dd507

File tree

2 files changed

+152
-0
lines changed

2 files changed

+152
-0
lines changed

.github/workflows/build.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
on:
2+
push:
3+
branches:
4+
- master
5+
- staging
6+
- develop
7+
8+
name: Continuous integration
9+
10+
jobs:
11+
build:
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest]
16+
rust:
17+
- stable
18+
- beta
19+
- nightly
20+
fail-fast: false
21+
22+
steps:
23+
- uses: actions/checkout@v2
24+
25+
- name: Install Rust toolchain
26+
uses: actions-rs/toolchain@v1
27+
with:
28+
profile: minimal
29+
toolchain: ${{ matrix.rust }}
30+
override: true
31+
components: rustfmt, clippy
32+
33+
- name: Cargo build
34+
uses: actions-rs/cargo@v1
35+
with:
36+
command: build
37+
args: --release --all
38+
39+
release-master: # Publish release on push to master
40+
if: github.ref == 'refs/heads/master'
41+
runs-on: ubuntu-latest
42+
needs: build
43+
steps:
44+
- uses: actions/checkout@v2
45+
- run: git fetch --all --tags
46+
47+
- name: Check Release Version
48+
uses: thebongy/version-check@v1
49+
with:
50+
file: Cargo.toml
51+
tagFormat: v${version}
52+
id: version_check
53+
54+
- name: Publish Release
55+
uses: actions-rs/cargo@v1
56+
with:
57+
command: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }}
58+
59+
release-staging:
60+
if: github.ref == 'refs/heads/staging'
61+
runs-on: ubuntu-latest
62+
needs: build
63+
steps:
64+
- uses: actions/checkout@v2
65+
- run: git fetch --all --tags
66+
67+
- name: Check Release Version
68+
uses: thebongy/version-check@v1
69+
with:
70+
file: Cargo.toml
71+
tagFormat: v${version}
72+
id: version_check
73+
74+
- name: Publish Release
75+
uses: actions-rs/cargo@v1
76+
with:
77+
command: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }}
78+

.github/workflows/pr.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
on:
2+
pull_request:
3+
branches:
4+
- master
5+
- staging
6+
- develop
7+
name: Continuous integration (PR)
8+
jobs:
9+
version-check:
10+
if: github.base_ref == 'staging' || github.base_ref == 'master'
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
15+
- run: git fetch --all --tags
16+
17+
- name: Check Release Version (staging)
18+
if: github.base_ref == 'staging'
19+
uses: thebongy/version-check@v1
20+
with:
21+
file: Cargo.toml
22+
tagFormat: v${version}
23+
id: version_check_staging
24+
25+
- name: Check Release Version (master)
26+
if: github.base_ref == 'master'
27+
uses: thebongy/version-check@v1
28+
with:
29+
file: Cargo.toml
30+
tagFormat: v${version}
31+
id: version_check_master
32+
build:
33+
runs-on: ${{ matrix.os }}
34+
strategy:
35+
matrix:
36+
os: [ubuntu-latest]
37+
rust:
38+
- stable
39+
- beta
40+
- nightly
41+
fail-fast: false
42+
steps:
43+
- uses: actions/checkout@v2
44+
45+
- name: Install Rust toolchain
46+
uses: actions-rs/toolchain@v1
47+
with:
48+
profile: minimal
49+
toolchain: ${{ matrix.rust }}
50+
override: true
51+
components: rustfmt, clippy
52+
53+
- name: Cargo build
54+
uses: actions-rs/cargo@v1
55+
with:
56+
command: build
57+
args: --release --all
58+
59+
- name: Cargo test
60+
uses: actions-rs/cargo@v1
61+
with:
62+
command: test
63+
64+
- name: Cargo fmt
65+
uses: actions-rs/cargo@v1
66+
with:
67+
command: fmt
68+
args: --all -- --check
69+
70+
- name: Cargo clippy
71+
uses: actions-rs/cargo@v1
72+
with:
73+
command: clippy
74+
args: -- -D warnings

0 commit comments

Comments
 (0)