Skip to content

chore: prepare v1.0.0 #280

chore: prepare v1.0.0

chore: prepare v1.0.0 #280

Workflow file for this run

# Name of our workflow
name: 'Test and release'
# Events that will trigger our workflow
on: [ 'pull_request', 'push' ]
# List of custom jobs
jobs:
# Job is called "test"
test:
# Using a "label" to assign job to a specific hosted runner
runs-on: ubuntu-latest
steps:
# Checks-out our repository under "$GITHUB_WORKSPACE", so our job can access it
- name: 'Checkout repository'
uses: actions/checkout@v3
with:
fetch-depth: 0
# Test and output coverage report
- name: 'Run tests'
working-directory: ./javascript
run: npm ci && npx nyc ava && npx nyc report --reporter cobertura --reporter json-summary
# lint the commit message to ensure it can be included in the changelog later
- name: Validate current commit (last commit) with commitlint
if: github.event_name == 'push'
run: NODE_PATH="${{ github.workspace }}/javascript/node_modules" ./javascript/node_modules/.bin/commitlint --from HEAD~1 --to HEAD --verbose
# all commits in a PR should conform, in the occasion that we do not squash it
- name: Validate PR commits with commitlint
if: github.event_name == 'pull_request'
run: NODE_PATH="${{ github.workspace }}/javascript/node_modules" ./javascript/node_modules/.bin/commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose
# Get the coverage report and add a coverage comment
- name: Code Coverage Report
uses: irongut/CodeCoverageSummary@v1.3.0
with:
filename: ./javascript/coverage/cobertura-coverage.xml
badge: true
fail_below_min: true
format: markdown
hide_branch_rate: false
hide_complexity: false
indicators: true
output: both
thresholds: '60 80'
- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request'
with:
recreate: true
path: code-coverage-results.md
- name: Create Coverage Badges
uses: jaywcjlove/coverage-badges-cli@main
with:
style: flat
source: ./javascript/coverage/coverage-summary.json
output: ./javascript/coverage/badges.svg
# Build a release from this version and archive it for testing
- name: 'build release'
working-directory: ./javascript
run: ./build-release.sh
- name: Save short sha to env
run: |
calculatedSha=$(git rev-parse --short ${{ github.sha }})
echo "short_sha=$calculatedSha" >> "$GITHUB_ENV"
- name: test artifacts
uses: actions/upload-artifact@v3
with:
name: GLRepl-${{ env.short_sha }}
path: .dist/GLRepl.zip
# release:
# needs: ["test"]
# runs-on: ubuntu-latest
# if:
# contains('refs/heads/main', github.ref)
# steps:
# - name: 'Checkout repository'
# uses: actions/checkout@v3
# with:
# fetch-depth: 0
# - name: git config
# run: |
# git config user.name "${GITHUB_ACTOR}"
# git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
# # Part of the release script is to compile the code, so we don't need to redo this
# - name: 'release'
# working-directory: ./javascript
# run: npm ci && npx release-it --ci
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}