-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
164 additions
and
53 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
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,29 @@ | ||
name: 'ESLint Runner' | ||
description: 'Runs ESLint on the codebase' | ||
|
||
inputs: | ||
package_manager: | ||
description: 'The package manager to use for running scripts. Options are "npm" or "bun".' | ||
default: 'npm' | ||
required: false | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Run tests (bun) | ||
if: inputs.package_manager == 'bun' | ||
shell: bash | ||
run: bunx eslint . --output-file eslint_report.json --format json | ||
|
||
- name: Run tests (npm) | ||
if: inputs.package_manager == 'npm' | ||
shell: bash | ||
run: npx eslint . --output-file eslint_report.json --format json | ||
|
||
- name: Annotate Code Linting Results | ||
if: always() | ||
continue-on-error: true | ||
uses: ataylorme/eslint-annotate-action@v3 | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
report-json: "eslint_report.json" |
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,22 @@ | ||
name: 'Jest Test Runner' | ||
description: 'Runs Jest tests, with coverage reporting' | ||
|
||
# TODO: Add junit reporting | ||
inputs: | ||
package_manager: | ||
description: 'The package manager to use for running scripts. Options are "npm" or "bun".' | ||
default: 'npm' | ||
required: false | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Run tests (bun) | ||
if: inputs.package_manager == 'bun' | ||
shell: bash | ||
run: bunx jest --ci --coverage | ||
|
||
- name: Run tests (npm) | ||
if: inputs.package_manager == 'npm' | ||
shell: bash | ||
run: npx jest --ci --coverage |
This file was deleted.
Oops, something went wrong.
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
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
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,101 @@ | ||
name: Build and Deploy a static app | ||
|
||
# TODO: Handle different package managers | ||
on: | ||
workflow_call: | ||
inputs: | ||
bucket_name: | ||
required: true | ||
type: string | ||
description: 'Name of the S3 bucket where files will be uploaded.' | ||
endpoint: | ||
required: false | ||
type: string | ||
description: 'Custom endpoint for S3-compatible storage. Use this if you are not using AWS S3, but a compatible service.' | ||
ref: | ||
required: false | ||
type: string | ||
description: 'The branch or tag to deploy. Defaults to the current branch.' | ||
default: ${{ github.ref }} | ||
secrets: | ||
ACCESS_KEY: | ||
required: true | ||
description: 'AWS access key for authentication.' | ||
SECRET_KEY: | ||
required: true | ||
description: 'AWS secret key for authentication.' | ||
|
||
jobs: | ||
setup: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.ref }} | ||
- uses: Beuterei/reusable-workflows/.github/actions/npm-environment-setup@main | ||
with: | ||
dependencies_type: development | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
needs: setup | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.ref }} | ||
- uses: Beuterei/reusable-workflows/.github/actions/restore-dependency-cache@main | ||
- name: Restore cached build | ||
id: restore-build-cache | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: dist | ||
key: build-${{ runner.os }}-${{ github.sha }} | ||
- name: Build | ||
if: steps.restore-build-cache.outputs.cache-hit != 'true' | ||
run: npm run build | ||
- name: Cache build output | ||
if: steps.restore-build-cache.outputs.cache-hit != 'true' | ||
uses: actions/cache@v4 | ||
with: | ||
path: dist | ||
key: build-${{ runner.os }}-${{ github.sha }} | ||
|
||
linting: | ||
runs-on: ubuntu-latest | ||
needs: setup | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.ref }} | ||
- uses: Beuterei/reusable-workflows/.github/actions/restore-dependency-cache@main | ||
- name: | ||
uses: Beuterei/reusable-workflows/.github/actions/eslint-runner@main | ||
|
||
|
||
testing: | ||
runs-on: ubuntu-latest | ||
needs: setup | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.ref }} | ||
- uses: Beuterei/reusable-workflows/.github/actions/restore-dependency-cache@main | ||
- name: | ||
uses: Beuterei/reusable-workflows/.github/actions/jest-test-runner@main | ||
|
||
deploy: | ||
runs-on: ubuntu-latest | ||
needs: [build, linting, testing] | ||
steps: | ||
- uses: actions/cache/restore@v4 | ||
with: | ||
path: dist | ||
key: build-${{ runner.os }}-${{ github.sha }} | ||
- name: Deploy | ||
uses: Beuterei/reusable-workflows/.github/actions/upload-to-s3@main | ||
with: | ||
access_key: ${{ secrets.ACCESS_KEY }} | ||
secret_key: ${{ secrets.SECRET_KEY }} | ||
bucket_name: ${{ inputs.bucket_name }} | ||
endpoint: ${{ inputs.endpoint }} | ||
source_path: dist/ |