Skip to content

Commit 59e2833

Browse files
authored
Merge pull request #164 from bluss/gh-actions
Migrate CI from travis to github actions
2 parents 01901ae + 5cd674a commit 59e2833

File tree

5 files changed

+113
-64
lines changed

5 files changed

+113
-64
lines changed

.github/workflows/ci.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
on:
2+
push:
3+
branches: [ master ]
4+
pull_request:
5+
branches: [ master ]
6+
7+
name: Continuous integration
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
CARGO_INCREMENTAL: 0
12+
13+
jobs:
14+
tests:
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
include:
19+
- rust: 1.36.0 # MSRV
20+
features:
21+
- rust: stable
22+
features: serde
23+
- rust: stable
24+
features: rayon
25+
- rust: stable
26+
features: std
27+
- rust: beta
28+
features:
29+
- rust: nightly
30+
bench: test build benchmarks
31+
- rust: nightly
32+
features: test_low_transition_point
33+
34+
steps:
35+
- uses: actions/checkout@v2
36+
- uses: actions-rs/toolchain@v1
37+
with:
38+
profile: minimal
39+
toolchain: ${{ matrix.rust }}
40+
override: true
41+
- name: Tests
42+
run: |
43+
cargo build --verbose --features "${{ matrix.features }}"
44+
cargo doc --verbose --features "${{ matrix.features }}"
45+
cargo test --verbose --features "${{ matrix.features }}"
46+
cargo test --release --verbose --features "${{ matrix.features }}"
47+
- name: Tests (serde)
48+
if: matrix.features == 'serde'
49+
run: |
50+
cargo test --verbose -p test-serde
51+
- name: Test run benchmarks
52+
if: matrix.bench != ''
53+
run: cargo test -v --benches
54+
55+
nostd_build:
56+
runs-on: ubuntu-latest
57+
strategy:
58+
matrix:
59+
include:
60+
- rust: 1.36.0
61+
target: thumbv6m-none-eabi
62+
- rust: stable
63+
target: thumbv6m-none-eabi
64+
65+
steps:
66+
- uses: actions/checkout@v2
67+
- uses: actions-rs/toolchain@v1
68+
with:
69+
profile: minimal
70+
toolchain: ${{ matrix.rust }}
71+
override: true
72+
target: ${{ matrix.target }}
73+
- name: Tests
74+
run: |
75+
cargo build -vv --target=${{ matrix.target }}
76+
cargo build -v -p test-nostd --target=${{ matrix.target }}
77+
78+
clippy:
79+
runs-on: ubuntu-latest
80+
strategy:
81+
matrix:
82+
rust:
83+
- beta
84+
steps:
85+
- uses: actions/checkout@v2
86+
- uses: actions-rs/toolchain@v1
87+
with:
88+
profile: minimal
89+
toolchain: ${{ matrix.rust }}
90+
override: true
91+
components: clippy
92+
- run: cargo clippy
93+

.travis.yml

Lines changed: 0 additions & 55 deletions
This file was deleted.

README.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ indexmap
33

44
|build_status|_ |crates|_ |docs|_ |rustc|_
55

6+
.. |build_status| image:: https://github.com/bluss/indexmap/workflows/Continuous%20integration/badge.svg?branch=master
7+
.. _build_status: https://github.com/bluss/indexmap/actions
8+
69
.. |crates| image:: https://img.shields.io/crates/v/indexmap.svg
710
.. _crates: https://crates.io/crates/indexmap
811

9-
.. |build_status| image:: https://travis-ci.org/bluss/indexmap.svg
10-
.. _build_status: https://travis-ci.org/bluss/indexmap
11-
1212
.. |docs| image:: https://docs.rs/indexmap/badge.svg
1313
.. _docs: https://docs.rs/indexmap
1414

test-nostd/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,5 @@ edition = "2018"
77

88
[dependencies]
99
indexmap = { path = "..", features = ["serde-1"] }
10-
# no-std compatible hasher
11-
twox-hash = { version = "1.5", default-features = false }
1210

1311
[dev-dependencies]

test-nostd/src/lib.rs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,26 @@
11
#![no_std]
22

33
use core::hash::BuildHasherDefault;
4+
use core::hash::Hasher;
5+
use core::iter::FromIterator;
6+
47
use indexmap::IndexMap;
58
use indexmap::IndexSet;
6-
use twox_hash::XxHash64;
7-
type Map<K, V> = IndexMap<K, V, BuildHasherDefault<XxHash64>>;
8-
type Set<T> = IndexSet<T, BuildHasherDefault<XxHash64>>;
99

10-
use core::iter::FromIterator;
10+
#[derive(Default)]
11+
struct BadHasher(u64);
12+
13+
impl Hasher for BadHasher {
14+
fn finish(&self) -> u64 { self.0 }
15+
fn write(&mut self, bytes: &[u8]) {
16+
for &byte in bytes {
17+
self.0 += byte as u64
18+
}
19+
}
20+
}
21+
22+
type Map<K, V> = IndexMap<K, V, BuildHasherDefault<BadHasher>>;
23+
type Set<T> = IndexSet<T, BuildHasherDefault<BadHasher>>;
1124

1225
pub fn test_compile() {
1326
let mut map = Map::default();

0 commit comments

Comments
 (0)