Skip to content

Commit

Permalink
Update CI for transition from main branch
Browse files Browse the repository at this point in the history
  • Loading branch information
jhpratt committed Nov 17, 2020
1 parent 97e45ea commit c4619ea
Showing 1 changed file with 50 additions and 86 deletions.
136 changes: 50 additions & 86 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: Build

on:
push:
pull_request:
schedule:
- cron: "0 0 * * 6" # midnight on Saturdays
on: [push, pull_request]

jobs:
check-other-targets:
Expand Down Expand Up @@ -35,13 +31,6 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v2

- name: Cache installed binaries
uses: actions/cache@v2
id: cache-binaries
with:
path: ~/.cargo/bin
key: ${{ runner.os }}-cargo-hack

- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
Expand All @@ -51,13 +40,9 @@ jobs:
override: true

- name: Install cargo-hack
# uses: actions-rs/install@v0.1
# with:
# crate: cargo-hack
# version: ^0.3
# use-tool-cache: true
run: cargo +stable install cargo-hack
if: steps.cache-binaries.outputs.cache-hit != 'true'
shell: bash
run: |
curl -LsSf https://github.com/taiki-e/cargo-hack/releases/latest/download/cargo-hack-x86_64-unknown-linux-gnu.tar.gz | tar xzf - -C ~/.cargo/bin
- name: Cache cargo output
uses: actions/cache@v2
Expand All @@ -72,21 +57,39 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: hack
args: check --no-dev-deps --feature-powerset --optional-deps --skip default,libc,winapi,stdweb,std --target ${{ matrix.target.triple }}
args: |
check
--no-dev-deps
--feature-powerset
--optional-deps
--exclude-features default,libc,winapi,stdweb,std
--target ${{ matrix.target.triple }}
if: matrix.target.std == false

- name: Check feature powerset
uses: actions-rs/cargo@v1
with:
command: hack
args: check --no-dev-deps --feature-powerset --optional-deps --skip default,libc,winapi,stdweb,std --features std --target ${{ matrix.target.triple }}
args: |
check
--no-dev-deps
--feature-powerset
--optional-deps
--exclude-features default,libc,winapi,stdweb --features std
--target ${{ matrix.target.triple }}
if: matrix.rust == '1.32.0' && matrix.target.std == true

- name: Check feature powerset
uses: actions-rs/cargo@v1
with:
command: hack
args: check --no-dev-deps --feature-powerset --optional-deps --skip default,libc,winapi,stdweb --target ${{ matrix.target.triple }}
args: |
check
--no-dev-deps
--feature-powerset
--optional-deps
--exclude-features default,libc,winapi,stdweb
--target ${{ matrix.target.triple }}
if: matrix.rust != '1.32.0' && matrix.target.std == true

check-web:
Expand Down Expand Up @@ -116,11 +119,6 @@ jobs:
override: true

- name: Install cargo-web
# uses: actions-rs/install@v0.1
# with:
# crate: cargo-web
# version: ^0.6
# use-tool-cache: true
run: cargo +stable install cargo-web
if: steps.cache.outputs.cache-hit != 'true'

Expand Down Expand Up @@ -165,13 +163,6 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v2

- name: Cache installed binaries
uses: actions/cache@v2
id: cache-binaries
with:
path: ~/.cargo/bin
key: ${{ runner.os }}-cargo-hack

- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
Expand All @@ -180,20 +171,25 @@ jobs:
override: true

- name: Install cargo-hack
# uses: actions-rs/install@v0.1
# with:
# crate: cargo-hack
# version: ^0.3
# use-tool-cache: true
run: cargo +stable install cargo-hack
if: steps.cache-binaries.outputs.cache-hit != 'true'
shell: bash
run: |
host=$(rustc -Vv | grep host | sed 's/host: //')
if [[ $host =~ windows ]]; then
curl -LsSf https://github.com/taiki-e/cargo-hack/releases/latest/download/cargo-hack-${host}.zip -o cargo-hack.zip
7z x cargo-hack.zip -o$HOME/.cargo/bin
elif [[ $host =~ darwin|linux ]]; then
curl -LsSf https://github.com/taiki-e/cargo-hack/releases/latest/download/cargo-hack-${host}.tar.gz | tar xzf - -C ~/.cargo/bin
else
echo "unsupported operating system"
exit 1
fi
# This is a workaround for a known bug in GitHub Actions. See
# actions/cache#403 and rust-lang/cargo#8603 for details.
- name: Install GNU tar
run: |
brew install gnu-tar
echo "::add-path::/usr/local/opt/gnu-tar/libexec/gnubin"
echo "/usr/local/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH
if: matrix.os == 'macOS-latest'

- name: Cache cargo output
Expand All @@ -209,14 +205,24 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: hack
args: test --feature-powerset --optional-deps --skip default,libc,winapi,stdweb,std --features std --tests
args: |
test
--feature-powerset
--optional-deps
--exclude-features default,libc,winapi,stdweb --features std
--tests
if: matrix.rust == '1.32.0'

- name: Test feature powerset (--tests)
uses: actions-rs/cargo@v1
with:
command: hack
args: test --feature-powerset --optional-deps --skip default,libc,winapi,stdweb --tests
args: |
test
--feature-powerset
--optional-deps
--exclude-features default,libc,winapi,stdweb
--tests
if: matrix.rust != '1.32.0'

- name: Test documentation
Expand Down Expand Up @@ -276,45 +282,3 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features

documentation:
name: Documentation
runs-on: ubuntu-latest
# ensure docs only get pushed if everything else is successful
needs:
- check-other-targets
- check-web
- test
- fmt
- clippy

steps:
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false

- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true

- name: Build documentation
uses: actions-rs/cargo@v1
with:
command: doc
args: --all-features
env:
RUSTFLAGS: --cfg __time_02_docs
RUSTDOCFLAGS: --cfg __time_02_docs

- name: Publish documentation
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BRANCH: gh-pages
FOLDER: target/doc
SINGLE_COMMIT: true
if: github.event_name == 'push' && github.ref == format('refs/heads/{0}', github.event.repository.master_branch)

0 comments on commit c4619ea

Please sign in to comment.