Enable build skips on PRs

Iff no source files are changed - skip the compute-intensive build
next
Sayan Nandan 4 years ago
parent 47831252b3
commit 2d04a4f841
No known key found for this signature in database
GPG Key ID: C31EFD7DDA12AEE0

@ -14,7 +14,6 @@ on:
pull_request:
env:
# TODO: Change variable to your image's name.
IMAGE_NAME: tdb
BUILD: "false"
@ -30,8 +29,8 @@ jobs:
fetch-depth: 2
- name: Setup environment
run: |
chmod +x ci/dockervars.sh
ci/dockervars.sh
chmod +x ci/buildvars.sh
ci/buildvars.sh
- name: Build image
run: docker build . --file Dockerfile --tag $IMAGE_NAME
if: env.BUILD == 'true' || github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v')

@ -14,4 +14,4 @@ jobs:
steps:
- uses: actions/labeler@v2
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
repo-token: "${{ secrets.TDBB }}"

@ -147,7 +147,7 @@ jobs:
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.TDBB }}
with:
tag_name: ${{ steps.get_version.outputs.VERSION }}
release_name: ${{ steps.get_version.outputs.VERSION }}
@ -171,7 +171,7 @@ jobs:
- name: Release Linux bundle
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.TDBB }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./linux/tdb-bundle-${{ steps.get_version.outputs.VERSION }}-${{ env.LINUX64_NAME }}.zip
@ -181,7 +181,7 @@ jobs:
- name: Release Windows bundle
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.TDBB }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./windows/tdb-bundle-${{ steps.get_version.outputs.VERSION }}-${{ env.WINDOWS64_NAME }}.zip
@ -191,7 +191,7 @@ jobs:
- name: Release MacOS bundle
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.TDBB }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./macos/tdb-bundle-${{ steps.get_version.outputs.VERSION }}-${{ env.MACOS64_NAME }}.zip

@ -1,7 +1,8 @@
name: Test (PR)
on: [pull_request]
env:
BUILD: "false"
jobs:
test:
name: Test
@ -9,12 +10,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
build:
[
linux-stable,
macos-stable,
windows-stable,
]
build: [linux-stable, macos-stable, windows-stable]
include:
- build: linux-stable
os: ubuntu-latest
@ -27,7 +23,14 @@ jobs:
rust: stable
steps:
- uses: actions/checkout@v2
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Setup environment
run: |
chmod +x ci/buildvars.sh
ci/buildvars.sh
- name: Cache Cargo registry
uses: actions/cache@v1
@ -37,7 +40,7 @@ jobs:
restore-keys: |
${{ matrix.build }}-cargo-registry-
# HACK(@ohsayan): The next line skips caching until it is fixed
if: runner.os != 'macOS'
if: runner.os != 'macOS' && env.BUILD == 'true'
- name: Cache Cargo index
uses: actions/cache@v1
@ -47,7 +50,7 @@ jobs:
restore-keys: |
${{ matrix.build }}-cargo-index-
# HACK(@ohsayan): The next line skips caching until it is fixed
if: runner.os != 'macOS'
if: runner.os != 'macOS' && env.BUILD == 'true'
- name: Cache Cargo build
uses: actions/cache@v1
@ -57,14 +60,16 @@ jobs:
restore-keys: |
${{ matrix.build }}-target-
# HACK(@ohsayan): The next line skips caching until it is fixed
if: runner.os != 'macOS'
if: runner.os != 'macOS' && env.BUILD == 'true'
- name: Install Rust
run: |
rustup update ${{ matrix.rust }} --no-self-update
rustup default ${{ matrix.rust }}
if: env.BUILD == 'true'
- name: Run Tests
run: cargo test --verbose -- --test-threads=1
env:
RUST_BACKTRACE: 1
RUST_BACKTRACE: 1
if: env.BUILD == 'true'

Loading…
Cancel
Save