Skip to content

Instantly share code, notes, and snippets.

@leon
Created March 1, 2020 17:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leon/29350ce4734b955cee924586705ea875 to your computer and use it in GitHub Desktop.
Save leon/29350ce4734b955cee924586705ea875 to your computer and use it in GitHub Desktop.
Nrwl NX github actions
name: Test develop and feature branches
on:
push:
branches:
- develop
- "feature/*"
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Use node.js 12
uses: actions/setup-node@v1
with:
node-version: 12
- name: Cache Yarn
uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.OS }}-yarn-${{ env.cache-name }}-
${{ runner.os }}-yarn-
- name: Yarn install
run: yarn install --frozen-lockfile --non-interactive
- name: Retreive last test sha
id: last-test-sha
run: |
if [[ $GITHUB_BASE_REF ]]
then
echo "::set-output name=sha::remotes/origin/$GITHUB_BASE_REF"
else
echo "::set-output name=sha::$(git rev-parse HEAD~1)"
fi
- name: Run affected tests
run: yarn affected:test --ci --runInBand --base=${{ steps.last-test-sha.outputs.sha }} --head=${GITHUB_SHA}
env:
CI: "true"
TZ: "utc"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment