0
0
Fork 0
mirror of https://github.com/denoland/rusty_v8.git synced 2024-11-25 15:29:43 -05:00

Fix CI, simplify workflow, and use Github Actions cache instead of S3 (#340)

This commit is contained in:
Bert Belder 2020-04-04 22:24:08 +02:00
parent 054f6daae2
commit be179154a4
No known key found for this signature in database
GPG key ID: 7A77887B2E2ED461

View file

@ -38,6 +38,9 @@ jobs:
env:
V8_FROM_SOURCE: true
CARGO_VARIANT_FLAG: ${{ matrix.config.variant == 'release' && '--release' || '' }}
LIB_NAME: ${{ contains(matrix.config.target, 'windows') && 'rusty_v8' || 'librusty_v8' }}
LIB_EXT: ${{ contains(matrix.config.target, 'windows') && 'lib' || 'a' }}
steps:
- name: Configure git
@ -63,30 +66,36 @@ jobs:
python-version: "2.7.x"
architecture: x64
# Cache https://github.com/actions/cache/blob/master/examples.md#rust---cargo
- name: Cache cargo registry
uses: actions/cache@v1
- name: Configure cargo data directory
# After this point, all cargo registry and crate data is stored in
# $GITHUB_WORKSPACE/target/cargo. This allows us to cache only the files
# that are needed during the build process. Additionally, this works
# around a bug in the 'cache' action that causes directories outside of
# the workspace dir to be saved/restored incorrectly.
run: echo "::set-env name=CARGO_HOME::$(pwd)/target/cargo"
- name: Cache
uses: actions/cache@master
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') }}
# Note: rusty_v8 targets always get get rebuilt, and their outputs
# ('librusty_v8.rlib', the whole 'gn_out' directory, etc.) can be
# quite big, so we cache only those subdirectories of
# target/{debug|release} that contain the build output for crates that
# come from the registry. By additionally saving the sccache cache
# directory it's still possible to build v8 fast.
path: |-
target/cargo
target/sccache
target/*/.*
target/*/build
target/*/deps
key: ${{ matrix.config.target }}-${{ matrix.config.variant }}-${{ hashFiles('Cargo.lock') }}
- name: Install and start sccache
shell: pwsh
working-directory: ${{ runner.temp }}
env:
AWS_ACCESS_KEY_ID: AKIA6QEJVNZDGHRMR2KF
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SCCACHE_BUCKET: deno-sccache
SCCACHE_DIR: ${{ github.workspace }}/target/sccache
SCCACHE_CACHE_SIZE: 128M
SCCACHE_IDLE_TIMEOUT: 0
run: |
$version = "0.2.12"
@ -99,51 +108,36 @@ jobs:
$url = "https://github.com/mozilla/sccache/releases/download/" +
"$version/$basename.tar.gz"
cd ~
curl -LO $url
tar -xzvf "$basename.tar.gz"
. $basename/sccache --start-server
echo "::add-path::$(pwd)/$basename"
echo "::set-env name=RUSTC_WRAPPER::sccache"
- name: Test debug
if: matrix.config.variant == 'debug'
run: cargo test -vv --all-targets --locked --target ${{ matrix.config.target }}
- name: Test
run: cargo test -vv --all-targets --locked ${{ env.CARGO_VARIANT_FLAG }}
--target ${{ matrix.config.target }}
- 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
- name: Clippy
run: cargo clippy --all-targets --locked ${{ env.CARGO_VARIANT_FLAG }}
--target ${{ matrix.config.target }} -- -D clippy::all
- 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
run: cp
target/${{ matrix.config.target }}/${{ matrix.config.variant }}/gn_out/obj/${{ env.LIB_NAME }}.${{ env.LIB_EXT }}
target/${{ env.LIB_NAME }}_${{ matrix.config.variant }}_${{ matrix.config.target }}.${{ env.LIB_EXT }}
- 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
- 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
files: target/${{ env.LIB_NAME }}_${{ matrix.config.variant }}_${{ matrix.config.target }}.${{ env.LIB_EXT }}
# TODO: add clang-format and maybe cpplint.