How to use Lighthouse in GitHub Actions

How to use Lighthouse in GitHub Actions

How to run Lighthouse audits in GitHub Actions as part of a CD or CI workflow. I hope this article can provide a helpful addition to your DevOps workflow! With Lighthouse integrated in a CI/CD pipeline, we can stay fully equipped to ensure high quality in website SEO,

GitHub Actions are used to automate software engineering workflows. Similar to tools like CircleCI, Jenkins, Travis and many others, GitHub Actions provides a declarative API for defining workflows. These workflows can include jobs to build, test, and deploy applications.

Lighthouse is an open-source project from Google for improving the quality of web pages. It provides user-centric metrics to audit SEO, performance, accessibility, best practices, and progressive web apps. For a deeper dive about Lighthouse please read “How to analyze website performance with Lighthouse”. This post will demonstrate the following:

  • Basic implementation of Lighthouse in a GitHub Actions workflow.
  • Advanced setup to display Lighthouse results in pull request comments.
  • S3 Lighthouse report uploads.
  • Slack notifications.
Lighthouse Check GitHub Action

This post will provide a guide for using Lighthouse Check Action for automating Lighthouse audits. It can be used within a workflow - triggered by any event. This post will demonstrate how to use the action when triggered by a pull request event.

Basic Example

With the following steps we can create a basic workflow.

  1. Create and checkout a new branch locally.
  2. Create a file in your project with a path similar to the following .github/workflows/my-workflow.yml (replacing my-workflow with any name of your choice).
  3. Populate the file from above with the example shown below, replacing the urls field with a comma separated list of the URLs you’d like to test.
  4. Commit changes locally and push the branch up to your remote.
  5. From your new branch, open a pull request.
name: Lighthouse Check
on: [pull_request]

    runs-on: ubuntu-latest
    - uses: actions/[email protected]
    - run: mkdir /tmp/artifacts
    - name: Run Lighthouse
      uses: foo-software/[email protected]
        outputDirectory: /tmp/artifacts
        urls: ','
    - name: Upload artifacts
      uses: actions/[email protected]
        name: Lighthouse reports
        path: /tmp/artifacts

And Voilà 🔮 — we have a workflow with Lighthouse! Assuming you have GitHub Actions enabled in your repo, you should see something like the below (note: at the time of this writing GitHub Actions are in “beta” mode and require registration).

GitHub repository tabs

Clicking on “Actions” will list all workflows currently running and previous.

List of GitHub Actions workflows

After following the steps from our basic example, you should see one item on this list. Clicking in will show us Lighthouse results printed to the console.

Lighthouse results printed out in the console
From our configuration, we also have results captured in HTML reports saved as “artifacts”.

Clicking through the “Artifacts” dropdown downloads the HTML reports

Full Lighthouse report as an HTML file downloaded from “Artifacts”

Advanced Example

Lighthouse Check Action offers a complete set of bells and whistles by utilizing lighthouse-check NPM module under the hood. There’s so much more we can do with this. Let’s proceed!

Pull Request Comments

By utilizing this feature, comments are posted with Lighthouse results on every commit. We can do so by following the steps below.

  1. Create a new user or find an existing one to act as a “bot”.
  2. Create a personal access token from this user account.
  3. Create a GitHub secret to hold the encrypted value from above. In our example we name it LIGHTHOUSE_CHECK_GITHUB_ACCESS_TOKEN.
  4. Update our workflow file with the diff shown below.
  5. Commit and push.
+  accessToken: ${{ secrets.LIGHTHOUSE_CHECK_GITHUB_ACCESS_TOKEN }}
  outputDirectory: /tmp/artifacts

With this, we’ve created a bot to post Lighthouse results on pull requests 💥!

Lighthouse results as PR comments

S3 Report Uploads

In our example we persist results by uploading reports as artifacts in our workflow. This solution could be sufficient in some cases, but artifacts aren’t stored permanently. In order to view reports, we need to navigate into the workflow and manually download reports from the artifact view.

But what if we want a more dependable way of storing and referencing reports? This is where the S3 feature comes into play. We can configure AWS S3 storage by following the below steps.

  1. Create an AWS account if you don’t already have one.
  2. Create an S3 bucket if you don’t already have one.
  3. Acquire an AWS access key id and secret access key.
  4. Create GitHub secrets for these two values. In our example we’ll use LIGHTHOUSE_CHECK_AWS_ACCESS_KEY_ID and LIGHTHOUSE_CHECK_AWS_SECRET_ACCESS_KEY, respectively.
  5. Add the bucket name and region (example: us-east-1) as GitHub secrets: LIGHTHOUSE_CHECK_AWS_BUCKET and LIGHTHOUSE_CHECK_AWS_REGION.

Next, we’ll update our configuration with the following diff.

  accessToken: ${{ secrets.LIGHTHOUSE_CHECK_GITHUB_ACCESS_TOKEN }}
