Skip to content

Commit

Permalink
ci: setup and configure github actions (#25)
Browse files Browse the repository at this point in the history
* ci: add push and pull-request workflows

* ci: remove branch filter in push workflow

* ci: fix setup cache-dependency-path

* ci: fix pnpm install working-directory

* chore: update pnpm-lock.yml

* feat: start dashboard or execute cli when provided with a command

* ci: export and store graphql schema + nextjs caching

* ci: add missing shell property

* ci: use correct working-directory to run dashboard

* ci: use correct working-directory to run dashboard

* chore: add relay build to root build command

* chore: fix `artifactDirectory` does not exist at `src/__generated__`

* chore: add giantnodes/[email protected] to resolve type issues

* chore: fix eslint issues

* ci: fix cache restoring after nextjs was built

* ci: fix next build due to failed to parse URL from undefined/graphql

* ci: fix cache running after install step

* ci: fix next build due to failed to parse URL from undefined/graphql

* build: force pages to be dynamic

* build: set next revalidate to 0 to prevent build time fetching

* build: add force dynamic to page layouts

* build: remove redundant force-dynamic exports

* ci: reorder steps and comment out testing step
  • Loading branch information
PHILLIPS71 authored Apr 16, 2024
1 parent 29848f4 commit 55d9c6b
Show file tree
Hide file tree
Showing 24 changed files with 1,963 additions and 462 deletions.
17 changes: 17 additions & 0 deletions .github/actions/cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "🔺️ "

runs:
using: "composite"
steps:
- name: "🔺️ Cache (store directory)"
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: "🔺️ Cache"
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
20 changes: 20 additions & 0 deletions .github/actions/schema/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "📄 "

inputs:
working-directory:
required: true

runs:
using: "composite"
steps:
- name: "📄 Build GraphQL Schema"
shell: bash
run: dotnet run -- schema export --output schema.graphql
working-directory: ${{ inputs.working-directory }}

- name: "📄 Upload GraphQL Schema"
uses: actions/upload-artifact@v4
with:
name: schema-${{ github.run_number }}.graphql
path: ${{ inputs.working-directory }}/schema.graphql
retention-days: 1
27 changes: 27 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: "💽️ "

inputs:
node-version:
default: "20"
description: "🔢 Node version"
required: true
pnpm-version:
default: "8"
description: "🔢 pnpm version"
required: true

runs:
using: "composite"
steps:
- name: "🔧 pnpm"
uses: pnpm/action-setup@v3
with:
version: ${{ inputs.pnpm-version }}

- name: "💽️ Node ${{ inputs.node-version }}"
uses: actions/setup-node@v4
with:
registry-url: "https://registry.npmjs.org"
node-version: ${{ inputs.node-version }}
cache: "pnpm"
cache-dependency-path: ./app/pnpm-lock.yaml
189 changes: 0 additions & 189 deletions .github/workflows/main.yml

This file was deleted.

9 changes: 2 additions & 7 deletions .github/workflows/pr-title.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
name: pr-title
name: "📝 PR Title"

on:
pull_request_target:
types:
- opened
- reopened
- edited
- synchronize

jobs:
main:
name: 🏷️ PR Title
name: 📝 PR Title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
Expand Down
114 changes: 114 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: "🔀 Pull Request"

on:
pull_request_target:

concurrency:
group: pull-request-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
infrastructure:
name: "👷️ CI (Infrastructure)"
timeout-minutes: 20
runs-on: ubuntu-latest
steps:
- name: "🐙️ Checkout"
uses: actions/checkout@v4

- name: "💽️ Setup"
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"

- name: "🧪 Test"
run: dotnet test --verbosity quiet
working-directory: ./src/Infrastructure

dashboard:
name: "👷️ CI (Dashboard)"
timeout-minutes: 20
runs-on: ubuntu-latest
steps:
- name: "🐙️ Checkout"
uses: actions/checkout@v4

- name: "💽️ Setup"
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"

- name: "🧪 Test"
run: dotnet test --verbosity quiet
working-directory: ./src/Service.Dashboard

- name: "⬆️ GraphQL Schema (upload)"
uses: ./.github/actions/schema
with:
working-directory: src/Service.Dashboard/src/HttpApi

encoder:
name: "👷️ CI (Encoder)"
timeout-minutes: 20
runs-on: ubuntu-latest
steps:
- name: "🐙️ Checkout"
uses: actions/checkout@v4

- name: "💽️ Setup"
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"

- name: "🧪 Test"
run: dotnet test --verbosity quiet
working-directory: ./src/Service.Encoder

app:
name: "👷️ CI (App)"
timeout-minutes: 20
runs-on: ubuntu-latest
needs: [dashboard]
strategy:
fail-fast: false
steps:
- name: "🐙️ Checkout"
uses: actions/checkout@v4

- name: "💽️ Setup"
uses: ./.github/actions/setup

- name: "🔺️ Cache (pnpm)"
uses: ./.github/actions/cache

- name: "📦 Install"
shell: bash
working-directory: ./app
run: |
pnpm install --frozen-lockfile
- name: "⬇️ GraphQL Schema (download)"
uses: actions/download-artifact@v4
with:
name: schema-${{ github.run_number }}.graphql
path: ./app

- name: "🔺️ Cache (nextjs)"
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/app/.next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-
- name: "🏗️ Build"
working-directory: ./app
shell: bash
run: |
pnpm run build
# - name: "🧪 Test"
# working-directory: ./app
# shell: bash
# run: |
# pnpm run test
Loading

0 comments on commit 55d9c6b

Please sign in to comment.