Skip to content

Commit e4a6208

Browse files
committed
Switch to warp
github CI
1 parent ca7eec2 commit e4a6208

7 files changed

Lines changed: 1103 additions & 691 deletions

File tree

.github/workflows/ci.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: CI
2+
3+
on:
4+
pull_request: # trigger on pull requests
5+
push:
6+
branches: # array of glob patterns matching against refs/heads. Optional; defaults to all
7+
- master # triggers on pushes that contain changes in master
8+
9+
jobs:
10+
build:
11+
name: Build
12+
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
build: [linux, macos, windows]
17+
include:
18+
- build: linux
19+
os: ubuntu-latest
20+
rust: stable
21+
- build: macos
22+
os: macos-latest
23+
rust: stable
24+
- build: windows
25+
os: windows-latest
26+
rust: stable
27+
28+
steps:
29+
- uses: actions/checkout@v1
30+
- name: Cache cargo registry
31+
uses: actions/cache@v1
32+
with:
33+
path: ~/.cargo/registry
34+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
35+
- name: Cache cargo index
36+
uses: actions/cache@v1
37+
with:
38+
path: ~/.cargo/git
39+
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
40+
- name: Cache cargo build
41+
uses: actions/cache@v1
42+
with:
43+
path: target
44+
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
45+
- name: Install Rust (rustup)
46+
run: rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }}
47+
if: matrix.os != 'macos-latest'
48+
shell: bash
49+
- name: Install Rust (macos)
50+
# As of 7.12.2019 rust is not installed on MacOS
51+
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/software-installed-on-github-hosted-runners#macos-1015
52+
run: |
53+
curl https://sh.rustup.rs | sh -s -- -y
54+
echo "##[add-path]$HOME/.cargo/bin"
55+
if: matrix.os == 'macos-latest'
56+
- name: Build
57+
run: cargo build --verbose
58+
- name: Run tests
59+
run: cargo test --verbose
60+
61+
rustfmt:
62+
name: Rustfmt
63+
runs-on: ubuntu-latest
64+
steps:
65+
- uses: actions/checkout@master
66+
- name: Install Rust
67+
run: rustup update stable && rustup default stable && rustup component add rustfmt
68+
- run: cargo fmt -- --check
69+
70+
clippy_check:
71+
name: Clippy
72+
runs-on: ubuntu-latest
73+
steps:
74+
- uses: actions/checkout@v1
75+
- run: rustup component add clippy
76+
- uses: actions-rs/clippy-check@v1
77+
with:
78+
token: ${{ secrets.GITHUB_TOKEN }}
79+
args: --all-features

.github/workflows/release.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
on:
2+
push:
3+
# Sequence of patterns matched against refs/tags
4+
tags:
5+
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
6+
7+
name: Create Release
8+
9+
env:
10+
# Could, potentially automatically parse
11+
# the bin name, but let's do it automatically for now.
12+
RELEASE_BIN: gh-actions-template
13+
14+
# Space separated paths to include in the archive.
15+
# Start relative paths with a dot if you don't want
16+
# paths to be preserved. Use "/" as a delimiter.
17+
RELEASE_ADDS: README.md LICENSE
18+
19+
20+
jobs:
21+
build:
22+
name: Build release
23+
24+
runs-on: ${{ matrix.os }}
25+
strategy:
26+
matrix:
27+
build: [linux, macos, windows]
28+
include:
29+
- build: linux
30+
os: ubuntu-latest
31+
rust: stable
32+
- build: macos
33+
os: macos-latest
34+
rust: stable
35+
- build: windows
36+
os: windows-latest
37+
rust: stable
38+
39+
steps:
40+
- uses: actions/checkout@v1
41+
42+
- name: Install Rust (rustup)
43+
run: rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }}
44+
if: matrix.os != 'macos-latest'
45+
shell: bash
46+
47+
- name: Install Rust (macos)
48+
# As of 7.12.2019 rust is not installed on MacOS
49+
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/software-installed-on-github-hosted-runners#macos-1015
50+
run: |
51+
curl https://sh.rustup.rs | sh -s -- -y
52+
echo "##[add-path]$HOME/.cargo/bin"
53+
if: matrix.os == 'macos-latest'
54+
55+
- name: Build
56+
run: cargo build --verbose --release
57+
58+
- name: Create artifact directory
59+
run: mkdir artifacts
60+
61+
- name: Create archive for Linux
62+
run: 7z a -ttar -so -an ./target/release/${{ env.RELEASE_BIN }} ${{ env.RELEASE_ADDS }} | 7z a -si ./artifacts/${{ env.RELEASE_BIN }}-linux-x86_64.tar.gz
63+
if: matrix.os == 'ubuntu-latest'
64+
65+
- name: Create archive for Windows
66+
run: 7z a -tzip ./artifacts/${{ env.RELEASE_BIN }}-windows-x86_64.zip ./target/release/${{ env.RELEASE_BIN }}.exe ${{ env.RELEASE_ADDS }}
67+
if: matrix.os == 'windows-latest'
68+
69+
- name: Install p7zip
70+
# 7Zip not available on MacOS, install p7zip via homebrew.
71+
run: brew install p7zip
72+
if: matrix.os == 'macos-latest'
73+
74+
- name: Create archive for MacOS
75+
run: 7z a -tzip ./artifacts/${{ env.RELEASE_BIN }}-mac-x86_64.zip ./target/release/${{ env.RELEASE_BIN }} ${{ env.RELEASE_ADDS }}
76+
if: matrix.os == 'macos-latest'
77+
78+
# This will double-zip
79+
# See - https://github.com/actions/upload-artifact/issues/39
80+
- uses: actions/upload-artifact@v1
81+
name: Upload archive
82+
with:
83+
name: ${{ runner.os }}
84+
path: artifacts/

0 commit comments

Comments
 (0)