use github actions (#3242)

* use github actions

* remove travis

* fix step name

* do less work

* switch to bundlewatch

* set proper branch

* fix repo name env variable

* try running on branch instead
This commit is contained in:
Evan Jacobs
2020-08-30 16:38:43 -04:00
committed by GitHub
parent 71c0fb8bc9
commit 106e5bbcf5
5 changed files with 226 additions and 331 deletions

60
.github/workflows/test.yml vendored Normal file
View File

@@ -0,0 +1,60 @@
name: test
on:
push:
branches:
- "*"
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node: ["10", "12", "14"]
steps:
- uses: actions/checkout@v2
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn --pure-lockfile
- name: Jest
run: yarn test
- name: Flow
run: yarn flow
if: matrix.node == '10'
- name: Lint
run: yarn lint
if: matrix.node == '10'
- name: Build
run: yarn build
if: matrix.node == '10'
env:
BUNDLEWATCH_GITHUB_TOKEN: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
CI_BRANCH: ${{ steps.extract_branch.outputs.branch }}
CI_COMMIT_SHA: ${{ github.sha }}
CI_REPO_NAME: ${{ github.event.repository.name }}
CI_REPO_OWNER: ${{ github.repository_owner }}