Skip to content

Commit 79007b2

Browse files
committed
Add release action
1 parent a42594c commit 79007b2

File tree

3 files changed

+220
-3
lines changed

3 files changed

+220
-3
lines changed

.github/CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ Please submit pull request to `dev` branch. This is to avoid mismatch between
5959
vimscript and rust binary run by end user.
6060

6161
# Release
62-
1. Update [CHANGELOG](../CHANGELOG.md).
63-
1. Issue command `cargo release patch`. Note you will need [`cargo-release`][cargo-release] installed. This will create a commit with updated version metadata, tag it, push to GitHub remote, which will then trigger Travis workflow to generate binaries.
64-
1. Once Travis workflow is finished successfully, rebase `dev` branch onto `next` branch.
62+
1. Issue command `cargo release patch`. Note you will need [`cargo-release`][cargo-release] installed. This will create a commit with updated version metadata, tag it, push to GitHub remote.
63+
1. Create a release on github UI from the tag you created on the previous step. This will trigger a github workflow to create the binaries and upload them to the release.
64+
1. Once the github release workflow has finished, rebase next to dev (`git rebase dev`).
6565

6666
[cargo-release]: https://github.com/sunng87/cargo-release

.github/workflows/ci.yml

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
name: CI
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- dev
7+
8+
jobs:
9+
test-unit:
10+
name: Run unit tests
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v2
15+
with:
16+
ref: ${{ github.event.pull_request.head.sha }}
17+
fetch-depth: 20
18+
19+
- name: Install dependencies
20+
run: |
21+
apt update
22+
apt install --yes --no-install-recommends neovim curl git python3-pip python3-pytest mypy flake8 npm make
23+
apt clean
24+
rm -rf /var/lib/apt/lists/*
25+
python3 -m pip install neovim vim-vint
26+
27+
- name: Install Rust toolchain
28+
uses: actions-rs/toolchain@v1
29+
with:
30+
toolchain: stable
31+
profile: minimal
32+
override: true
33+
components: rustfmt, clippy
34+
35+
- name: Test
36+
run: make integration-test
37+
38+
test-integration:
39+
name: Run integration tests
40+
runs-on: ubuntu-latest
41+
42+
steps:
43+
- name: Checkout repository
44+
uses: actions/checkout@v2
45+
with:
46+
ref: ${{ github.event.pull_request.head.sha }}
47+
fetch-depth: 20
48+
49+
- name: Install Rust toolchain
50+
uses: actions-rs/toolchain@v1
51+
with:
52+
toolchain: stable
53+
profile: minimal
54+
override: true
55+
components: rustfmt, clippy
56+
57+
- name: Compile
58+
run: cargo test --no-run --locked
59+
60+
- name: Test
61+
run: cargo test
62+
63+
lint-rust:
64+
name: Lint rust
65+
runs-on: ubuntu-latest
66+
67+
steps:
68+
- name: Checkout repository
69+
uses: actions/checkout@v2
70+
with:
71+
ref: ${{ github.event.pull_request.head.sha }}
72+
fetch-depth: 20
73+
74+
- name: Install Rust toolchain
75+
uses: actions-rs/toolchain@v1
76+
with:
77+
toolchain: stable
78+
profile: minimal
79+
override: true
80+
components: rustfmt, clippy
81+
82+
- name: Format
83+
run: cargo fmt -- --check
84+
85+
- name: Check
86+
run: cargo clippy
87+
88+
lint-vimscript:
89+
name: Lint VimL
90+
runs-on: ubuntu-lataest
91+
92+
steps:
93+
- name: Checkout repository
94+
uses: actions/checkout@v2
95+
96+
- name: Install dependencies
97+
run: |
98+
apt update
99+
apt install --yes --no-install-recommends neovim curl git python3-pip python3-pytest mypy flake8 npm make
100+
apt clean
101+
rm -rf /var/lib/apt/lists/*
102+
python3 -m pip install neovim vim-vint
103+
104+
- name: Lint
105+
run: vim-lint
106+
107+
lint-python:
108+
name: Lint Python
109+
runs-on: ubuntu-lataest
110+
111+
steps:
112+
- name: Checkout repository
113+
uses: actions/checkout@v2
114+
115+
- name: Install dependencies
116+
run: |
117+
apt update
118+
apt install --yes --no-install-recommends neovim python3-pip python3-pytest mypy flake8
119+
apt clean
120+
rm -rf /var/lib/apt/lists/*
121+
122+
- name: Lint
123+
run: python-lint

.github/workflows/release.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Build and upload binaries to release
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
build:
9+
name: Build
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
include:
14+
- target: x86_64-unknown-linux-musl
15+
binary: languageclient
16+
asset_name: languageclient-${{ github.event.release.tag_name }}-x86_64-unknown-linux-musl
17+
- target: aarch64-unknown-linux-musl
18+
binary: languageclient
19+
asset_name: languageclient-${{ github.event.release.tag_name }}-aarch64-unknown-linux-musl
20+
- target: i686-unknown-linux-musl
21+
binary: languageclient
22+
asset_name: languageclient-${{ github.event.release.tag_name }}-i686-unknown-linux-musl
23+
- target: x86_64-pc-windows-gnu
24+
binary: languageclient.exe
25+
asset_name: languageclient-${{ github.event.release.tag_name }}-x86_64-pc-windows-gnu.exe
26+
steps:
27+
- name: Checkout code
28+
uses: actions/checkout@v2
29+
30+
- name: Set output
31+
id: vars
32+
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
33+
34+
- uses: actions-rs/toolchain@v1
35+
with:
36+
toolchain: stable
37+
38+
- name: Install cross
39+
run: cargo install cross
40+
41+
- name: Compile
42+
run: cross build --release --locked --target=${{ matrix.target }}
43+
44+
- name: Hash
45+
run: cp target/${{ matrix.target }}/release/${{ matrix.binary }} bin/${{ matrix.binary }} && sha256sum bin/${{ matrix.binary }} | tee bin/languageclient.sha256
46+
47+
- name: Upload binary to release
48+
uses: svenstaro/upload-release-action@v2
49+
with:
50+
repo_token: ${{ secrets.GITHUB_TOKEN }}
51+
file: target/${{ matrix.target }}/release/${{ matrix.binary }}
52+
asset_name: ${{ matrix.asset_name }}
53+
tag: ${{ github.ref }}
54+
55+
- name: Upload sha to release
56+
uses: svenstaro/upload-release-action@v2
57+
with:
58+
repo_token: ${{ secrets.GITHUB_TOKEN }}
59+
file: bin/languageclient.sha256
60+
asset_name: ${{ matrix.asset_name }}.sha256
61+
tag: ${{ github.ref }}
62+
63+
build-mac:
64+
name: Build mac
65+
runs-on: macos-latest
66+
steps:
67+
- name: Checkout code
68+
uses: actions/checkout@v2
69+
70+
- uses: actions-rs/toolchain@v1
71+
with:
72+
toolchain: stable
73+
74+
- name: Compile
75+
run: cargo build --release --locked
76+
77+
- name: Hash
78+
run: cp target/release/languageclient bin/languageclient && openssl sha256 bin/languageclient | awk '{print $2 " bin/languageclient"}' > bin/languageclient.sha256
79+
80+
- name: Upload binary to release
81+
uses: svenstaro/upload-release-action@v2
82+
with:
83+
repo_token: ${{ secrets.GITHUB_TOKEN }}
84+
file: target/release/languageclient
85+
asset_name: languageclient-${{ github.event.release.tag_name }}-x86_64-apple-darwin
86+
tag: ${{ github.ref }}
87+
88+
- name: Upload sha to release
89+
uses: svenstaro/upload-release-action@v2
90+
with:
91+
repo_token: ${{ secrets.GITHUB_TOKEN }}
92+
file: bin/languageclient.sha256
93+
asset_name: languageclient-${{ github.event.release.tag_name }}-x86_64-apple-darwin.sha256
94+
tag: ${{ github.ref }}

0 commit comments

Comments
 (0)