Skip to content

Commit

Permalink
Move CI to GitHub Actions (#1474)
Browse files Browse the repository at this point in the history
* clippy in tests

* add pull request workflow

* fix formatting

* add names to steps

* fix clippy

* update

* avoid mutable

* use wasm target

* install it too

* except there

* let's give chrome a spin

* clippy has some more to say

* only run specific tests

* fix tests on chrome

* add cache

* rename benchmark for consistency

* re-enable geckodriver

* clean up old files

* remove all mentions of Travis

* check all examples

* let's try with a bigger timeout

* test both browsers at the same time

* chrome really doesn't like me

* finish up

* run for pushes to master

* improve caching

* fix order in workspace members

* clippy use --all-targets

* rename workflow file

* Apply suggestions from code review

Co-authored-by: Justin Starry <justin.m.starry@gmail.com>

* use stable toolchain for lints

* run lints on nightly too

* add doctest for yew-stdweb

* allow failure for nightly clippy steps

* let's try it on the job level again

* always run all lint steps

* only run lints on stable toolchain

* use 'no_run' instead of 'ignore'

Co-authored-by: Justin Starry <justin.m.starry@gmail.com>
  • Loading branch information
siku2 and jstarry committed Aug 15, 2020
1 parent 28dd837 commit 55f7a42
Show file tree
Hide file tree
Showing 24 changed files with 274 additions and 152 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/autopublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: '12.x'
node-version: "12.x"
- name: Install dependencies
run: cd website && yarn install && cd ../
- name: Build site
Expand Down
File renamed without changes.
225 changes: 225 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
name: Pull Request

on:
pull_request:
push:
branches: [master]

jobs:
lint:
name: Format & Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
components: rustfmt, clippy

- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
yew-stdweb/target
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
cargo-${{ runner.os }}-
- name: Run fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

- name: Run clippy
if: always()
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-targets -- -D warnings

- name: Run clippy - yew with all features
if: always()
run: |
cd yew
cargo clippy --all-targets --features "cbor msgpack toml yaml" -- -D warnings
- name: Run clippy - yew-stdweb with all features
if: always()
run: |
cd yew-stdweb
cargo clippy --all-targets --features "cbor msgpack toml yaml" -- -D warnings
check_examples:
name: Check Examples
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal

- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
cargo-${{ runner.os }}-
- name: Run check
run: |
cd examples
cargo check --all-targets
doc_tests:
name: Documentation Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown
override: true
profile: minimal

- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
cargo-${{ runner.os }}-
- name: Run doctest
uses: actions-rs/cargo@v1
with:
command: test
args: --doc

- name: Run doctest - yew with features
run: |
cd yew
cargo test --doc --features "doc_test wasm_test yaml msgpack cbor toml"
- name: Run doctest - yew-stdweb with features
run: |
# Sadly we can't run the tests on yew-stdweb as the snippets use `yew`, not `yew_stdweb` so the imports wouldn't work.
# To fix this we just run them on yew but with yew-stdweb's default features enabled.
cd yew
cargo test --doc \
--no-default-features --features "services agent std_web" \
--features "doc_test wasm_test yaml msgpack cbor toml"
integration_tests:
name: Integration Tests on ${{ matrix.toolchain }}
runs-on: ubuntu-latest
services:
httpbin:
image: kennethreitz/httpbin@sha256:599fe5e5073102dbb0ee3dbb65f049dab44fa9fc251f6835c9990f8fb196a72b
ports:
- 8080:80

strategy:
matrix:
toolchain:
- 1.45.0 # MSRV
- stable

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
target: wasm32-unknown-unknown
override: true
profile: minimal

- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
yew-stdweb/target
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
cargo-${{ runner.os }}-
# FIXME: Only needed because of <https://github.com/rustwasm/wasm-bindgen/issues/2261>
- name: Install geckodriver
run: |
cd ~
mkdir geckodriver
curl --retry 5 -LO https://github.com/mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-linux64.tar.gz
tar -xzf geckodriver-*-linux64.tar.gz -C geckodriver
echo "::add-path::$HOME/geckodriver"
- name: Run tests - yew
env:
HTTPBIN_URL: "http://localhost:8080"
run: |
cd yew
wasm-pack test --chrome --firefox --headless -- --features "wasm_test httpbin_test"
- name: Run tests - yew-stdweb
env:
HTTPBIN_URL: "http://localhost:8080"
run: |
cd yew-stdweb
# FIXME: Chrome really doesn't seem to like yew-stdweb
wasm-pack test --firefox --headless -- --features "wasm_test httpbin_test"
- name: Run tests - yew-functional
run: |
cd yew-functional
wasm-pack test --chrome --firefox --headless
unit_tests:
name: Unit Tests on ${{ matrix.toolchain }}
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
- 1.45.0 # MSRV
- stable
- nightly

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
override: true
profile: minimal

- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
cargo-${{ runner.os }}-
- name: Run tests
run: |
packages=("yew-components" "yew-functional" "yew-macro" "yew-router" "yew-router-macro" "yew-router-route-parser" "yewtil")
for package in "${packages[@]}"; do
(cd "$package" && cargo test)
done
4 changes: 2 additions & 2 deletions .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ pull_request_rules:
- name: automatic merge on CI success - admin
conditions:
- author=@yewstack/maintainers
- status-success=Travis CI - Pull Request
- status-success~=Pull Request
- label=automerge
actions:
merge:
method: squash
- name: remove automerge label on CI failure
conditions:
- status-failure=Travis CI - Pull Request
- status-failure~=Pull Request
- label=automerge
actions:
label:
Expand Down
49 changes: 0 additions & 49 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ members = [
"examples/js_callback",
"examples/keyed_list",
"examples/large_table",
"examples/minimal_wp",
"examples/minimal",
"examples/minimal_wp",
"examples/mount_point",
"examples/multi_thread",
"examples/nested_list",
Expand Down
23 changes: 0 additions & 23 deletions ci/clear_cache.sh

This file was deleted.

15 changes: 0 additions & 15 deletions ci/install_cargo_web.sh

This file was deleted.

7 changes: 1 addition & 6 deletions yew-components/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
name = "yew-components"
version = "0.2.0"
edition = "2018"
authors = [
"Yew Maintainers <maintainers@yew.rs>",
]
authors = ["Yew Maintainers <maintainers@yew.rs>"]
repository = "https://github.com/yewstack/yew"
homepage = "https://github.com/yewstack/yew"
documentation = "https://docs.rs/yew-components/"
Expand All @@ -13,9 +11,6 @@ keywords = ["web", "asmjs", "webasm", "javascript"]
categories = ["gui", "web-programming"]
description = "A collection of community-created Yew components"

[badges]
travis-ci = { repository = "yewstack/yew" }

[dependencies]
wasm-bindgen = "0.2.60"
web-sys = "0.3"
Expand Down
4 changes: 0 additions & 4 deletions yew-functional/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ keywords = ["web", "wasm", "frontend", "webasm", "webassembly"]
categories = ["gui", "web-programming", "wasm"]
description = "A framework for making client-side single-page apps"


[badges]
travis-ci = { repository = "yewstack/yew" }

[dev-dependencies]
wasm-bindgen-test = "0.3.9"
web-sys = "0.3.36"
Expand Down
3 changes: 0 additions & 3 deletions yew-macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ keywords = ["web", "wasm", "frontend", "webasm", "webassembly"]
categories = ["gui", "web-programming", "wasm"]
description = "A framework for making client-side single-page apps"

[badges]
travis-ci = { repository = "yewstack/yew" }

[lib]
proc-macro = true

Expand Down
Loading

0 comments on commit 55f7a42

Please sign in to comment.