-
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
1 parent
ebd07d9
commit 6ff6ba1
Showing
2 changed files
with
120 additions
and
0 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,43 @@ | ||
name: Assign issues and PRs to project | ||
|
||
on: | ||
issues: | ||
types: [opened, reopened] | ||
|
||
pull_request: | ||
types: [opened, reopened] | ||
|
||
workflow_call: | ||
inputs: | ||
project-id: | ||
default: 2 | ||
description: Issues and PRs will be assigned to that project. Default to 2 (Hedia). | ||
required: false | ||
type: number | ||
|
||
secrets: | ||
ASSIGN_TO_PROJECT_TOKEN: | ||
description: Personal Access Token with "repo" and "project" permissions. | ||
required: true | ||
|
||
jobs: | ||
project: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- id: addItem | ||
name: Add to project | ||
uses: actions/[email protected] | ||
with: | ||
project-url: https://github.com/orgs/hedia-team/projects/${{inputs.project-id}} | ||
github-token: ${{ secrets.ASSIGN_TO_PROJECT_TOKEN }} | ||
|
||
- if: github.event_name == 'pull_request' | ||
name: Set status | ||
uses: hedia-team/[email protected] | ||
with: | ||
project-url: https://github.com/orgs/hedia-team/projects/${{inputs.project-id}} | ||
github-token: ${{ secrets.ASSIGN_TO_PROJECT_TOKEN }} | ||
item-id: ${{ steps.addItem.outputs.itemId }} | ||
field-keys: Status | ||
field-values: In Progress |
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,77 @@ | ||
name: Run Build, Tests & SonarCloud Scan | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
database: | ||
description: Database used in this workflow. Default to none. | ||
required: false | ||
type: string | ||
|
||
secrets: | ||
READONLY_NPM_TOKEN: | ||
description: Needed to install private @hedia npm packages | ||
required: true | ||
SONAR_TOKEN: | ||
description: Needed to run SonarCloud Scan | ||
required: true | ||
|
||
jobs: | ||
build-test: | ||
runs-on: ubuntu-latest | ||
|
||
services: | ||
postgres: | ||
image: ${{ inputs.database && 'postgres' || '' }} | ||
env: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: password | ||
POSTGRES_DB: ${{ inputs.database }} | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
ports: | ||
- 5432:5432 | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of SonarCloud analysis | ||
|
||
- name: Setup Node.js Environment | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: "package.json" | ||
always-auth: true | ||
registry-url: https://registry.npmjs.org | ||
scope: "@hedia" | ||
|
||
- name: "Install Dependencies" | ||
run: npm ci | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.READONLY_NPM_TOKEN }} | ||
|
||
- name: "Build Repository" | ||
run: "npm run build --if-present" | ||
|
||
- name: "Run Tests" | ||
run: "npm run test" | ||
|
||
- name: SonarCloud Init | ||
env: | ||
GITHUB_PROJECT: ${{ github.repository }} | ||
run: echo "GITHUB_PROJECT=${GITHUB_PROJECT/\//_}" >> $GITHUB_ENV | ||
|
||
- name: SonarCloud Scan | ||
uses: SonarSource/sonarcloud-github-action@master | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
with: | ||
args: > | ||
-Dsonar.projectKey=${{ env.GITHUB_PROJECT }} | ||
-Dsonar.organization=${{ github.repository_owner }} | ||
-Dsonar.coverageReportPaths=coverage.xml |