-
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.
feat(infrastructure): add github workflows for monorepo
- Loading branch information
Showing
5 changed files
with
166 additions
and
96 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,51 @@ | ||
name: 'Tests (Golang)' | ||
on: | ||
push: | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- 'go-services/**' | ||
- 'go-shared/**' | ||
- 'go.*' | ||
env: | ||
GCP_OIDC_PROVIDER_NAME: github-provider | ||
GCP_PROJECT_ID: basemind-ai-development | ||
GCP_PROJECT_NUMBER: 78794879644 | ||
GCP_SERVICE_ACCOUNT_NAME: firebase-adminsdk-frgvx | ||
GCP_WORKLOAD_IDENTITY_POOL: dev-pool | ||
jobs: | ||
test: | ||
needs: setup | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
id-token: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup Golang | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.21' | ||
- name: Load cached Golang dependencies | ||
id: cached-go-dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cache/go-build | ||
~/go/pkg/mod | ||
key: go-${{ inputs.go_version }}-v1.0-${{ hashFiles('**/go.sum') }} | ||
- name: Install Golang dependencies | ||
if: steps.cached-go-dependencies.outputs.cache-hit != 'true' | ||
shell: bash | ||
run: go get -v -t ./... | ||
|
||
- name: Authenticate with GCP | ||
id: auth | ||
uses: google-github-actions/[email protected] | ||
with: | ||
workload_identity_provider: 'projects/${GCP_PROJECT_NUMBER}/locations/global/workloadIdentityPools/${GCP_WORKLOAD_IDENTITY_POOL}/providers/${GCP_OIDC_PROVIDER_NAME}' | ||
service_account: '${GCP_SERVICE_ACCOUNT_NAME}@${GCP_PROJECT_ID}.iam.gserviceaccount.com' | ||
- name: Test | ||
run: go test ./... |
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,51 @@ | ||
name: 'Tests (TS)' | ||
on: | ||
push: | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- 'ts-services/**' | ||
- 'ts-shared/**' | ||
- 'tsconfig.json' | ||
- 'package.json' | ||
- 'pnpm-lock.yaml' | ||
- 'pnpm-workspace.yaml' | ||
- 'vitest.*' | ||
env: | ||
NODE_OPTIONS: '--max_old_space_size=4096' | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
- name: Install pnpm | ||
uses: pnpm/[email protected] | ||
id: pnpm-install | ||
with: | ||
version: 8 | ||
- name: Setup pnpm cache | ||
id: pnpm-cache | ||
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | ||
- uses: actions/cache@v3 | ||
name: Load cached Node dependencies | ||
with: | ||
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | ||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: ${{ runner.os }}-pnpm-store- | ||
- name: Install Node dependencies | ||
run: pnpm install -r | ||
|
||
- name: Test | ||
run: pnpm run test:coverage | ||
- name: Coverage | ||
uses: davelosert/vitest-coverage-report-action@v2 |
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,64 @@ | ||
name: 'Validate' | ||
on: | ||
push: | ||
pull_request: | ||
branches: | ||
- main | ||
jobs: | ||
validate: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup Golang | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.21' | ||
- name: Load cached Golang dependencies | ||
id: cached-go-dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cache/go-build | ||
~/go/pkg/mod | ||
key: go-${{ inputs.go_version }}-v1.0-${{ hashFiles('**/go.sum') }} | ||
- name: Install Golang dependencies | ||
if: steps.cached-go-dependencies.outputs.cache-hit != 'true' | ||
shell: bash | ||
run: go get -v -t ./... | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
- name: Install pnpm | ||
uses: pnpm/[email protected] | ||
id: pnpm-install | ||
with: | ||
version: 8 | ||
- name: Setup pnpm cache | ||
id: pnpm-cache | ||
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | ||
- uses: actions/cache@v3 | ||
name: Load cached Node dependencies | ||
with: | ||
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | ||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: ${{ runner.os }}-pnpm-store- | ||
- name: Install Node dependencies | ||
run: pnpm install -r | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
- name: Install Pre-Commit | ||
run: python -m pip install pre-commit && pre-commit install | ||
- name: Load cached Pre-Commit Dependencies | ||
id: cached-pre-commit-dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/pre-commit/ | ||
key: pre-commit-4|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }} | ||
- name: Execute Pre-Commit | ||
run: pre-commit run --show-diff-on-failure --color=always --all-files |
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