clean up github workflows ui

This puts different kinds of tests in different job names, instead of
shoehorning them into the matrix.
This commit is contained in:
Brandon W Maister 2020-06-26 10:31:12 -04:00
parent 43db62eda3
commit c2fe38cd84
7 changed files with 148 additions and 73 deletions

View File

@ -1,4 +1,4 @@
name: Test
name: test
on:
push:
@ -12,20 +12,17 @@ jobs:
matrix:
os: [ubuntu-16.04, ubuntu-latest, macos-latest, windows-latest]
rust_version: [stable]
wasm: ['no_wasm']
core: ['std']
kind: ['test']
include:
# check all tzs on most-recent OS's
- os: ubuntu-latest
rust_version: stable
kind: lint
# check all tzs occasionally
- os: ubuntu-latest
rust_version: stable
exhaustive_tz: y
exhaustive_tz: all_tzs
- os: windows-latest
rust_version: stable
exhaustive_tz: y
exhaustive_tz: all_tzs
- os: macos-latest
rust_version: stable
exhaustive_tz: all_tzs
# test other rust versions
- os: ubuntu-latest
rust_version: beta
@ -36,17 +33,6 @@ jobs:
- os: macos-latest
rust_version: 1.13.0
# time doesn't work on windows with 1.13
# test wasmbind
- os: macos-latest
wasm: 'yes_wasm'
rust_version: stable
# test no_std
- os: macos-latest
core: 'no_std'
rust_version: stable
- os: ubuntu-latest
core: 'no_std'
rust_version: stable
runs-on: ${{ matrix.os }}
@ -54,31 +40,79 @@ jobs:
- uses: actions/checkout@v2
- name: Install rust
if: ${{ matrix.core == 'std' }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust_version }}
override: true
- name: Install rust with no_std toolchain
if: ${{ matrix.core == 'no_std' }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust_version }}
target: thumbv6m-none-eabi
override: true
- name: Install node
if: ${{ matrix.wasm == 'yes_wasm' }}
uses: actions/setup-node@v1
with:
node-version: '12'
- name: Build and Test
run: bash ci/github.sh
env:
RUST_VERSION: ${{ matrix.rust_version }}
CORE: ${{ matrix.core }}
WASM: ${{ matrix.wasm }}
EXHAUSTIVE_TZ: ${{ matrix.exhaustive_tz }}
KIND: ${{ matrix.kind }}
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Lint
run: bash ci/lint.sh
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
with:
check_together: 'y'
no_std:
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Install rust with no_std toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: thumbv6m-none-eabi
override: true
- name: Build no_std lib
run: cargo build --target thumbv6m-none-eabi --color=always
working-directory: ./ci/core-test
wasm:
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown
override: true
- name: Install node
uses: actions/setup-node@v1
with:
node-version: '12'
- name: Install wasm-pack
run: |
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
wasm-pack --version
- name: Build and Test
run: bash ci/github.sh
env:
RUST_VERSION: stable
WASM: wasm_simple

View File

