Skip to content

Commit 8aa131b

Browse files
committed
Add release action
1 parent a42594c commit 8aa131b

File tree

3 files changed

+225
-3
lines changed

3 files changed

+225
-3
lines changed

.github/CONTRIBUTING.md

+3-3
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

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

.github/workflows/release.yml

+94
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)