Skip to content

Commit

Permalink
run tests and package
Browse files Browse the repository at this point in the history
  • Loading branch information
benconnito committed Sep 29, 2023
2 parents fed22a8 + a95fe55 commit fd063b3
Show file tree
Hide file tree
Showing 10 changed files with 58,139 additions and 374,361 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci-unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ jobs:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
# This should match the using value in `actions.yaml`
node-version: 12
node-version: 16
- run: npm ci
- run: npm run lint
- run: npm run test
33 changes: 33 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Publish

on:
release:
types: [published, edited]

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.release.tag_name }}
- name: Use node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16
- name: NPM Install
run: npm ci
- name: Check Format
run: npm run format:check
- name: Lint
run: npm run lint
- name: Build
run: npm run build
- name: Test
run: npm run test
- uses: JasonEtco/build-and-tag-action@v2
env:
GITHUB_TOKEN: ${{ github.token }}
with:
tag_name: ${{ github.event.release.tag_name }}
86 changes: 83 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,42 @@ The only required input is `project-name`.
that CodeBuild requires.
By default, the action uses the buildspec file location
that you configured in the CodeBuild project.

Alternatively, you can pass in an inline buildspec definition like so:

```
- name: Run CodeBuild
uses: aws-actions/aws-codebuild-run-build@v1
with:
project-name: my-codebuild-job
disable-source-override: true
buildspec-override: |
version: 0.2
phases:
install:
runtime-versions:
nodejs: 16
commands:
- npm install -g typescript
- npm install
pre_build:
commands:
- echo Installing source NPM dependencies...
build:
commands:
- echo Build started on `date`
- tsc
- npm prune --production
post_build:
commands:
- echo Build completed on `date`
artifacts:
type: zip
files:
- package.json
- package-lock.json
```

1. **compute-type-override** (optional) :
The name of a compute type for this build that overrides the one specified
in the build project.
Expand All @@ -31,6 +67,11 @@ The only required input is `project-name`.
1. **image-override** (optional) :
The name of an image for this build that overrides the one specified
in the build project.
1. **image-pull-credentials-type-override** (optional) :
The type of credentials CodeBuild uses to pull images in your build.
1. **disable-source-override** (optional) :
Set to `true` if you want to disable providing `sourceVersion`,
`sourceTypeOverride` and `sourceLocationOverride` to CodeBuild.
1. **env-vars-for-codebuild** (optional) :
A comma-separated list of the names of environment variables
that the action passes from GitHub Actions to CodeBuild.
Expand All @@ -46,6 +87,37 @@ The only required input is `project-name`.
the one defined here replaces the one in the CodeBuild project.
For a list of CodeBuild environment variables, see

1. **update-interval** (optional) :
Update interval as seconds for how often the API is called to check on the status.

A higher value mitigates the chance of hitting API rate-limiting especially when
running many instances of this action in parallel, but also introduces a larger
potential time overhead (ranging from 0 to update interval) for the action to
fetch the build result and finish.

Lower value limits the potential time overhead worst case but it may hit the API
rate-limit more often, depending on the use-case.

The default value is 30.

1. **update-back-off** (optional) :
Base back-off time in seconds for the update interval.

When API rate-limiting is hit the back-off time, augmented with jitter, will be
added to the next update interval.
E.g. with update interval of 30 and back-off time of 15, upon hitting the rate-limit
the next interval for the update call will be 30 + random*between(0, 15 * 2 \*\* 0))
seconds and if the rate-limit is hit again the next interval will be
30 + random*between(0, 15 * 2 \*\* 1) and so on.

The default value is 15.

1. **hide-cloudwatch-logs** (optional) :
Set to `true` if you do not want CloudWatch Logs to be streamed to GitHub Action.

1. **disable-github-env-vars** (optional) :
Set to `true` if you want do disable github environment variables in codebuild.

### Outputs

1. **aws-build-id** : The CodeBuild build ID of the build that the action ran.
Expand Down Expand Up @@ -170,7 +242,7 @@ this will overwrite them.
uses: aws-actions/aws-codebuild-run-build@v1
with:
project-name: CodeBuildProjectName
buildspec-override: path/to/buildspec.yaml
buildspec-override: path/to/buildspec.yaml or inline buildspec definition
compute-type-override: compute-type
environment-type-override: environment-type
image-override: ecr-image-uri
Expand Down Expand Up @@ -220,9 +292,9 @@ Otherwise, it fails.
In the call to StartBuild, we pass in all
`GITHUB_` [environment variables][github environment variables] in the GitHub Actions environment,
plus any environment variables that you specified in the `evn-passthrough` input value.
plus any environment variables that you specified in the `env-passthrough` input value.
Regardless of the project configuration in CodeBuild or GitHub Actions,
By default, regardless of the project configuration in CodeBuild or GitHub Actions,
we always pass the following parameters and values to CodeBuild in the StartBuild API call.
| CodeBuild value | GitHub value |
Expand All @@ -231,6 +303,8 @@ we always pass the following parameters and values to CodeBuild in the StartBuil
| `sourceTypeOverride` | The string `'GITHUB'` |
| `sourceLocationOverride` | The `HTTPS` git url for `context.repo` |
If you want to disable sending the parameters `sourceVersion`, `sourceTypeOverride` and `sourceLocationOverride` you can use `disable-source-override` input.
### What we did not do
This action intentionally does not let you specify every option
Expand All @@ -250,6 +324,12 @@ For this reason, and to simplify what we expect to be the most common use-cases,
we chose to start with the simplest possible configuration.
If you find that these options don't meet your needs, please open an issue to let us know.
## Release Process
By creating a new Release a workflow is triggered creating a new commit which only contains `dist` and the `action.yml`. The necessary tags, i.e. for the release v1.0.7, the tag v1.0.7 is created and the v1.0 and v1 tags are updated.
For the tagging and building the [build-and-tag](https://github.com/JasonEtco/build-and-tag-action) action by [Jason Etcovitch](https://github.com/JasonEtco) is used. It expects to have the main attribute and a build script to be set in the `package.json`. It then builds the code with the ncc compiler and creates the new tag/ updates existing tags for minor and major versions automatically.
## License
This SDK is distributed under the
Expand Down
20 changes: 19 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,30 @@ inputs:
image-override:
description: 'The name of an image for this build that overrides the one specified in the build project.'
required: false
image-pull-credentials-type-override:
description: 'The type of credentials CodeBuild uses to pull images in your build.'
required: false
env-vars-for-codebuild:
description: 'Comma separated list of environment variables to send to CodeBuild'
required: false
update-interval:
description: 'How often the action calls the API for updates'
required: false
update-back-off:
description: 'Base back-off time for the update calls for API if rate-limiting is encountered'
required: false
disable-source-override:
description: 'Set to `true` if you want do disable source repo override'
required: false
hide-cloudwatch-logs:
description: 'Set to `true` to prevent the CloudWatch logs from streaming the output to GitHub'
required: false
disable-github-env-vars:
description: 'Set to `true` if you want do disable github environment variables in codebuild'
required: false
outputs:
aws-build-id:
description: 'The AWS CodeBuild Build ID for this build.'
runs:
using: 'node12'
using: 'node16'
main: 'dist/index.js'
Loading

0 comments on commit fd063b3

Please sign in to comment.