Skip to content

Commit

Permalink
chore(build): activate GitHub workflow for PRs (#427)
Browse files Browse the repository at this point in the history
* pull_request, GitHub workflow, error annotations, cache
* custom_release, Travis expand branches allowed for prod-stable
  • Loading branch information
cdcabrera committed Oct 8, 2020
1 parent 705a1a1 commit b2cac20
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 1 deletion.
79 changes: 79 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Pull request
on:
pull_request:
branches: [ master, main, prod, stage, test**, qa**, dev**, ci** ]
env:
BRANCH: ${{ github.base_ref }}

jobs:
Integration-checks:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v2
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Set Node.js packages yarn cache directory
id: yarn-cache-dir
run: echo ::set-output name=CACHE_DIR::$(yarn cache dir)
- name: Node.js yarn cache
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir.outputs.CACHE_DIR }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn
- name: Node.js modules cache
uses: actions/cache@v2
id: modules-cache
with:
path: ${{ github.workspace }}/node_modules
key: ${{ runner.os }}-${{ matrix.node-version }}-modules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.node-version }}-modules
- name: Install Node.js packages
if: ${{ steps.modules-cache.outputs.cache-hit != 'true' }}
run: yarn install
- name: Lint and test
uses: actions/github-script@v2
with:
script: |
const { execSync } = require('child_process');
try {
console.log(`${execSync('yarn test', { stdio: 'pipe' })}`);
} catch ({ stdout, stderr }) {
core.setFailed(`${stdout}\n${stderr}`);
}
- name: Code coverage
if: ${{ success() }}
uses: codecov/codecov-action@v1
- name: Confirm beta integration
if: ${{ success() }}
uses: actions/github-script@v2
with:
script: |
const { execSync } = require('child_process');
try {
console.log(`${execSync('yarn build', { stdio: 'pipe' })}`);
} catch ({ stdout, stderr }) {
core.setFailed(`${stdout}\n${stderr}`);
}
env:
BUILD_STAGE: Beta
- name: Confirm stable integration
if: ${{ success() }}
uses: actions/github-script@v2
with:
script: |
const { execSync } = require('child_process');
try {
console.log(`${execSync('yarn build', { stdio: 'pipe' })}`);
} catch ({ stdout, stderr }) {
core.setFailed(`${stdout}\n${stderr}`);
}
env:
BUILD_STAGE: Stable
2 changes: 1 addition & 1 deletion .travis/custom_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ releaseProd()
release "prod-beta"
fi

if [[ "${TRAVIS_BRANCH}" = "prod-stable" || "${TRAVIS_BRANCH}" = "master" ]] && [[ $TRAVIS_BUILD_STAGE_NAME != *"Beta"* ]]; then
if [[ "${TRAVIS_BRANCH}" = "prod-stable" || "${TRAVIS_BRANCH}" = "prod" || "${TRAVIS_BRANCH}" = "main" || "${TRAVIS_BRANCH}" = "master" ]] && [[ $TRAVIS_BUILD_STAGE_NAME != *"Beta"* ]]; then
release "prod-stable"
fi
}
Expand Down

0 comments on commit b2cac20

Please sign in to comment.