env:
RUSTFLAGS: -D warnings
RUSTUP_TOOLCHAIN: nightly-2021-03-24
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
ofl:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@master
- run: rustup install ${{ env.RUSTUP_TOOLCHAIN }}
- name: ensure lockfile up to date
run: cargo generate-lockfile --manifest-path ofl/Cargo.toml
- name: install gnu tar to work around https://github.com/actions/cache/issues/403
if: matrix.os == 'macos-latest'
run: |
brew install gnu-tar
echo PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH" >> $GITHUB_ENV
- uses: actions/cache@v2
with:
key: ${{ runner.os }}-ofl-${{ hashFiles('ofl/Cargo.lock') }}-${{ env.RUSTUP_TOOLCHAIN }}-2
path: |
~/.cargo/git
~/.cargo/registry
ofl/target/release
- run: cargo build --release
working-directory: ofl
- run: cargo test --release
working-directory: ofl
- uses: actions/upload-artifact@v2
with:
name: ofl-${{ runner.os }}
path: ofl/target/release/ofl*
coverage:
needs: ofl
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@master
- run: rustup install ${{ env.RUSTUP_TOOLCHAIN }}
- run: rustup component add llvm-tools-preview
- uses: actions/download-artifact@v2
with:
name: ofl-${{ runner.os }}
path: bin/
- run: chmod +x bin/ofl
if: runner.os != 'Windows'
- name: ensure lockfile up to date
run: cargo generate-lockfile
- name: install gnu tar to work around https://github.com/actions/cache/issues/403
if: matrix.os == 'macos-latest'
run: |
brew install gnu-tar
echo PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH" >> $GITHUB_ENV
- uses: actions/cache@v2
with:
key: ${{ runner.os }}-coverage-${{ hashFiles('Cargo.lock') }}-${{ env.RUSTUP_TOOLCHAIN }}-2
path: |
~/.cargo/git
~/.cargo/registry
target
- run: bin/ofl coverage collect test-core
- run: bin/ofl coverage collect test-core-doc
- run: bin/ofl coverage collect test-dom
- run: bin/ofl coverage collect test-dom-doc
- run: bin/ofl coverage report
- run: bin/ofl coverage cleanup
- uses: codecov/codecov-action@v1
with:
file: ./target/coverage/lcov.info
dom:
needs: ofl
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@master
- run: rustup install ${{ env.RUSTUP_TOOLCHAIN }}
- uses: actions/download-artifact@v2
with:
name: ofl-${{ runner.os }}
path: bin/
- run: chmod +x bin/ofl
if: runner.os != 'Windows'
- name: ensure lockfile up to date
run: cargo generate-lockfile
- name: install gnu tar to work around https://github.com/actions/cache/issues/403
if: matrix.os == 'macos-latest'
run: |
brew install gnu-tar
echo PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH" >> $GITHUB_ENV
- uses: actions/cache@v2
with:
key: ${{ runner.os }}-dom-${{ hashFiles('Cargo.lock') }}-${{ env.RUSTUP_TOOLCHAIN }}-2
path: |
~/.cargo/git
~/.cargo/registry
target
- run: cargo test-prettiest
- run: cargo test-augdom
- run: cargo test-dom-lib-browser
- run: cargo test-dom-counter-fn
- run: cargo test-dom-dom-builder
- run: cargo test-dom-hacking
- run: cargo test-dom-todo
- run: cargo test-dom-drivertest
website:
needs: ofl
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@master
- run: rustup install ${{ env.RUSTUP_TOOLCHAIN }}
- uses: actions/download-artifact@v2
with:
name: ofl-${{ runner.os }}
path: bin/
- run: chmod +x bin/ofl
if: runner.os != 'Windows'
- name: ensure lockfile up to date
run: cargo generate-lockfile
- name: install gnu tar to work around https://github.com/actions/cache/issues/403
if: matrix.os == 'macos-latest'
run: |
brew install gnu-tar
echo PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH" >> $GITHUB_ENV
- uses: actions/cache@v2
with:
key: ${{ runner.os }}-website-${{ hashFiles('Cargo.lock') }}-${{ env.RUSTUP_TOOLCHAIN }}-2
path: |
~/.cargo/git
~/.cargo/registry
ofl/target/doc
target
- run: cargo build-dom-counter-fn
- run: cargo build-dom-dom-builder
- run: cargo build-dom-hacking
- run: cargo build-dom-todo
- run: cargo docs-all
- run: cargo docs-ofl
- run: bin/ofl website build target/website
- uses: actions/upload-artifact@v2
if: runner.os == 'Linux'
with:
name: website
path: target/website
fmt:
needs: ofl
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- run: rustup install ${{ env.RUSTUP_TOOLCHAIN }}
- run: rustup component add rustfmt
- uses: actions/download-artifact@v2
with:
name: ofl-${{ runner.os }}
path: bin/
- run: chmod +x bin/ofl
- run: bin/ofl fmt --check
clippy:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@master
- run: rustup install ${{ env.RUSTUP_TOOLCHAIN }}
- run: rustup component add clippy
- run: cargo clippy-ofl
- run: cargo clippy-core
- run: cargo clippy-dom
publish:
if: github.ref == 'refs/heads/main'
needs: [clippy, coverage, dom, fmt, ofl, website]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- run: rustup install ${{ env.RUSTUP_TOOLCHAIN }}
- uses: actions/download-artifact@v2
with:
name: ofl-${{ runner.os }}
path: bin/
- run: chmod +x bin/ofl
- uses: actions/download-artifact@v2
with:
name: website
path: target/website
- name: promote website to prod, ensure crates published
run: |
npx netlify-cli deploy --prod --auth ${{ secrets.NETLIFY_AUTH_TOKEN }}
cargo login ${{ secrets.CARGO_API_TOKEN }}
bin/ofl published
git push origin --tags