Skip to content

Commit

Permalink
Update ci.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
nolanpro committed Jul 31, 2024
1 parent 5033c8b commit a71c391
Showing 1 changed file with 109 additions and 97 deletions.
206 changes: 109 additions & 97 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,38 @@ jobs:
strategy:
fail-fast: false # https://github.com/cypress-io/github-action/issues/48
matrix:
containers: [0, 1, 2, 3, 4]
# containers: [0, 1, 2, 3, 4]
containers: [0]

steps:
- name: Checkout 🛎
- name: Checkout screen builder
uses: actions/checkout@v4

- uses: actions-ecosystem/action-regex-match@v2
id: regex-match
id: install-vfe
with:
text: ${{ github.event.pull_request.body }}
regex: 'ci:vue-form-elements:(.*?)[\s\n\r]'
flags: 's'

- name: debug
run: echo got '${{ steps.regex-match.outputs.group1 }}'
regex: 'ci:vue-form-elements:([^\s]+)'

- name: set-vfe-branch
run: |
export VFE_BRANCH=''
if [[ ${{ steps.install-vfe.outputs.match != '' }} ]]; then
export VFE_BRANCH=${{ steps.install-vfe.outputs.match }}
fi
if [[ ${{ contains(github.event.pull_request.body, 'ci:next') }} ]]; then
export VFE_BRANCH=next
fi
echo "VFE_BRANCH=${VFE_BRANCH}" >> $GITHUB_ENV
- name: Checkout vue-form-elements
if: ${{ env.VFE_BRANCH != '' }}
uses: actions/checkout@v4
with:
repository: ProcessMaker/vue-form-elements
path: vue-form-elements
ref: ${{ env.VFE_BRANCH }}

- name: Checkout 🛎
run: git clone --depth 1 -b ${{ steps.regex-match.outputs.group1 }} https://github.com/ProcessMaker/vue-form-elements
if: ${{ steps.regex-match.outputs.match != null }}

- name: Setup node env 🏗
uses: actions/setup-node@master
with:
Expand All @@ -38,15 +50,15 @@ jobs:
cache: 'npm'

- name: Install vue-form-elements dependencies
if: ${{ steps.regex-match.outputs.match != null }}
if: ${{ env.VFE_BRANCH != '' }}
working-directory: vue-form-elements
run: npm ci && npm run build-bundle

- name: Install dependencies 👨🏻‍💻
run: npm ci

- name: Link vue-form-elements
if: ${{ steps.regex-match.outputs.match != null }}
if: ${{ env.VFE_BRANCH != '' }}
run: npm link ./vue-form-elements

# - name: Run linter 👀
Expand All @@ -55,90 +67,90 @@ jobs:
# - name: Run tests 🧪
# run: npm run test

- name: Cypress run
uses: cypress-io/github-action@v6
with:
browser: chrome
install: false
start: npm run dev
wait-on: 'http://localhost:5173/'
config-file: cypress.config.js
spec: "tests/e2e/**/*"
record: true
parallel: true
group: 'CI - Chrome'
env:
# For recording and parallelization to work you must set your CYPRESS_RECORD_KEY
# in GitHub repo → Settings → Secrets → Actions
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
# Creating a token https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }}
COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }}
# re-enable PR comment bot
COMMIT_INFO_SHA: ${{github.event.pull_request.head.sha}}
- name: Upload Cypress Screenshots
uses: actions/upload-artifact@v4
# Only capture images on failure
if: failure()
with:
name: cypress-screenshots
path: tests/e2e/screenshots
# - name: Cypress run
# uses: cypress-io/github-action@v6
# with:
# browser: chrome
# install: false
# start: npm run dev
# wait-on: 'http://localhost:5173/'
# config-file: cypress.config.js
# spec: "tests/e2e/**/*"
# record: true
# parallel: true
# group: 'CI - Chrome'
# env:
# # For recording and parallelization to work you must set your CYPRESS_RECORD_KEY
# # in GitHub repo → Settings → Secrets → Actions
# CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
# # Creating a token https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
# GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }}
# COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }}
# # re-enable PR comment bot
# COMMIT_INFO_SHA: ${{github.event.pull_request.head.sha}}
# - name: Upload Cypress Screenshots
# uses: actions/upload-artifact@v4
# # Only capture images on failure
# if: failure()
# with:
# name: cypress-screenshots
# path: tests/e2e/screenshots

- name: Upload Cypress Videos
uses: actions/upload-artifact@v4
# Only capture videos on failure
if: failure()
with:
name: cypress-videos
path: tests/e2e/videos
- run: ls -l .
- run: ls -R coverage .nyc_output
# - name: Upload Cypress Videos
# uses: actions/upload-artifact@v4
# # Only capture videos on failure
# if: failure()
# with:
# name: cypress-videos
# path: tests/e2e/videos
# - run: ls -l .
# - run: ls -R coverage .nyc_output

- name: Prepare coverage
run: cp .nyc_output/out.json coverage/coverage-${{ matrix.containers }}.json
- name: Archive code coverage
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.containers }}
path: ./coverage/coverage-${{ matrix.containers }}.json
coverage:
needs: e2e
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎
uses: actions/checkout@v4
# - name: Prepare coverage
# run: cp .nyc_output/out.json coverage/coverage-${{ matrix.containers }}.json
# - name: Archive code coverage
# uses: actions/upload-artifact@v4
# with:
# name: coverage-${{ matrix.containers }}
# path: ./coverage/coverage-${{ matrix.containers }}.json
# coverage:
# needs: e2e
# runs-on: ubuntu-latest
# steps:
# - name: Checkout 🛎
# uses: actions/checkout@v4

- name: Setup node env 🏗
uses: actions/setup-node@v4
with:
node-version: 20
check-latest: true
cache: 'npm'
# - name: Setup node env 🏗
# uses: actions/setup-node@v4
# with:
# node-version: 20
# check-latest: true
# cache: 'npm'

- name: Install dependencies 👨🏻‍💻
run: npm ci
- name: Create reports folder
run: mkdir reports .nyc_output
- name: Download all workflow run artifacts
uses: actions/download-artifact@v4
with:
path: reports
merge-multiple: true
- name: Run Coverage
run: |
npx nyc merge reports
mv coverage.json .nyc_output/out.json
- name: Create coverage report
run: npx nyc report --reporter html --reporter text --reporter json-summary --reporter lcov --report-dir coverage
- name: Store Artifacts
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
path: |
coverage
.nyc_output
reports
scan:
needs: coverage
uses: ./.github/workflows/sonarqube.yml
secrets: inherit
# - name: Install dependencies 👨🏻‍💻
# run: npm ci
# - name: Create reports folder
# run: mkdir reports .nyc_output
# - name: Download all workflow run artifacts
# uses: actions/download-artifact@v4
# with:
# path: reports
# merge-multiple: true
# - name: Run Coverage
# run: |
# npx nyc merge reports
# mv coverage.json .nyc_output/out.json
# - name: Create coverage report
# run: npx nyc report --reporter html --reporter text --reporter json-summary --reporter lcov --report-dir coverage
# - name: Store Artifacts
# uses: actions/upload-artifact@v4
# with:
# name: code-coverage-report
# path: |
# coverage
# .nyc_output
# reports
# scan:
# needs: coverage
# uses: ./.github/workflows/sonarqube.yml
# secrets: inherit

0 comments on commit a71c391

Please sign in to comment.