Skip to content

Commit

Permalink
add ort toolkit github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
krokoko committed Oct 25, 2023
1 parent c69063c commit 4d75749
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitattributes

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/monthly-repo-metrics.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions .github/workflows/ort-checker.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .projen/files.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion .projenrc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@
* and limitations under the License.
*/
import { awscdk } from 'projen';
import { buildMeritBadgerWorkflow, buildMonthlyIssuesMetricsWorkflow, buildUpdateContributorsWorkflow, buildAutoApproveWorkflow } from './projenrc/github-workflows';
import {
buildMeritBadgerWorkflow,
buildMonthlyIssuesMetricsWorkflow,
buildUpdateContributorsWorkflow,
buildAutoApproveWorkflow,
buildOrtToolkitWorkflow,
} from './projenrc/github-workflows';

// Constants
const GITHUB_USER = 'aws-samples';
Expand Down Expand Up @@ -78,6 +84,7 @@ buildMeritBadgerWorkflow(project);
buildMonthlyIssuesMetricsWorkflow(project);
buildUpdateContributorsWorkflow(project);
buildAutoApproveWorkflow(project);
buildOrtToolkitWorkflow(project);

// We don't want to package certain things
project.npmignore?.addPatterns(
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# CDK Emerging Tech Constructs V0.0.35 (2023-10-25)

Based on CDK library version 2.102.0

# CDK Emerging Tech Constructs V0.0.24 (2023-10-16)

Based on CDK library version 2.99.1
Expand Down
9 changes: 4 additions & 5 deletions DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@ Default region name [None]: us-east-1
Default output format [None]: json
```

- [Node](https://nodejs.org/en) >= v18.12.1
- [AWS CDK](https://github.com/aws/aws-cdk/releases/tag/v2.96.2) >= 2.96.2
- [Node](https://nodejs.org/en) >= v20.9.0
- [AWS CDK](https://github.com/aws/aws-cdk/releases/tag/v2.102.0) >= 2.102.0
- [Python](https://www.python.org/downloads/) >=3.9
- [Projen](https://github.com/projen/projen) >= 0.65.14
- [PNPM](https://pnpm.io/installation) >= 8.7.4
- [PDK](https://aws.github.io/aws-pdk/getting_started/index.html) >= 0.21.5
- [Yarn](https://classic.yarnpkg.com/lang/en/docs/cli/install/) >= 1.22.19

You can use the command below to install the dependencies listed above
```
npm install -g npm aws-cdk pnpm @aws/pdk projen
npm install -g npm aws-cdk yarn projen
```

## Preparing your Build Environment
Expand Down
46 changes: 43 additions & 3 deletions projenrc/github-workflows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export function buildMonthlyIssuesMetricsWorkflow(project: AwsCdkConstructLibrar
'# Calculate the first day of the previous month',
'first_day=$(date -d "last month" +%Y-%m-01)',
'# Calculate the last day of the previous month',
'last_day=$(date -d $first_day +1 month -1 day +%Y-%m-%d)',
'last_day=$(date -d "$first_day +1 month -1 day" +%Y-%m-%d)',
'# Set an environment variable with the date range',
'echo "$first_day..$last_day"',
'echo "last_month=$first_day..$last_day" >> "$GITHUB_ENV"',
Expand Down Expand Up @@ -156,7 +156,7 @@ export function buildUpdateContributorsWorkflow(project: AwsCdkConstructLibrary)
runsOn: ['ubuntu-latest'],
steps: [
{
uses: 'actions/checkout@v4',
uses: 'actions/checkout@v3',
},
{
uses: 'minicli/[email protected]',
Expand Down Expand Up @@ -233,4 +233,44 @@ export function buildAutoApproveWorkflow(project: AwsCdkConstructLibrary) {
workflow.addJobs({ 'auto-approve': autoapprove });
}
}
}
}

/**
* https://github.com/oss-review-toolkit/ort-ci-github-action
* Runs ORT toolkit on the repository.
* @param project AwsCdkConstructLibrary
*/
export function buildOrtToolkitWorkflow(project: AwsCdkConstructLibrary) {
const orttoolkit: Job = {
runsOn: ['ubuntu-latest'],
permissions: {
contents: JobPermission.WRITE,
},
steps: [
{
name: 'Checkout project',
uses: 'actions/checkout@v3',
},
{
name: 'Run GitHub Action for ORT',
uses: 'oss-review-toolkit/ort-ci-github-action@v1',
},
],
};

if (project.github) {
const workflow = project.github.addWorkflow('ort-checker');
if (workflow) {
workflow.on({
push: {
branches: [
'main',
],
},
workflowDispatch: {},
});
workflow.addJobs({ ort: orttoolkit });
}
}
}

0 comments on commit 4d75749

Please sign in to comment.