The following GitHub Action workflow to build and deploy the site to GitHub Pages gh-pages branch:

name: Publish
on:
  push:
    branches: [ "main" ]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - name: Set up Python 3.10
      uses: actions/setup-python@v3
      with:
        python-version: "3.10"
    - name: ⚙️ Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install mkdocs
    - name: 🏗️ Build Site
      run: mkdocs build
    - name: 🚀 Deploy
      uses: JamesIves/github-pages-deploy-action@v4
      with:
        folder: site

PageSpeed Insights (PSI) reports on the user experience of a page on both mobile and desktop devices, and provides suggestions on how that page may be improved.

Being a Google Service, it may soon be killed by Google

In this blog post, I show you how to host a website in GitHub Pages and manage the domain with Hover

Website

I recently joined a local chess association in Guadalajara. They did not have a website, so I offered to create one for them. The website is a static website with HTML and Bootstrap.

The website is simple, but it conveys the association information, and it scores 100% in performance, accessibility, best practices and SEO.

GitHub Organization

Instead of creating it from my personal account, I created a GitHub Organization dedicated to the association. I verified the domain at the GitHub Organization level. You need to verify the domain at the organizational level, not the repository level.

GitHub Pages

Micronaut publishes its documentation to GitHub Pages deploying from branch gh-pages. For this website, I used GitHub Actions as the source instead. The website changes seem remarkably faster.

GitHub Action Workflow

The following GitHub Action workflow deploys the contents of the dist folder.

name: Deploy static content to Pages
on:
  push:
    branches: ["main"]
permissions:
  contents: read
  pages: write
  id-token: write
concurrency:
  group: "pages"
  cancel-in-progress: false
jobs:
  deploy:
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Setup Pages
        uses: actions/configure-pages@v5
      - name: Upload artifact
        uses: actions/upload-pages-artifact@v3
        with:
          path: 'dist'
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v4

Domain

I use Hover as a domain registrar. I use the following DNS configuration as pointed out by GitHub Pages documentation.

TYPEHOSTVALUETTL
A@185.199.109.15315 Minutes
A@185.199.110.15315 Minutes
A@185.199.111.15315 Minutes
A@185.199.108.15315 Minutes
AAAA@2606:50c0:8000::15315 Minutes
AAAA@2606:50c0:8001::15315 Minutes
AAAA@2606:50c0:8002::15315 Minutes
AAAA@2606:50c0:8003::15315 Minutes
TXT_github-pages-challenge-ajedrezcallejeroguadalajara89676ddaaeb7a6adec23d36402059915 Minutes
CNAMEwwwajedrezcallejeroguadalajara.github.io15 Minutes

Cost

The total cost for the association is 18 USD per year - the cost of the domain.

Summary

I hope this post shows you how easy is to host a website in GitHub Pages and manage the domain with Hover.

If you are in the Guadalajara (Spain) area, I hope to play chess against you soon. You can find the meetup information at ajedrezcallejeroguadalajara.com.

Sometimes, while developing you need to define mavenLocal() repository in a Gradle build. Gradle allows you to constraint the repository only to snapshots.

It is easy to do it with the Gradle Kotlin DSL.

repositories {
    mavenCentral()
    mavenLocal {
        mavenContent {
            snapshotsOnly()
        }
    }
    maven {
        setUrl("https://s01.oss.sonatype.org/content/repositories/snapshots/")
        mavenContent {
            snapshotsOnly()
        }
    }
}

An idempotent operation is defined as one which, if performed more than once, results in the same outcome.

Spring Academy Implementing POST:

An idempotent operation is defined as one which, if performed more than once, results in the same outcome. In a REST API, an idempotent operation is one that even if it were to be performed several times, the resulting data on the server would be the same as if it had been performed only once.

I do a lot of open source releases in my work.

I have a checklist to verify the necessary services are available by visiting the following status pages:

At UnityFoundation we use Basecamp. Yesterday, Basecamp was suffering a DDOS attack and I visited their status page. It uses Atlassian Statuspage. Atlassian statuspage has a free plan.

Our free plan gives you access to 100 subscribers, 25 components, two team members, two metrics, email notifications, Slack notifications, and access to REST APIs.

Atlassian statuspage is a good option if you need to set up a status page for your service.

WebJars are client-side web libraries (e.g. jQuery & Bootstrap) packaged into JAR (Java Archive) files.

It's a clever project to get started with a Javascript library in a Java project.

I wrote a Micronaut Tutorial that shows how to generate an OpenAPI Specification of your Micronaut Application at build time and generate it in Asciidoc format.

A flaky test is a software test that yields both passing and failing results despite zero changes to the code or test

#!/bin/bash
EXIT_STATUS=0
NUM_RUNS=100
SUCCESSFUL_RUNS=0
for ((i=1; i<=$NUM_RUNS; i++)); do
  ./gradlew :micronaut-gcp-pubsub:test --tests io.micronaut.gcp.pubsub.integration.SubscriberShutdownSpec --rerun || EXIT_STATUS=$?
  if [ $EXIT_STATUS -ne 0 ]; then
	exit $EXIT_STATUS
  fi
done
exit $EXIT_STATUS

Gradle Plugin which automatically create a testFixtures source set, in which you can write your test fixtures.

Test fixtures are commonly used to setup the code under test, or provide utilities aimed at facilitating the tests of a component. Java projects can enable test fixtures support by applying the java-test-fixtures plugin, in addition to the java or java-library plugins.

This will automatically create a testFixtures source set, in which you can write your test fixtures. Test fixtures are configured so that:

  • they can see the main source set classes

test sources can see the test fixtures classes

System Stubs is used to test code which depends on methods in java.lang.System.

@ExtendWith(SystemStubsExtension.class)
class WithEnvironmentVariables {
	@SystemStub
	private EnvironmentVariables variables = new EnvironmentVariables("input", "foo");

	@Test
	void hasAccessToEnvironmentVariables() {
		assertThat(System.getenv("input")).isEqualTo("foo");
	}

	@Test
	void changeEnvironmentVariablesDuringTest() {
		variables.set("input", "bar");
		assertThat(System.getenv("input")).isEqualTo("bar");
	}
}