diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e85f420..b6d0b0a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,6 +5,9 @@ on: branches: - main +permissions: + contents: read + jobs: build: runs-on: ubuntu-latest diff --git a/.github/workflows/lighthouse.yml b/.github/workflows/lighthouse.yml new file mode 100644 index 0000000..579ee8f --- /dev/null +++ b/.github/workflows/lighthouse.yml @@ -0,0 +1,40 @@ +name: Lighthouse CI + +on: + pull_request: + branches: + - main + +permissions: + contents: read + +jobs: + lighthouse: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: "22.12.0" + cache: npm + cache-dependency-path: astro-site/package-lock.json + + - name: Install dependencies + working-directory: astro-site + run: npm ci + + - name: Create assets symlink + run: mkdir -p astro-site/src/content && ln -s ../../../assets astro-site/src/content/assets + + - name: Build site + working-directory: astro-site + run: npm run build + + - name: Lighthouse CI + uses: treosh/lighthouse-ci-action@v12 + with: + configPath: ./lighthouserc.json + uploadArtifacts: true diff --git a/lighthouserc.json b/lighthouserc.json new file mode 100644 index 0000000..700ad87 --- /dev/null +++ b/lighthouserc.json @@ -0,0 +1,21 @@ +{ + "ci": { + "collect": { + "staticDistDir": "./astro-site/dist", + "url": [ + "/", + "/introduction/", + "/building-blocks/", + "/branching-and-merging/" + ] + }, + "assert": { + "assertions": { + "categories:performance": ["warn", { "minScore": 0.9 }], + "categories:accessibility": ["error", { "minScore": 0.9 }], + "categories:best-practices": ["warn", { "minScore": 0.9 }], + "categories:seo": ["warn", { "minScore": 0.9 }] + } + } + } +}