Skip to content

Commit

Permalink
Add badges to readme, run tests during build so live site can report …
Browse files Browse the repository at this point in the history
…coverage (#1341)
  • Loading branch information
stephenegriffin authored Nov 26, 2024
1 parent 6b32061 commit 17a72d4
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 30 deletions.
1 change: 1 addition & 0 deletions .github/workflows/buildDeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
run: |
npm ci
npm run build --if-present
npm run test --if-present
- name: Upload artifact for deployment job
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/buildDeployTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
run: |
npm ci
npm run build --if-present
npm run test --if-present
- name: Upload artifact for deployment job
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
Expand Down
53 changes: 23 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
MHA
=====
# MHA

[![continuous-integration](https://github.com/microsoft/MHA/actions/workflows/build.yml/badge.svg)](https://github.com/microsoft/MHA/actions/workflows/build.yml)
[![Deploy Test](https://github.com/microsoft/MHA/actions/workflows/buildDeployTest.yml/badge.svg)](https://github.com/microsoft/MHA/actions/workflows/buildDeployTest.yml)
[![CodeQL](https://github.com/microsoft/MHA/actions/workflows/codeql.yml/badge.svg)](https://github.com/microsoft/MHA/actions/workflows/codeql.yml)
[![Dependency Review](https://github.com/microsoft/MHA/actions/workflows/dependency-review.yml/badge.svg)](https://github.com/microsoft/MHA/actions/workflows/dependency-review.yml)
[![Jest](https://github.com/microsoft/MHA/actions/workflows/jest.yml/badge.svg)](https://github.com/microsoft/MHA/actions/workflows/jest.yml)
[![OpenSSF
Scorecard](https://api.securityscorecards.dev/projects/github.com/microsoft/MHA/badge)](https://api.securityscorecards.dev/projects/github.com/microsoft/MHA)
Scorecard](https://api.securityscorecards.dev/projects/github.com/microsoft/MHA/badge)](https://scorecard.dev/viewer/?uri=github.com%2Fmicrosoft%2FMHA)
[![OpenSSF Best Practices](https://bestpractices.coreinfrastructure.org/projects/7511/badge)](https://bestpractices.coreinfrastructure.org/projects/7511)

Message Header Analyzer mail app.

This is the source for the Message Header Analyzer. Install the app from the store here:
<https://appsource.microsoft.com/en-us/product/office/WA104005406>

Installation Procedure
-----
## Installation Procedure

Because MHA requires the ReadWriteMailbox permission it can only be installed by the Administrator through the Exchange admin center or by a user as a custom addon. Here are some steps I put together:

Expand All @@ -27,76 +31,65 @@ Because MHA requires the ReadWriteMailbox permission it can only be installed by
1. Back in the Exchange Admin Center, refresh the list of add-ins
1. You can now edit who the add-in is available for

A Note on Permissions
-----
## A Note on Permissions

In order to get the transport message headers I have to use the EWS [makeEwsRequestAsync](https://learn.microsoft.com/en-us/javascript/api/outlook/office.mailbox?view=outlook-js-preview&preserve-view=true#outlook-office-mailbox-makeewsrequestasync-member(1)) method, which requires the ReadWriteMailbox permission level. See the article [Understanding Outlook add-in permissions](https://learn.microsoft.com/en-us/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions) for more on this. If I could request fewer permissions I would, since I only ever read the one property, but I have no choice in the matter.

When REST is more widely available, and a few REST specific bugs are fixed, I'll be able to switch to REST and request a lower permission level.

Standalone
-----
## Standalone

Here is a standalone Message Header Analyzer running the same backend code as the MHA app:
<https://mha.azurewebsites.net/pages/mha.html>

Unit Tests
-----
## Unit Tests

<https://mha.azurewebsites.net/Pages/test>
- [Unit tests](https://mha.azurewebsites.net/Pages/test)
- [Code coverage](https://mha.azurewebsites.net/Pages/coverage/lcov-report)

Mobile
-----
## Mobile

For both IOS and Android click open an email, then press the three dots under the date. There you should see the MHA icon. See [outlook-mobile-addins](https://learn.microsoft.com/en-us/office/dev/add-ins/outlook/outlook-mobile-addins) page for more details.

Development & Custom Deployment
======
## Development & Custom Deployment

Install and prereqs
-----
### Install and prereqs

1. Ensure [node.js (LTS)](https://nodejs.org/en) is installed
1. Clone the repo to your local drive
1. Run the following to install packages: `npm install`

Manual build
-----
### Manual build

- The commands below for unit/site/add-in testing will also build before starting the server, but you can also build on demand.
- Manual build: `npm run build`
- For continuous build on changes, you can use watch: `npm run watch`

Unit Testing
-----
### Unit Testing

- Start the dev server: `npm run dev-server`
- Run unit tests from command line: `npm run test`
- View test results here: <https://localhost:44336/Pages/test/>
- View code coverage here: <https://localhost:44336/Pages/coverage/lcov-report/>
- After changing source you will need to `npm run test` again.

Live site testing
-----
### Live site testing

- Start the dev server: `npm run dev-server`
- Run website locally: <https://localhost:44336/Pages/mha.html>
- Changes made to source should live compile and reload page. Ctrl+R/refresh as needed.

Add-in testing (Command line)
-----
### Add-in testing (Command line)

- Close Outlook
- Start the dev server: `npm start`
- Outlook should start with add-in added as "View Headers Debug Local"
- Changes made to source should live compile and reload in Outlook. Ctrl+R/refresh as needed.

Add-in testing (VSCode)
-----
### Add-in testing (VSCode)

- Follow the steps given [here](https://learn.microsoft.com/en-us/office/dev/add-ins/testing/debug-desktop-using-edge-chromium#use-the-visual-studio-code-debugger).

Clean
-----
### Clean

- Clean build artifacts: `npm clean`

0 comments on commit 17a72d4

Please sign in to comment.