+  awsAccessKeyId: ${{ secrets.LIGHTHOUSE_CHECK_AWS_ACCESS_KEY_ID }}
+  awsBucket: ${{ secrets.LIGHTHOUSE_CHECK_AWS_BUCKET }}
+  awsRegion: ${{ secrets.LIGHTHOUSE_CHECK_AWS_REGION }}
+  awsSecretAccessKey: ${{ secrets.LIGHTHOUSE_CHECK_AWS_SECRET_ACCESS_KEY }}

In our next commit and push, reports are automatically uploaded to S3 ✅! We also have a them linked in our PR comments.

Lighthouse result PR comment with S3 report linked

Slack Notifications

What’s a new feature in a DevOps workflow without Slack notifications? A sad one indeed. Let’s ramp things up by adding notifications to a Slack channel for our whole team to see. We can accomplish this in the below steps.

  1. Create an “Incoming Webhook” in your Slack workspace and authorize a channel.
  2. Add the Webhook URL as a GitHub secretLIGHTHOUSE_CHECK_WEBHOOK_URL.
  3. Add GitHub data and the Webhook URL to our configuration with the diff below. The GitHub data will be rendered in our notifications. We pass GitHub data through configuration with the GitHub “context”.
  accessToken: ${{ secrets.LIGHTHOUSE_CHECK_GITHUB_ACCESS_TOKEN }}  +  author: ${{ }}
  awsAccessKeyId: ${{ secrets.LIGHTHOUSE_CHECK_AWS_ACCESS_KEY_ID }}
  awsBucket: ${{ secrets.LIGHTHOUSE_CHECK_AWS_BUCKET }}
  awsRegion: ${{ secrets.LIGHTHOUSE_CHECK_AWS_REGION }}
  awsSecretAccessKey: ${{ secrets.LIGHTHOUSE_CHECK_AWS_SECRET_ACCESS_KEY }}
+  branch: ${{ github.ref }}
  outputDirectory: /tmp/artifacts
+  sha: ${{ github.sha }}
+  slackWebhookUrl: ${{ secrets.LIGHTHOUSE_CHECK_WEBHOOK_URL }}
  urls: ','

Our next commit and push introduces Slack notifications! The “Lighthouse audit” link in the below screenshot navigates to the S3 report as configured✨.

Lighthouse Slack notification

What Now?

You can find a full example from the above in the Lighthouse Check Action documentation. In this article I didn’t go over a feature you can use to fail a workflow if minimum scores aren’t satisfied. Although this feature exists for those interested, I wouldn’t necessarily recommend it. Personally, I prefer to use this solution for insight and to not block workflows… but the feature exists — feel free to use it! There’s an example of how to set minimum scores in the documentation.

I hope this article can provide a helpful addition to your DevOps workflow! With Lighthouse integrated in a CI/CD pipeline, we can stay fully equipped to ensure high quality in website SEO, performance, accessibility, best practice, and progressive web apps.

GitHub Development Workflow - Developers need to know

GitHub Development Workflow - Developers need to know

GitHub is a code hosting platform for version control and collaboration. It’s designed around Git, a system for tracking changes in software code. In this article we'll take a look at the key concepts of the GitHub development workflow.

GitHub is a code hosting platform for version control and collaboration. It’s designed around Git, a system for tracking changes in software code. It lets you and others work together on projects from anywhere. In this article we’ll take a look at the key concepts of the GitHub development workflow. Including working with repositories, branches, forks, commits, pull requests and merging. Let’s get started!

What is version control?

Version control is a system that helps developers track and manage changes to a software projects code. As projects grow, the need for version control becomes vital — especially in a collaborative project. We can work safely by using whats known as branching and merging.

Branching allows us to duplicate our source code (aka ‘the repository’), so we can safely make changes without affecting the entire project. Once the changes have been reviewed and approval is agreed upon, we merge our branch into the master to update our official code. If any bugs are identified— we have the option to revert back to our original code, as our changes have been tracked.

What is Git?

Git and Github are not synonymous! Git is a specific open-source version control system created by Linus Torvalds in 2005. It’s the program that actually tracks your changes, and ensures the entire code-base is available on each developers computer. GitHub however, is simply hosting your repositories (as well as providing some additional functionality).

The Fundamentals

Let’s get started! If you haven’t signed up for a GitHub account, go ahead and sign up here.

Creating a Repository

A GitHub repository (or “repo”) can be thought of as the root folder for your project. It contains all your project files and gives you the ability to access each files revision history. If you’re working in a team you can give other people access to your repository for project collaboration.

