Skip to content

Commit 2aef356

Browse files
authored
Github workflows for test and release
2 parents 133e059 + 4556bb7 commit 2aef356

3 files changed

Lines changed: 66 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Release
2+
on:
3+
push:
4+
branches:
5+
- main
6+
paths:
7+
- "Cargo.toml"
8+
- ".github/workflows/release.yml"
9+
10+
jobs:
11+
publish:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions-rs/toolchain@v1
15+
with:
16+
toolchain: stable
17+
override: true
18+
- name: Install protobuf
19+
uses: taiki-e/install-action@v2
20+
with:
21+
tool: protoc
22+
- name: Checkout
23+
uses: actions/checkout@v2
24+
- name: get version
25+
run: echo PACKAGE_VERSION=$(sed -nE 's/^\s*version = "(.*?)"/\1/p' Cargo.toml) >> $GITHUB_ENV
26+
- name: check published version
27+
run: echo PUBLISHED_VERSION=$(cargo search kcl --limit 1 | sed -nE 's/^[^"]*"//; s/".*//1p' -) >> $GITHUB_ENV
28+
- name: cargo login
29+
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
30+
run: cargo login ${{ secrets.CRATES_IO_TOKEN }}
31+
- name: cargo package
32+
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
33+
run: |
34+
cargo package
35+
echo "We will publish:" $PACKAGE_VERSION
36+
echo "This is current latest:" $PUBLISHED_VERSION
37+
- name: Publish KCL
38+
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
39+
run: |
40+
echo "# Cargo Publish"
41+
cargo publish --no-verify

.github/workflows/test.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Test
2+
3+
on:
4+
pull_request:
5+
branches: [ "main" ]
6+
7+
env:
8+
CARGO_TERM_COLOR: always
9+
10+
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
- name: Install protobuf
16+
uses: taiki-e/install-action@v2
17+
with:
18+
tool: protoc
19+
- name: Build
20+
run: cargo build --verbose
21+
- name: Run Clippy
22+
run: cargo clippy --all-targets --all-features -- -Dclippy::all
23+
- name: Run tests
24+
run: cargo test --verbose

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ddtrace"
3-
version = "0.0.6"
3+
version = "0.0.7"
44
authors = ["David Steiner <david_j_steiner@yahoo.co.nz", "Fergus Strangways-Dixon <fergusdixon101@gmail.com>"]
55
edition = "2021"
66
license = "MIT"

0 commit comments

Comments
 (0)