ch(): add github actions #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: REACT CI | ||
on: | ||
push: | ||
branches: [develop] | ||
pull_request: | ||
branches: [develop] | ||
jobs: | ||
build: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
node-version: [18.x] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} on ${{ matrix.os }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
# basically install but only installs from package-lock | ||
- run: npm install | ||
- run: npm run test | ||
- run: npm run build | ||
# Only run the coverage once | ||
- if: ${{ matrix.node-version == '18.x' }} | ||
name: Get Coverage for badge | ||
run: | | ||
SUMMARY="$(npm test -- --coverageReporters='text-summary' | tail -2 | head -1)" | ||
TOKENS=($SUMMARY) | ||
echo "COVERAGE=$(echo ${TOKENS[2]})" >> $GITHUB_ENV | ||
REF=${{ github.ref }} | ||
echo "github.ref: $REF" | ||
IFS='/' read -ra PATHS <<< "$REF" | ||
BRANCH_NAME="${PATHS[1]}_${PATHS[2]}" | ||
echo $BRANCH_NAME | ||
echo "BRANCH=$(echo ${BRANCH_NAME})" >> $GITHUB_ENV | ||
- if: ${{ matrix.node-version == '18.x' }} | ||
name: Create the Badge | ||
uses: schneegans/[email protected] | ||
with: | ||
auth: ${{ GIST_SECRET }} | ||
Check failure on line 46 in .github/workflows/react.js.yml GitHub Actions / REACT CIInvalid workflow file
|
||
gistID: bb004cee80333ad764ae128f0c7815d2 | ||
filename: atlp-devpulse-fn_${{ env.BRANCH }}.json | ||
label: Test Coverage | ||
message: ${{ env.COVERAGE }} | ||
color: 'blue,555,daf' | ||
namedLogo: jest |