Lets create our first repository! Make sure your signed in to GitHub, then:

  1. In the upper-right corner, click the settings + icon & then New repository
  2. Give your repository a name
  3. Add a description if you like
  4. Choose between creating a public or private repository (either are fine)
  5. Select Initialize this repository with a README (eg. “My first repo!”)
  6. Click Create repository!
  7. Add files to your repository —we’re only testing so it really doesn't matter what you add. Find an HTML file for example, and add it to your repository via the Upload files button.

Creating an Issue

Issues are how we track the tasks, enhancements, and bugs in our projects. They’re meant to be shared amongst your team to facilitate discussion for review as well as for managing task delegation. If you open an issue on a project managed by someone else, it’ll stay open until either you close it (for example if you figure out the problem) or if the repo owner closes it. When you create an issue, be sure to give a clear explanation of the task at hand. Let’s create an issue in our repository:

  1. In your repository, select the Issues tab
  2. Click the New Issue button
  3. Give your issue the title ‘Setup GitHub pages’
  4. Give a clear description e.g. ‘Need to setup GitHub Pages in this repository’
  5. Click Submit new issue

Assigning an Issue

We need to assign issues so our team members know who’s job it is to handle the task!

  • On the right side of the screen, under the “Assignees” section, click the settings icon and select yourself

Let’s resolve our first issue! We want to Setup GitHub pages. You can read about GitHub Pages here. But for now, our focus on completing the task:

  1. Click on the Settings tab in your repository
  2. Scroll down to the “GitHub Pages” section
  3. From the “Source” drop down, select master branch
  4. Click Save

Closing an Issue

Now you’ve completed the task — you can go ahead and close it! You can delete an issue on GitHub, however closing it tells your team members that the task has been completed. To close:

  • Open up your completed issue and click Close issue

The GitHub Flow

Now that we know how to work with issues, it’s time to look at the GitHub Flow. Simply put its a workflow where we can experiment with new ideas safely, without the risk of compromising our project. This is primarily achieved through the use of branching.

GitHub Flow

By default, our project lives on the master branch — any changes to the master will update directly to our project (This can be dangerous is you haven’t properly reviewed your changes!).

When we want to experiment with a new feature, or even fix an issue, we create a new branch on the project. The branch will initially be a duplicate of your master, now when you make changes —they’ll reflect only on the branch.

While working on changes, you’ll commit the changes to your branch. When you’re satisfied that the changes are complete, its time to open a pull request. From here your team will discuss and further refine the project changes. Once the changes have been approved, the branch will be merged onto the master branch. Let’s go through an example of this process now!

Creating a Branch

  1. Open your repository and click the Code tab
  2. Click Branch: master in the drop-down
  3. In the field, enter a name for your branch (e.g. ‘development’)
  4. Click Create branch

Now that you’ve created a branch, you can modify your project without changing the deployed master branch.

A note on forks — A fork is different to a branch in that it allows you to clone another repo in your own account. It essentially allows you to start a new project based on a previous project.

Committing a file

Now we can safely work within our branch, let’s create a file and make our first commit.

  1. Make an edit (anything! just add a simple comment to your code) to one of the files you had added to the repository earlier
  2. Give the commit a name and description
  3. Make sure your newly created (development) branch is selected
  4. Click Commit changes

You’ve made your first commit! The next step is to share the changes with your team via a pull request.

Opening a Pull Request

A pull request is where we share our proposed project changes with our team — with the intent on discussing & revising them before applying the changes to the master branch.

  1. Open the Pull requests tab and click New pull request
  2. In the base: drop-down menu, ensure the master branch is selected
  3. In the compare: drop-down menu, select the development branch you created earlier
  4. Click Create pull request
  5. Now enter a title for your pull request, for example “Add my changes”
  6. Add an accurate description of the changes you made
  7. Click Create pull request!

Your team members now have the ability to discuss and review your proposed changes. Once everyone is happy and the changes are approved— it’s time to merge to master.

Note: If you forked a repo and made changes, you can create a pull request to merge your changes from there as well.

Merging a Pull Request

  1. Inside of your Pull request, click Merge pull request
  2. Click Confirm merge
  3. Once your branch has been merged, you don’t need it anymore. You can click Delete branch

And that’s it! You’ve learned how to work collaboratively on projects using GitHub. GitHub is an amazing tool to take advantage of! You can now create repositories and issues, create branches, fork projects and make commits, submit pull requests for review, and merge to the master branch. Not bad!

I hope you found this article useful!

Mobile App Development Company India | Ecommerce Web Development Company India

Mobile App Development Company India | Ecommerce Web Development Company India

Best Mobile App Development Company India, WebClues Global is one of the leading web and mobile app development company. Our team offers complete IT solutions including Cross-Platform App Development, CMS & E-Commerce, and UI/UX Design.

We are custom eCommerce Development Company working with all types of industry verticals and providing them end-to-end solutions for their eCommerce store development.

Know more about Top E-Commerce Web Development Company

Is Low-code or no-code development is future of mobile app development

