-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Configure build and deployment of site (#48)
* ci: Configure build and deployment of site * also trigger on workflow changes * fix caching * fix working directory
- Loading branch information
1 parent
c027796
commit b8242d2
Showing
3 changed files
with
125 additions
and
55 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# GitHub Actions for Dewy | ||
|
||
We currently have 3 workflows: | ||
|
||
1. `ci.yml` defines the CI process for the core service and clients. | ||
2. `lint-pr.yml` defines linting of the PR itself (comments, etc.). | ||
3. `site.yml` defines the build and deployment process for the site. | ||
|
||
## Future Improvements | ||
|
||
1. Release drafting / publishing. | ||
2. Assign labels to PRs based on directories touched (eg., `docs`, `service`, etc.) and | ||
conventional commit (`fix`, `feature`, etc.). | ||
3. Require conditional checks https://github.com/marketplace/actions/require-conditional-status-checks |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,64 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
python_test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install Python | ||
uses: actions/setup-python@v4 | ||
# see details (matrix, python-version, python-version-file, etc.) | ||
# https://github.com/actions/setup-python | ||
with: | ||
python-version: '3.11' | ||
- name: Install poetry | ||
uses: abatilo/actions-poetry@v2 | ||
- name: Setup a local virtual environment (if no poetry.toml file) | ||
run: | | ||
poetry config virtualenvs.create true --local | ||
poetry config virtualenvs.in-project true --local | ||
- uses: actions/cache@v3 | ||
name: Define a cache for the virtual environment based on the dependencies lock file | ||
with: | ||
path: ./.venv | ||
key: venv-${{ hashFiles('poetry.lock') }} | ||
- name: Install the project dependencies | ||
run: poetry install --with=dev | ||
- name: pytest | ||
run: poetry run pytest -v | ||
env: | ||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
- name: check openapi client up to date | ||
run: | | ||
poetry run poe extract-openapi | ||
poetry run poe update-client | ||
# Record intent to add any new files in client | ||
git add -N dewy-client | ||
# Diff, and report any changes (including any new files in dewy-client) | ||
git diff --exit-code | ||
python_test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install Python | ||
uses: actions/setup-python@v4 | ||
# see details (matrix, python-version, python-version-file, etc.) | ||
# https://github.com/actions/setup-python | ||
with: | ||
python-version: '3.11' | ||
- name: Install poetry | ||
uses: abatilo/actions-poetry@v2 | ||
- name: Setup a local virtual environment (if no poetry.toml file) | ||
run: | | ||
poetry config virtualenvs.create true --local | ||
poetry config virtualenvs.in-project true --local | ||
- uses: actions/cache@v3 | ||
name: Define a cache for the virtual environment based on the dependencies lock file | ||
with: | ||
path: ./.venv | ||
key: venv-${{ hashFiles('poetry.lock') }} | ||
- name: Install the project dependencies | ||
run: poetry install --with=dev | ||
- name: pytest | ||
run: poetry run pytest -v | ||
env: | ||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
- name: check openapi client up to date | ||
run: | | ||
poetry run poe extract-openapi | ||
poetry run poe update-client | ||
# Record intent to add any new files in client | ||
git add -N dewy-client | ||
# Diff, and report any changes (including any new files in dewy-client) | ||
git diff --exit-code | ||
python_lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Ruff Lint | ||
uses: chartboost/ruff-action@v1 | ||
python_lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Ruff Lint | ||
uses: chartboost/ruff-action@v1 | ||
|
||
python_format: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Ruff Format (Check) | ||
uses: chartboost/ruff-action@v1 | ||
with: | ||
args: format --check | ||
python_format: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Ruff Format (Check) | ||
uses: chartboost/ruff-action@v1 | ||
with: | ||
args: format --check |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Site | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'docs/**' | ||
- '.github/workflows/site.yml' | ||
pull_request: | ||
paths: | ||
- 'docs/**' | ||
- '.github/workflows/site.yml' | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
deploy: | ||
name: Build and (maybe) Deploy Site | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
cache: yarn | ||
cache-dependency-path: docs/package-lock.json | ||
|
||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile | ||
working-directory: docs | ||
- name: Build website | ||
run: yarn build | ||
working-directory: docs | ||
|
||
# Popular action to deploy to GitHub Pages: | ||
# Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus | ||
- name: Deploy to GitHub Pages | ||
uses: peaceiris/actions-gh-pages@v3 | ||
# Only run on push to main. | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
# Build output to publish to the `gh-pages` branch: | ||
publish_dir: ./docs/build | ||
# The following lines assign commit authorship to the official | ||
# GH-Actions bot for deploys to `gh-pages` branch: | ||
# https://github.com/actions/checkout/issues/13#issuecomment-724415212 | ||
# The GH actions bot is used by default if you didn't specify the two fields. | ||
# You can swap them out with your own user credentials. | ||
user_name: github-actions[bot] | ||
user_email: 41898282+github-actions[bot]@users.noreply.github.com |