Create Home page (Before and After Login) (#12) #13
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: Generate badges | |
on: | |
push: | |
branches: [ main ] | |
jobs: | |
create-branch: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Git | |
run: | | |
git config --global user.name 'Groupings Project' | |
git config --global user.email '[email protected]' | |
- name: Create the badges branch if it doesn't exist | |
run: | | |
branch_name="badges" | |
if ! git ls-remote --exit-code origin refs/heads/$branch_name; then | |
echo "Branch $branch_name does not exist. Creating it..." | |
git checkout --orphan $branch_name | |
git rm -rf . | |
git commit --allow-empty -m "Create $branch_name branch" | |
git push -u origin $branch_name | |
else | |
echo "Branch $branch_name already exists." | |
fi | |
generate-jest-badges: | |
needs: create-branch | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16.x | |
- name: Installing dependencies | |
run: | | |
cd ui | |
npm install | |
- name: Tests | |
run: | | |
cd ui | |
npm run test:coverage | |
- name: Switch to badges branch | |
run: | | |
git fetch | |
git switch badges | |
- name: Generating coverage badges | |
uses: jpb06/jest-badges-action@latest | |
with: | |
branches: '*' | |
coverage-summary-path: ui/coverage/coverage-summary.json | |
no-commit: true | |
target-branch: badges | |
- name: Commit and push badges | |
run: | | |
cd badges | |
if [[ `git status --porcelain *.svg` ]]; then | |
git config --global user.name 'Groupings Project' | |
git config --global user.email '[email protected]' | |
git add *.svg | |
git commit -m "Autogenerated Jest badges" *.svg | |
git push origin badges -f | |
fi | |
# Re-enable once UH Groupings API is added to this repo | |
# generate-jacoco-badges: | |
# needs: create-branch | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout repository | |
# uses: actions/checkout@v3 | |
# with: | |
# fetch-depth: 0 | |
# - name: Set up JDK 17 | |
# uses: actions/setup-java@v1 | |
# with: | |
# java-version: 17 | |
# - name: Build with Maven and Generate JaCoCo Report | |
# run: | | |
# mvn clean test jacoco:report -f api/pom.xml -D'logging.level.edu.hawaii.its.holiday=OFF' -D'logging.level.org.springframework=ERROR' -D'spring.main.banner-mode=off' | |
# mv api/target/ target/ | |
# - name: Switch to badges branch | |
# run: | | |
# git fetch | |
# git switch badges | |
# - name: Generate Jacoco Badge | |
# id: jacoco | |
# uses: cicirello/jacoco-badge-generator@v2 | |
# with: | |
# coverage-label: junit coverage | |
# badges-directory: badges | |
# generate-branches-badge: true | |
# - name: Log coverage percentage | |
# run: | | |
# echo "coverage = ${{ steps.jacoco.outputs.coverage }}" | |
# - name: Commit and push | |
# if: ${{ github.event_name != 'pull_request' }} | |
# run: | | |
# cd badges | |
# if [[ `git status --porcelain *.svg` ]]; then | |
# git config --global user.name 'Groupings Project' | |
# git config --global user.email '[email protected]' | |
# git add *.svg | |
# git commit -m "Autogenerated JaCoCo coverage badge" *.svg | |
# git push origin badges -f | |
# fi | |
# - name: Upload Jacoco coverage report | |
# uses: actions/upload-artifact@v2 | |
# with: | |
# name: jacoco-report | |
# path: target/site/jacoco/ |