0
0
Fork 0
mirror of https://github.com/denoland/rusty_v8.git synced 2024-11-28 16:21:04 -05:00
denoland-rusty-v8/.github/workflows/ci.yml

172 lines
5.7 KiB
YAML
Raw Normal View History

2019-10-31 21:01:29 -04:00
name: ci
on:
- push
- pull_request
2019-10-31 21:01:29 -04:00
jobs:
build:
name: ${{ matrix.config.variant }} ${{ matrix.config.target }}
if: |
github.event_name == 'push' ||
!startsWith(github.event.pull_request.head.label, 'denoland:')
runs-on: ${{ matrix.config.os }}
timeout-minutes: 120
2019-10-31 21:01:29 -04:00
strategy:
matrix:
config:
- os: macOS-latest
target: x86_64-apple-darwin
variant: "debug"
- os: macOS-latest
target: x86_64-apple-darwin
variant: "release"
- os: ubuntu-16.04
target: "x86_64-unknown-linux-gnu"
variant: "debug"
- os: ubuntu-16.04
target: "x86_64-unknown-linux-gnu"
variant: "release"
- os: windows-2019
target: x86_64-pc-windows-msvc
variant: "release"
# Note we do not support windows debug builds.
env:
V8_FROM_SOURCE: true
2019-10-31 21:01:29 -04:00
steps:
- name: Configure git
run: git config --global core.symlinks true
- name: Clone repository
uses: actions/checkout@v1
with:
fetch-depth: 10
submodules: "recursive"
2019-10-31 21:01:29 -04:00
- name: Install rust
uses: hecrj/setup-rust-action@v1
with:
2020-03-12 11:29:25 -04:00
rust-version: "1.42.0"
2019-10-31 21:01:29 -04:00
- name: Install rust tools
run: rustup component add clippy rustfmt
- name: Install python
uses: actions/setup-python@v1
with:
python-version: "2.7.x"
architecture: x64
2019-11-01 17:28:09 -04:00
# Cache https://github.com/actions/cache/blob/master/examples.md#rust---cargo
- name: Cache cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Install and start sccache
shell: pwsh
working-directory: ${{ runner.temp }}
2019-10-31 21:01:29 -04:00
env:
AWS_ACCESS_KEY_ID: AKIA6QEJVNZDGHRMR2KF
2019-10-31 21:01:29 -04:00
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SCCACHE_BUCKET: deno-sccache
SCCACHE_IDLE_TIMEOUT: 0
run: |
$version = "0.2.12"
$platform =
@{ "macOS" = "x86_64-apple-darwin"
"Linux" = "x86_64-unknown-linux-musl"
"Windows" = "x86_64-pc-windows-msvc"
}.${{ runner.os }}
$basename = "sccache-$version-$platform"
$url = "https://github.com/mozilla/sccache/releases/download/" +
"$version/$basename.tar.gz"
curl -LO $url
tar -xzvf "$basename.tar.gz"
. $basename/sccache --start-server
echo "::add-path::$(pwd)/$basename"
echo "::set-env name=RUSTC_WRAPPER::sccache"
2019-10-31 21:01:29 -04:00
- name: Test debug
if: matrix.config.variant == 'debug'
run: cargo test -vv --all-targets --locked --target ${{ matrix.config.target }}
2019-10-31 21:01:29 -04:00
- name: Clippy debug
if: matrix.config.variant == 'debug'
run: cargo clippy --all-targets --locked --target ${{ matrix.config.target }} -- -D clippy::all
- name: Test release
if: matrix.config.variant == 'release'
run: cargo test -vv --all-targets --locked --target ${{ matrix.config.target }} --release
- name: Clippy release
if: matrix.config.variant == 'release'
run: cargo clippy --all-targets --locked --target ${{ matrix.config.target }} --release -- -D clippy::all
2019-11-01 00:54:54 -04:00
- name: Rustfmt
run: cargo fmt -- --check
- name: Prepare Binary Publish - unix
if: runner.os != 'Windows'
run: |
cp target/${{ matrix.config.target }}/${{ matrix.config.variant }}/gn_out/obj/librusty_v8.a target/librusty_v8_${{ matrix.config.variant }}_${{ matrix.config.target }}.a
- name: Prepare Binary Publish - windows
if: runner.os == 'Windows'
run: |
cp target/${{ matrix.config.target }}/${{ matrix.config.variant }}/gn_out/obj/rusty_v8.lib target/rusty_v8_${{ matrix.config.variant }}_${{ matrix.config.target }}.lib
- name: Binary Publish
uses: softprops/action-gh-release@v1
if: github.repository == 'denoland/rusty_v8' && startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
target/librusty_v8_${{ matrix.config.variant }}_${{ matrix.config.target }}.a
target/rusty_v8_${{ matrix.config.variant }}_${{ matrix.config.target }}.lib
# TODO: add clang-format and maybe cpplint.
2020-01-15 15:14:39 -05:00
# TODO(ry) It would be ideal to check that "cargo package" also runs and
# that the resulting package is less than 10 MB. However it seems to
# result in a complete V8 rebuild. For now just be careful not to manually
# check that "cargo package" is working when updating the build.
# - name: Package
# run: cargo package -vv --locked
2019-12-04 01:45:50 -05:00
- name: Publish
# Only publish on x64 linux when there's a git tag:
if: >
startsWith(github.ref, 'refs/tags/') &&
github.repository == 'denoland/rusty_v8' &&
startsWith(matrix.config.target , 'x86_64') &&
matrix.config.variant == 'debug' &&
runner.os == 'Linux'
2019-12-04 01:45:50 -05:00
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish -vv
- name: Stop sccache
if: always()
run: sccache --stop-server