Is Low-code or no-code development is future of mobile app development

Mobile app development has skyrocketed over these years with the increasing demand of mobile apps for a variety of purposes like entertainment, banking, weather update, health, booking movie tickets, booking a taxi etc. With the latest...

Mobile app development has skyrocketed over these years with the increasing demand of mobile apps for a variety of purposes like entertainment, banking, weather update, health, booking movie tickets, booking a taxi etc. With the latest technologies adopted by mobile app development services, there are different app development approaches which are being practiced. Among them is low-code or no-code development. But will it be the future of mobile app development? Will any mobile application development company start taking this approach as the primary one. Let’s try to find a detailed answer to this question.

But first, let’s understand what this approach exactly is? Well, it is a streamlined approach which involves swift design as well as development with minimal coding, generally relying on different third-party APIs.

Even though there isn’t any single definition of no-code or low-code development because it is actually more of a mindset rather than something which can be directly measured, this mindset has certainly led to a vast community mushrooming up with this mentality. Android app development services are rapidly adopted by this approach. Low-code app innovators are rapidly disrupting all types of various industries. There are a plethora of benefits to these low code platforms and let’s look at this.

1. Less Number of Bugs

It is pretty evident that less code actually means fewer bugs. As simple as that. The entire bug testing phase is actually a major part of modern and latest application development. It is quite inevitable that various issues will come up if there is actually enough code present there. But the best thing regarding low code platforms is that there’s certainly less to test. Also, when they actually tap into APIs, those particular APIs are actually tested by other people.

Lesser number of bugs is better for both users, as well as developers since less amount of time, will be taken up with bug-fixes and troubleshooting. Also, the fast pace of this development approach actually means that if in any case a bug is found, it is generally better just to develop a new iteration rather than fixing it.

2. Significant Lower Costs

Among the most obvious reasons for why you would actually opt for any low code platform is that in reality, low code results in lower cost. Low code development leads to faster app development which saves a lot of time and as a result, lower cost.

It's not only good for companies but also for developers. It certainly cut out the intermediaries, and while they charge less, they use fewer resources and finally come out on top. It is fun for developers because it stops them from actually finding themselves stuck on one particular project which seems to last forever. This is why most of the companies hire app developer who is a well-versed with low-code development.

3. Better Accessibility

The lesser amount of code an application uses, the lesser bandwidth is needed to download it as well as run it. This is quite good news for the people who are based in rural areas or in different developing countries where access to the internet isn’t as prevalent as Western countries. Also, as low code applications can easily be created quite easily than a traditional app, they can easily be released much more swiftly and at a much lower price, and sometimes for free. iPhone app development services follow this approach because it will help in increasing the uptake of their apps as it reduces the entry barrier for every person from lower-income families.

Innovative Development Approach

Among the most promising instances of a low-code or no-code platform is Uber. The apps tap into Google for Maps, Dropbox for storage, Braintree for payments and much more. The most interesting thing about this is that app programming interfaces of APIs which Uber actually relies upon are easily available to anyone who wishes to use them. Uber took those APIs and then used them to create, which was new without requiring to develop each of those particular individual elements, all by themselves. They developed their own brand on top of it by means of looking at how they could actually differentiate themselves from the rest of the others. Mobile app development services should follow this example to create their own low code mobile app which disrupts the market.

The best thing about this is that it inspires innovation. At present, the marketplace actually decides, and only the best applications rise to the top. Also, low code development easily allows developers to iterate much more quickly and can aim for higher more.

The Role of Artificial Intelligence (AI)

Artificial Intelligence is certainly making big waves in different businesses, and as this technology improves further, it will find its way in different other uncharted areas. Among those areas is the low code app development, where it comes in quite useful for a wide range of tasks and actions including the integration of various data sources or just making sense of an entire unstructured or semi-structured data.

Artificial Intelligence is quite great at analysing and conducting trial and error. Hence, it won’t be quite long until the usage of AI becomes quite a standard part of the low code app development. A mobile application development company can find ways to reduce the total amount of code that it is using through AI and flagging potential and possible improvements.


It is quite certain that low-code or no-code app development is the future of app development for one of the simplest reasons that it is quite easier as well as faster and efficiently uses time. It actually doesn’t matter whether Android app development services or iPhone app development services are on-board with this particular change or not. This is quite inevitable as this approach is the path of least resistance. Also, as the inherent demand for low code platforms keeps in growing, developers will certainly find themselves to adopt it.

It is quite a great news as it will push the developers of mobile application development services to become the best. Also, there won’t be any time to redoing it to create the same thing, or any room for sloppy code as well as lengthy development processes which makes the mobile apps redundant even before they are actually finished. Hence, low-code or no-code development will certainly lead the future of mobile app development, and mobile app developers certainly have to get on the bandwagon, one way or the other.