wip #488
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rust | |
on: | |
push: | |
branches: [ master ] | |
env: | |
CARGO_TERM_COLOR: always | |
RUSTFLAGS: -D warnings | |
jobs: | |
build-test-win: | |
#if: ${{ false }} | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Install stable toolchain (windows) | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
target: x86_64-pc-windows-gnu | |
override: true | |
- name: Setup (windows) | |
run: | | |
$env:PATH = "C:\msys64\mingw64\bin;C:\msys64\usr\bin;$env:PATH" | |
echo "PATH=${env:PATH}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
echo "CARGO_BUILD_TARGET=x86_64-pc-windows-gnu" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
- name: Build (windows) | |
run: | | |
cargo clean | |
cargo build | |
- name: Test (windows) | |
run: | | |
cargo test | |
build-test-mac: | |
runs-on: macOs-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build | |
run: cargo build --verbose | |
- name: Run tests | |
run: cargo test --verbose | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Prepare | |
run: | | |
sudo apt update | |
sudo apt install ccache llvm autoconf2.13 automake clang valgrind -y | |
- name: Cache cargo registry | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cargo/registry | |
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.toml') }} | |
- name: Cache cargo index | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cargo/git | |
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.toml') }} | |
- name: Ccache | |
uses: actions/cache@v2 | |
with: | |
path: ~/.ccache | |
key: ${{ runner.OS }}-ccache-${{ hashFiles('**\Cargo.toml') }} | |
- name: Build | |
run: | | |
export SHELL=/bin/bash | |
export CC=/usr/bin/clang | |
export CXX=/usr/bin/clang++ | |
ccache -z | |
CCACHE=$(which ccache) cargo build --verbose | |
ccache -s | |
cargo clean | |
- name: Format | |
run: | | |
cargo fmt | |
- name: Commit fmt files | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git commit -m "autofmt" -a || true | |
git push "https://${{ github.actor }}:${{ secrets.GH_TOKEN }}@github.com/${{ github.repository }}.git" HEAD:${{ github.ref }} || true | |
- name: Doc | |
run: | | |
cargo doc | |
- name: Commit docs | |
run: | | |
cp -r ./target/doc /tmp | |
cd /tmp/doc | |
git init | |
echo '<!DOCTYPE html><html><head><title>Redirect</title><meta http-equiv = "refresh" content = "0; url = https://hirofa.github.io/quickjs_es_runtime/quickjs_runtime/index.html" /></head><body><p>Redirecting</p></body></html>' >> index.html | |
git add . | |
git remote add origin https://github.com/${{ github.repository }}.git | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git commit -m "doc" -a || true | |
git push "https://${{ github.actor }}:${{ secrets.GH_TOKEN }}@github.com/${{ github.repository }}.git" HEAD:gh-pages --force || true | |
- name: Deploy to gh-pages | |
run: | | |
curl -X POST https://api.github.com/repos/${{ github.repository }}/pages/builds -H "Accept: application/vnd.github.mister-fantastic-preview+json" -u ${{ github.actor }}:${{ secrets.GH_TOKEN }} | |
- name: Run tests | |
run: cargo test --verbose | |
- name: Clippy check | |
uses: actions-rs/clippy-check@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
test-and-valgrind: | |
if: ${{ false }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Prepare | |
run: | | |
sudo apt update | |
sudo apt install ccache llvm autoconf2.13 automake clang valgrind -y | |
- name: Cache cargo registry | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cargo/registry | |
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.toml') }} | |
- name: Cache cargo index | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cargo/git | |
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.toml') }} | |
- name: Ccache | |
uses: actions/cache@v2 | |
with: | |
path: ~/.ccache | |
key: ${{ runner.OS }}-ccache-${{ hashFiles('**\Cargo.toml') }} | |
- name: Build | |
run: | | |
export SHELL=/bin/bash | |
export CC=/usr/bin/clang | |
export CXX=/usr/bin/clang++ | |
ccache -z | |
CCACHE=$(which ccache) cargo build --verbose | |
ccache -s | |
cargo clean | |
cargo build | |
- name: Run tests | |
run: cargo test --verbose | |
- name: Valgrind | |
run: | | |
find ./target/debug/deps/quickjs_runtime-* -maxdepth 1 -type f -executable | xargs valgrind --leak-check=full --error-exitcode=1 |