Skip to content

Commit

Permalink
github actions for testing and pages preview deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
abidsikder committed Nov 14, 2024
1 parent f23b651 commit 0a2796c
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 25 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/pages-main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Deploy static site generated by pdoc to GitHub Pages
on:
push:
branches: ["main"]
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
contents: read
pages: write
id-token: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Setup Pages
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Create project environment
run: uv sync
- name: Build with pdoc
run: uv run pdoc ipldstore -o ./_site
- name: Upload artifact
# Automatically uploads an artifact from the './_site' directory by default
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4
41 changes: 41 additions & 0 deletions .github/workflows/pages-preview.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Adapted from https://github.com/github/opensource.guide/blob/main/.github/workflows/jekyll-preview.yml

name: Deploy static site generated by pdoc to GitHub Pages preview environment
on: pull_request
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
environment:
name: "Pages Preview"
url: ${{ steps.deployment.outputs.page_url }}
permissions:
contents: read
pages: write
id-token: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
# For PRs make sure to checkout the PR branch
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Setup Pages
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Create project environment
run: uv sync
- name: Build with pdoc
run: uv run pdoc ipldstore -o ./_site
- name: Upload artifact
# Automatically uploads an artifact from the './_site' directory by default
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4
with:
preview: "true"
31 changes: 31 additions & 0 deletions .github/workflows/run-checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Run checks
run-name: Triggered on push from ${{ github.actor }} to branch/tag ${{ github.ref_name }}
on: push
# Should be the same as ipldstore/run-checks.sh

jobs:
run_checks:
name: Create project environment, run all checks
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Create project environment
run: uv sync

- name: Run pytest with coverage
run: uv run pytest --cov=py_hamt tests/

- name: Check coverage
run: uv run coverage report --fail-under=100 --show-missing

- name: Check linting with ruff
run: uv run ruff check

- name: Check formatting with ruff
run: uv run ruff format --check
25 changes: 0 additions & 25 deletions .github/workflows/tox.yml

This file was deleted.

0 comments on commit 0a2796c

Please sign in to comment.