Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/actions/build/build-frontend/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Build Frontend
description: Build the frontend and upload the build artifacts for use in other jobs.

runs:
using: composite
steps:
- uses: ./.github/actions/setup/setup-node
if: github.event.repository.name == 'python-template-server'
- uses: javidahmed64592/python-template-server/.github/actions/setup/setup-node@main
if: github.event.repository.name != 'python-template-server'

- name: Build frontend
run: |
npm run build
working-directory: ${{ github.event.repository.name }}-frontend
shell: bash
- name: Upload frontend build
uses: actions/upload-artifact@v7
with:
name: ${{ github.event.repository.name }}-frontend-build
path: ${{ github.event.repository.name }}-frontend/out
40 changes: 40 additions & 0 deletions .github/actions/ci/frontend/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build Frontend
description: Build the frontend and upload the build artifacts for use in other jobs.

runs:
using: composite
steps:
- uses: ./.github/actions/setup/setup-node
if: github.event.repository.name == 'python-template-server'
- uses: javidahmed64592/python-template-server/.github/actions/setup/setup-node@main
if: github.event.repository.name != 'python-template-server'

- name: Run type checking
run: |
npm run type-check
working-directory: ${{ github.event.repository.name }}-frontend
shell: bash

- name: Run linting
run: |
npm run lint
working-directory: ${{ github.event.repository.name }}-frontend
shell: bash

- name: Run formatting check
run: |
npm run format
working-directory: ${{ github.event.repository.name }}-frontend
shell: bash

- name: Run tests
run: |
npm run test:coverage
working-directory: ${{ github.event.repository.name }}-frontend
shell: bash

- name: Upload frontend coverage report
uses: actions/upload-artifact@v7
with:
name: frontend-coverage-report
path: ${{ github.event.repository.name }}-frontend/coverage
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ __pycache__/

# Distribution / packaging
.Python
build/
./build/
develop-eggs/
dist/
downloads/
Expand Down
37 changes: 37 additions & 0 deletions docs/WORKFLOWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ This document focuses on the Docker-specific workflow and reusable actions uniqu
## Table of Contents
- [Reusable Actions (`./github/actions`)](#reusable-actions-githubactions)
- [Setup Actions (`/setup/**/action.yml`)](#setup-actions-setupactionyml)
- [CI Actions (`/ci/**/action.yml`)](#ci-actions-ciactionyml)
- [Build Actions (`/build/**/action.yml`)](#build-actions-buildactionyml)
- [Docker Actions (`docker/**/action.yml`)](#docker-actions-dockeractionyml)
- [Workflows (`./github/workflows`)](#workflows-githubworkflows)
- [Docker Workflow (`docker.yml`)](#docker-workflow-dockeryml)
Expand All @@ -36,6 +38,41 @@ steps:
- uses: javidahmed64592/python-template-server/.github/actions/setup/setup-node@main
```

### CI Actions (`/ci/**/action.yml`)

**frontend:**
- Description: Build the frontend and upload the build artifacts for use in other jobs.
- Location: `frontend/action.yml`
- Steps:
- Uses the `setup-node` action
- Runs `npm run type-check` for type checking
- Runs `npm run lint` for static code analysis
- Runs `npm run format` to tidy up scripts
- Runs `npm run test:coverage` for frontend unit tests
- Uploads unit test coverage report using `actions/upload-artifact@v7`

Usage:
```yaml
steps:
- uses: javidahmed64592/template-python/.github/actions/ci/frontend@main
```

### Build Actions (`/build/**/action.yml`)

**build-frontend:**
- Description: Build the frontend and upload the build artifacts for use in other jobs.
- Location: `build-frontend/action.yml`
- Steps:
- Uses the `setup-node` action
- Runs `npm run build` to build frontend static files
- Uploads static files as build artifact using `actions/upload-artifact@v7`

Usage:
```yaml
steps:
- uses: javidahmed64592/template-python/.github/actions/build/build-frontend@main
```

### Docker Actions (`docker/**/action.yml`)

The following actions encapsulate the steps in the Docker workflow and can be referenced locally with `uses: ./.github/actions/docker/<action>`.
Expand Down