@ -6,8 +6,8 @@
[![Chrono on docs.rs][docsrs-image]][docsrs]
[![Join the chat at https://gitter.im/chrono-rs/chrono][gitter-image]][gitter]
[gh-image]: https://github.com/chronotope/chrono/workflows/Test/badge.svg
[gh-checks]: https://github.com/chronotope/chrono/actions?query=workflow%3ATest
[gh-image]: https://github.com/chronotope/chrono/workflows/test/badge.svg
[gh-checks]: https://github.com/chronotope/chrono/actions?query=workflow%3Atest
[cratesio-image]: https://img.shields.io/crates/v/chrono.svg
[cratesio]: https://crates.io/crates/chrono
[docsrs-image]: https://docs.rs/chrono/badge.svg

19
ci/_shlib.sh Normal file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
# Use github workflow commands to make sections of the tests more obvious
# https://help.github.com/en/actions/reference/workflow-commands-for-github-actions
# Run a test as a "group" -- output will be folded and hidden by default
runt() {
echo "::group::$*"
# stdout is occasionally swallowed by gh actions
"$@" >&2
echo "::endgroup::$*"
}
runv() {
echo "🚀>$ $*" >&2
# stdout is occasionally swallowed by gh actions
"$@" >&2
}

View File

@ -13,8 +13,8 @@ echo '
[![Chrono on docs.rs][docsrs-image]][docsrs]
[![Join the chat at https://gitter.im/chrono-rs/chrono][gitter-image]][gitter]
[gh-image]: https://github.com/chronotope/chrono/workflows/Test/badge.svg
[gh-checks]: https://github.com/chronotope/chrono/actions?query=workflow%3ATest
[gh-image]: https://github.com/chronotope/chrono/workflows/test/badge.svg
[gh-checks]: https://github.com/chronotope/chrono/actions?query=workflow%3Atest
[cratesio-image]: https://img.shields.io/crates/v/chrono.svg
[cratesio]: https://crates.io/crates/chrono
[docsrs-image]: https://docs.rs/chrono/badge.svg
@ -24,9 +24,9 @@ echo '
# print the section between the header and the usage
awk '/^\/\/! # Chrono:/,/^\/\/! ## /' "$LIB" | cut -b 5- | grep -v '^#' | \
sed 's/](\.\//](https:\/\/docs.rs\/chrono\/'$VERSION'\/chrono\//g'
sed 's/](\.\//](https:\/\/docs.rs\/chrono\/'"$VERSION"'\/chrono\//g'
echo
# Replace relative doc links with links to this exact version of docs on
# docs.rs
awk '/^\/\/! ## /,!/^\/\/!/' "$LIB" | cut -b 5- | grep -v '^# ' | \
sed 's/](\.\//](https:\/\/docs.rs\/chrono\/'$VERSION'\/chrono\//g' \
sed 's/](\.\//](https:\/\/docs.rs\/chrono\/'"$VERSION"'\/chrono\//g' \

61
ci/github.sh Normal file → Executable file
View File

@ -2,24 +2,44 @@
set -euo pipefail
# shellcheck source=ci/_shlib.sh
source "${BASH_SOURCE[0]%/*}/_shlib.sh"
TEST_TZS=(ACST-9:30 EST4 UTC0 Asia/Katmandu)
FEATURES=(std serde clock "alloc serde")
RUST_113_FEATURES=(rustc-serialize serde)
main() {
if [[ $RUST_VERSION != 1.13.0 ]]; then
if [[ $KIND == lint ]]; then
do_lints
elif [[ $WASM == yes_wasm ]]; then
if [[ "$*" =~ "-h" ]]; then
echo -n "usage: ENV_VARS... $0
Recognized environment variables. Their values are as they are so that they are
meaningful in the github actions feature matrix UI.
RUST_VERSION The rust version currently being tested
This doesn't set the version, it is just used to test
WASM Empty or 'yes_wasm'
CORE 'std' or 'no_std'
EXHAUSTIVE_TZ Emptly or 'all_tzs'
"
exit
fi
runv cargo --version
if [[ ${RUST_VERSION:-} != 1.13.0 ]]; then
if [[ ${WASM:-} == yes_wasm ]]; then
test_wasm
elif [[ $CORE == no_std ]]; then
elif [[ ${WASM:-} == wasm_simple ]]; then
test_wasm_simple
elif [[ ${CORE:-} == no_std ]]; then
test_core
elif [[ $EXHAUSTIVE_TZ == y ]]; then
elif [[ ${EXHAUSTIVE_TZ:-} == all_tzs ]]; then
test_all_tzs
else
test_regular UTC0
fi
elif [[ $RUST_VERSION == 1.13.0 ]]; then
elif [[ ${RUST_VERSION:-} == 1.13.0 ]]; then
test_113
else
echo "ERROR: didn't run any tests"
@ -27,13 +47,6 @@ main() {
fi
}
do_lints() {
# TODO: get clippy clean
# runt cargo clippy --color=always || true
runt make readme
runv git diff --exit-code -- README.md
}
test_all_tzs() {
for tz in "${TEST_TZS[@]}"; do
test_regular "$tz"
@ -69,24 +82,18 @@ test_wasm() {
exit 1
fi
if ! command -v wasm-pack >/dev/null; then
echo ">$ curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh" >&2
echo "::group::curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh"
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
runv wasm-pack --version
fi
test_wasm_simple
}
test_wasm_simple() {
now=$(date +%s)
for tz in "${TEST_TZS[@]}"; do
runt env TZ="$tz" NOW="$now" wasm-pack test --node -- --features wasmbind
done
}
runt() {
echo "======================================================================" >&2
runv "$@"
}
runv() {
echo ">$ $*" >&2
# stdout is swallowed by gh actions
"$@" >&2
}
main
main "$@"

15
ci/lint.sh Executable file
View File

@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -euo pipefail
# shellcheck source=ci/_shlib.sh
source "${BASH_SOURCE[0]%/*}/_shlib.sh"
main() {
# TODO: get clippy clean
# runt cargo clippy --color=always || true
runt make readme
runv git diff --exit-code -- README.md
}
main

View File

@ -1,4 +1,4 @@
#[cfg(all(target_arch = "wasm32", not(target_os = "wasi"), feature = "wasmbind"))]
#[cfg(all(test, feature = "wasmbind"))]
mod test {
extern crate chrono;
extern crate wasm_bindgen_test;