Bump the eslint group across 1 directory with 5 updates #223
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lint, test and deploy | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: "0 2 * * 0" | |
workflow_call: | |
workflow_dispatch: | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Git clone repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
cache: npm | |
- name: Install Node.js dependencies | |
run: npm ci | |
- name: Check formatting | |
run: npm run format:check | |
- name: Run Astro check | |
run: npm run check | |
- name: Lint | |
run: npm run lint | |
build-site: | |
name: Build site | |
runs-on: ubuntu-latest | |
steps: | |
- name: Git clone repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
cache: npm | |
- name: Install Node.js dependencies | |
run: npm ci | |
- name: Pull LFS source files | |
uses: ./.github/actions/cache-and-pull-lfs | |
with: | |
path: src | |
- name: Restore Astro cache | |
uses: actions/cache@v4 | |
with: | |
path: node_modules/.astro | |
key: ${{ runner.os }}-astro-${{ hashFiles('**/package-lock.json', 'src/content/images/*.webp', 'src/content/images/*.jpg') }} | |
- name: Build site | |
run: | | |
npm run build | |
tar -czvf /tmp/site.tar.gz dist/ | |
- name: Upload artefact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: site | |
path: /tmp/site.tar.gz | |
retention-days: 1 | |
get-playwright-version: | |
name: Get Playwright version | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.get-version.outputs.version }} | |
steps: | |
- name: Git clone repository | |
uses: actions/checkout@v4 | |
- id: get-version | |
name: Get Playwright version | |
run: | | |
echo "version=$(python scripts/get_playwright_version.py)" >> "$GITHUB_OUTPUT" | |
test-e2e: | |
name: Run e2e tests | |
runs-on: ubuntu-latest | |
needs: | |
- build-site | |
- get-playwright-version | |
container: | |
image: mcr.microsoft.com/playwright:v${{ needs.get-playwright-version.outputs.version }} | |
steps: | |
- name: Install Git LFS | |
run: | | |
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash | |
apt-get install -y git-lfs | |
- name: Git clone repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
cache: npm | |
- name: Install Node.js dependencies | |
run: npm ci | |
- name: Download built site | |
uses: actions/download-artifact@v4 | |
with: | |
name: site | |
path: /tmp | |
- name: Unpack site | |
run: tar -xzf /tmp/site.tar.gz | |
- name: Mark Git directory as safe | |
run: | | |
git config --global --add safe.directory "$(pwd)" | |
- name: Pull LFS test snapshots | |
uses: ./.github/actions/cache-and-pull-lfs | |
with: | |
path: test/e2e | |
- name: Run e2e tests | |
run: npm exec --no -- playwright test | |
env: | |
HOME: /root | |
- name: Upload test results | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: e2e-test-results | |
path: test/e2e/output | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
deployments: write | |
needs: | |
- build-site | |
- lint | |
- test-e2e | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download built site | |
uses: actions/download-artifact@v4 | |
with: | |
name: site | |
path: /tmp | |
- name: Unpack site | |
run: tar -xzf /tmp/site.tar.gz | |
- name: Publish to Cloudflare Pages | |
uses: cloudflare/pages-action@v1 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: a15c47006c45966652a70d01bf3629a5 | |
projectName: photos-reupen-uk | |
directory: dist/ | |
gitHubToken: ${{ secrets.GITHUB_TOKEN }} | |
wranglerVersion: "3" |