Skip to content

Commit

Permalink
add unit test in ci
Browse files Browse the repository at this point in the history
  • Loading branch information
RingoTC committed Mar 5, 2024
1 parent 3b9fb5d commit fe92b44
Showing 1 changed file with 49 additions and 12 deletions.
61 changes: 49 additions & 12 deletions .github/workflows/dev-build-release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build the project and tag,version it and release to dev env
name: Build and Release Project

on:
push:
Expand All @@ -12,14 +12,51 @@ jobs:
build:
name: Build Project
runs-on: ubuntu-latest
if: |
github.repository == 'Greenstand/treetracker-query-api'
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.git-tag }}
- name: get-npm-version
id: package-version
uses: martinbeentjes/npm-get-version-action@master
- name: run-unit-tests
run: npm run test-unit | npm run test-e2e
if: github.repository == 'Greenstand/treetracker-query-api'
steps:
- uses: actions/checkout@v2

# Get the current version from package.json
- name: Get npm version
id: package-version
uses: martinbeentjes/npm-get-version-action@master

# Run unit and E2E tests
- name: Run unit and E2E tests
run: |
npm run test-unit
npm run test-e2e
# Setup Node.js environment
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '14'

# Install dependencies
- name: Install dependencies
run: npm install

# Build project
- name: Build
run: npm run build

# Create and push tag with the version from package.json
- name: Tag Release
run: |
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions"
git tag v${{ steps.package-version.outputs.version }}
git push origin v${{ steps.package-version.outputs.version }}
# Optionally, create a GitHub Release (requires additional setup)
# - name: Create GitHub Release
# id: create_release
# uses: actions/create-release@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# tag_name: v${{ steps.package-version.outputs.version }}
# release_name: Release ${{ steps.package-version.outputs.version }}
# draft: false
# prerelease: false

0 comments on commit fe92b44

Please sign in to comment.