Skip to content

Commit 5b32f5c

Browse files
authored
Merge pull request #4 from Bestowinc/maint/setup-gh-actions
MAINT: add tests in GH actions for all platforms
2 parents 5707541 + cf95695 commit 5b32f5c

File tree

2 files changed

+61
-3
lines changed

2 files changed

+61
-3
lines changed

.github/workflows/ci.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: "Continuous Integration"
2+
on: [push]
3+
4+
jobs:
5+
test:
6+
name: "Test"
7+
strategy:
8+
matrix:
9+
os: [ubuntu-latest, macos-latest, windows-latest]
10+
runs-on: "${{ matrix.os }}"
11+
steps:
12+
# Check out the code
13+
- uses: "actions/checkout@v2"
14+
15+
# We need node for some integration tests
16+
- uses: "actions/setup-node@v1"
17+
18+
# Set the current month and year (used for cache key)
19+
- name: "Get Date"
20+
id: get-date
21+
# Outputs e.g. "202007"
22+
# tbh I have yet to find the docs where this output format is
23+
# defined, but I copied this from the official cache action's README.
24+
run: |
25+
echo "::set-output name=date::$(/bin/date -u '+%Y%m')"
26+
shell: bash
27+
28+
# Generate the lockfile
29+
- name: "Generate Cargo Lockfile"
30+
run: "cargo generate-lockfile"
31+
32+
# Cache build dependencies
33+
- name: "Cache Build Fragments"
34+
id: "cache-build-fragments"
35+
uses: "actions/cache@v2"
36+
with:
37+
path: |
38+
~/.cargo/registry
39+
~/.cargo/git
40+
target
41+
# Rebuild whenever the cargo lock file changes
42+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
43+
44+
# Cache `cargo install` built binaries
45+
- name: "Cache Built Binaries"
46+
id: "cache-binaries"
47+
uses: "actions/cache@v2"
48+
with:
49+
path: "~/.cargo/bin"
50+
# In theory, this should rebuild binaries once a month
51+
key: "${{ runner.os }}-cargo-binaries-${{steps.get-date.outputs.date}}"
52+
53+
# Ensure we're all set up
54+
- name: "Perform Setup"
55+
run: "make setup"
56+
57+
# Run the tests
58+
- name: "Run Tests"
59+
run: "make test"

Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ develop-py:
2424
cd py && source ./venv/bin/activate && python ./setup.py develop
2525

2626
setup:
27-
cargo install wasm-pack
28-
python3 -m venv py/venv
27+
wasm-pack --version > /dev/null 2>&1 || cargo install wasm-pack
2928

3029
test:
31-
cargo test
30+
cargo test --all-features

0 commit comments

Comments
 (0)