0
0
Fork 0
mirror of https://github.com/denoland/rusty_v8.git synced 2024-12-01 16:51:32 -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: env:
V8_FROM_SOURCE: true 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: steps:
- name: Configure git - name: Configure git
@ -63,30 +66,36 @@ jobs:
python-version: "2.7.x" python-version: "2.7.x"
architecture: x64 architecture: x64
# Cache https://github.com/actions/cache/blob/master/examples.md#rust---cargo - name: Configure cargo data directory
- name: Cache cargo registry # After this point, all cargo registry and crate data is stored in
uses: actions/cache@v1 # $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: with:
path: ~/.cargo/registry # Note: rusty_v8 targets always get get rebuilt, and their outputs
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} # ('librusty_v8.rlib', the whole 'gn_out' directory, etc.) can be
- name: Cache cargo index # quite big, so we cache only those subdirectories of
uses: actions/cache@v1 # target/{debug|release} that contain the build output for crates that
with: # come from the registry. By additionally saving the sccache cache
path: ~/.cargo/git # directory it's still possible to build v8 fast.
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} path: |-
- name: Cache cargo build target/cargo
uses: actions/cache@v1 target/sccache
with: target/*/.*
path: target target/*/build
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} target/*/deps
key: ${{ matrix.config.target }}-${{ matrix.config.variant }}-${{ hashFiles('Cargo.lock') }}
- name: Install and start sccache - name: Install and start sccache
shell: pwsh shell: pwsh
working-directory: ${{ runner.temp }}
env: env:
AWS_ACCESS_KEY_ID: AKIA6QEJVNZDGHRMR2KF SCCACHE_DIR: ${{ github.workspace }}/target/sccache
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} SCCACHE_CACHE_SIZE: 128M
SCCACHE_BUCKET: deno-sccache
SCCACHE_IDLE_TIMEOUT: 0 SCCACHE_IDLE_TIMEOUT: 0
run: | run: |
$version = "0.2.12" $version = "0.2.12"
@ -99,51 +108,36 @@ jobs:
$url = "https://github.com/mozilla/sccache/releases/download/" + $url = "https://github.com/mozilla/sccache/releases/download/" +
"$version/$basename.tar.gz" "$version/$basename.tar.gz"
cd ~
curl -LO $url curl -LO $url
tar -xzvf "$basename.tar.gz" tar -xzvf "$basename.tar.gz"
. $basename/sccache --start-server . $basename/sccache --start-server
echo "::add-path::$(pwd)/$basename" echo "::add-path::$(pwd)/$basename"
echo "::set-env name=RUSTC_WRAPPER::sccache"
- name: Test debug - name: Test
if: matrix.config.variant == 'debug' run: cargo test -vv --all-targets --locked ${{ env.CARGO_VARIANT_FLAG }}
run: cargo test -vv --all-targets --locked --target ${{ matrix.config.target }} --target ${{ matrix.config.target }}
- name: Clippy debug - name: Clippy
if: matrix.config.variant == 'debug' run: cargo clippy --all-targets --locked ${{ env.CARGO_VARIANT_FLAG }}
run: cargo clippy --all-targets --locked --target ${{ matrix.config.target }} -- -D clippy::all --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: Rustfmt - name: Rustfmt
run: cargo fmt -- --check run: cargo fmt -- --check
- name: Prepare Binary Publish - unix - name: Prepare binary publish
if: runner.os != 'Windows' run: cp
run: | target/${{ matrix.config.target }}/${{ matrix.config.variant }}/gn_out/obj/${{ env.LIB_NAME }}.${{ env.LIB_EXT }}
cp target/${{ matrix.config.target }}/${{ matrix.config.variant }}/gn_out/obj/librusty_v8.a target/librusty_v8_${{ matrix.config.variant }}_${{ matrix.config.target }}.a target/${{ env.LIB_NAME }}_${{ matrix.config.variant }}_${{ matrix.config.target }}.${{ env.LIB_EXT }}
- name: Prepare Binary Publish - windows - name: Binary publish
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 uses: softprops/action-gh-release@v1
if: github.repository == 'denoland/rusty_v8' && startsWith(github.ref, 'refs/tags/') if: github.repository == 'denoland/rusty_v8' && startsWith(github.ref, 'refs/tags/')
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
files: | files: target/${{ env.LIB_NAME }}_${{ matrix.config.variant }}_${{ matrix.config.target }}.${{ env.LIB_EXT }}
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. # TODO: add clang-format and maybe cpplint.