Skip to content

Commit 2d24cbc

Browse files
committed
Add test / publish with GitHub actions
1 parent d1c60a0 commit 2d24cbc

File tree

2 files changed

+73
-0
lines changed

2 files changed

+73
-0
lines changed

.github/workflows/publish.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
on:
2+
push:
3+
tags:
4+
- v*
5+
6+
jobs:
7+
create_release:
8+
runs-on: ubuntu-latest
9+
outputs:
10+
upload_url: ${{ steps.create_release.outputs.upload_url }}
11+
steps:
12+
- id: create_release
13+
uses: actions/create-release@v1
14+
env:
15+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16+
with:
17+
tag_name: ${{ github.ref }}
18+
release_name: ${{ github.ref }}
19+
20+
release_binary:
21+
runs-on: ${{ matrix.runs_on }}
22+
needs: create_release
23+
strategy:
24+
matrix:
25+
target:
26+
- x86_64-unknown-linux-gnu
27+
- x86_64-unknown-linux-musl
28+
- x86_64-apple-darwin
29+
- x86_64-pc-windows-gnu
30+
include:
31+
- target: x86_64-unknown-linux-gnu
32+
runs_on: ubuntu-latest
33+
artifact: jtd-validate
34+
- target: x86_64-unknown-linux-musl
35+
runs_on: ubuntu-latest
36+
artifact: jtd-validate
37+
- target: x86_64-apple-darwin
38+
runs_on: macos-latest
39+
artifact: jtd-validate
40+
- target: x86_64-pc-windows-gnu
41+
runs_on: ubuntu-latest
42+
artifact: jtd-validate.exe
43+
steps:
44+
- uses: actions/checkout@v2
45+
- uses: actions-rs/toolchain@v1
46+
with:
47+
toolchain: stable
48+
- run: cargo install cross
49+
- run: cross build --release --target=$TARGET
50+
env:
51+
TARGET: ${{ matrix.target }}
52+
- run: zip --junk-paths $TARGET.zip target/$TARGET/release/$ARTIFACT
53+
env:
54+
TARGET: ${{ matrix.target }}
55+
ARTIFACT: ${{ matrix.artifact }}
56+
- uses: actions/upload-release-asset@v1
57+
env:
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
with:
60+
upload_url: ${{ needs.create_release.outputs.upload_url }}
61+
asset_path: ${{ matrix.target }}.zip
62+
asset_name: ${{ matrix.target }}.zip
63+
asset_content_type: application/zip

.github/workflows/test.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
on: push
2+
jobs:
3+
test:
4+
runs-on: ubuntu-latest
5+
steps:
6+
- uses: actions/checkout@v2
7+
- uses: actions-rs/toolchain@v1
8+
with:
9+
toolchain: stable
10+
- run: cargo test

0 commit comments

Comments
 (0)