Skip to content

Commit fd063b3

Browse files
committed
run tests and package
2 parents fed22a8 + a95fe55 commit fd063b3

File tree

10 files changed

+58139
-374361
lines changed

10 files changed

+58139
-374361
lines changed

.github/workflows/ci-unit-tests.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ jobs:
88
contents: read
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v2
12-
- uses: actions/setup-node@v1
11+
- uses: actions/checkout@v3
12+
- uses: actions/setup-node@v3
1313
with:
1414
# This should match the using value in `actions.yaml`
15-
node-version: 12
15+
node-version: 16
1616
- run: npm ci
1717
- run: npm run lint
1818
- run: npm run test

.github/workflows/publish.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Publish
2+
3+
on:
4+
release:
5+
types: [published, edited]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v3
13+
with:
14+
ref: ${{ github.event.release.tag_name }}
15+
- name: Use node.js 16.x
16+
uses: actions/setup-node@v3
17+
with:
18+
node-version: 16
19+
- name: NPM Install
20+
run: npm ci
21+
- name: Check Format
22+
run: npm run format:check
23+
- name: Lint
24+
run: npm run lint
25+
- name: Build
26+
run: npm run build
27+
- name: Test
28+
run: npm run test
29+
- uses: JasonEtco/build-and-tag-action@v2
30+
env:
31+
GITHUB_TOKEN: ${{ github.token }}
32+
with:
33+
tag_name: ${{ github.event.release.tag_name }}

README.md

Lines changed: 83 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,42 @@ The only required input is `project-name`.
2222
that CodeBuild requires.
2323
By default, the action uses the buildspec file location
2424
that you configured in the CodeBuild project.
25+
26+
Alternatively, you can pass in an inline buildspec definition like so:
27+
28+
```
29+
- name: Run CodeBuild
30+
uses: aws-actions/aws-codebuild-run-build@v1
31+
with:
32+
project-name: my-codebuild-job
33+
disable-source-override: true
34+
buildspec-override: |
35+
version: 0.2
36+
phases:
37+
install:
38+
runtime-versions:
39+
nodejs: 16
40+
commands:
41+
- npm install -g typescript
42+
- npm install
43+
pre_build:
44+
commands:
45+
- echo Installing source NPM dependencies...
46+
build:
47+
commands:
48+
- echo Build started on `date`
49+
- tsc
50+
- npm prune --production
51+
post_build:
52+
commands:
53+
- echo Build completed on `date`
54+
artifacts:
55+
type: zip
56+
files:
57+
- package.json
58+
- package-lock.json
59+
```
60+
2561
1. **compute-type-override** (optional) :
2662
The name of a compute type for this build that overrides the one specified
2763
in the build project.
@@ -31,6 +67,11 @@ The only required input is `project-name`.
3167
1. **image-override** (optional) :
3268
The name of an image for this build that overrides the one specified
3369
in the build project.
70+
1. **image-pull-credentials-type-override** (optional) :
71+
The type of credentials CodeBuild uses to pull images in your build.
72+
1. **disable-source-override** (optional) :
73+
Set to `true` if you want to disable providing `sourceVersion`,
74+
`sourceTypeOverride` and `sourceLocationOverride` to CodeBuild.
3475
1. **env-vars-for-codebuild** (optional) :
3576
A comma-separated list of the names of environment variables
3677
that the action passes from GitHub Actions to CodeBuild.
@@ -46,6 +87,37 @@ The only required input is `project-name`.
4687
the one defined here replaces the one in the CodeBuild project.
4788
For a list of CodeBuild environment variables, see
4889

90+
1. **update-interval** (optional) :
91+
Update interval as seconds for how often the API is called to check on the status.
92+
93+
A higher value mitigates the chance of hitting API rate-limiting especially when
94+
running many instances of this action in parallel, but also introduces a larger
95+
potential time overhead (ranging from 0 to update interval) for the action to
96+
fetch the build result and finish.
97+
98+
Lower value limits the potential time overhead worst case but it may hit the API
99+
rate-limit more often, depending on the use-case.
100+
101+
The default value is 30.
102+
103+
1. **update-back-off** (optional) :
104+
Base back-off time in seconds for the update interval.
105+
106+
When API rate-limiting is hit the back-off time, augmented with jitter, will be
107+
added to the next update interval.
108+
E.g. with update interval of 30 and back-off time of 15, upon hitting the rate-limit
109+
the next interval for the update call will be 30 + random*between(0, 15 * 2 \*\* 0))
110+
seconds and if the rate-limit is hit again the next interval will be
111+
30 + random*between(0, 15 * 2 \*\* 1) and so on.
112+
113+
The default value is 15.
114+
115+
1. **hide-cloudwatch-logs** (optional) :
116+
Set to `true` if you do not want CloudWatch Logs to be streamed to GitHub Action.
117+
118+
1. **disable-github-env-vars** (optional) :
119+
Set to `true` if you want do disable github environment variables in codebuild.
120+
49121
### Outputs
50122

51123
1. **aws-build-id** : The CodeBuild build ID of the build that the action ran.
@@ -170,7 +242,7 @@ this will overwrite them.
170242
uses: aws-actions/aws-codebuild-run-build@v1
171243
with:
172244
project-name: CodeBuildProjectName
173-
buildspec-override: path/to/buildspec.yaml
245+
buildspec-override: path/to/buildspec.yaml or inline buildspec definition
174246
compute-type-override: compute-type
175247
environment-type-override: environment-type
176248
image-override: ecr-image-uri
@@ -220,9 +292,9 @@ Otherwise, it fails.
220292
221293
In the call to StartBuild, we pass in all
222294
`GITHUB_` [environment variables][github environment variables] in the GitHub Actions environment,
223-
plus any environment variables that you specified in the `evn-passthrough` input value.
295+
plus any environment variables that you specified in the `env-passthrough` input value.
224296
225-
Regardless of the project configuration in CodeBuild or GitHub Actions,
297+
By default, regardless of the project configuration in CodeBuild or GitHub Actions,
226298
we always pass the following parameters and values to CodeBuild in the StartBuild API call.
227299
228300
| CodeBuild value | GitHub value |
@@ -231,6 +303,8 @@ we always pass the following parameters and values to CodeBuild in the StartBuil
231303
| `sourceTypeOverride` | The string `'GITHUB'` |
232304
| `sourceLocationOverride` | The `HTTPS` git url for `context.repo` |
233305
306+
If you want to disable sending the parameters `sourceVersion`, `sourceTypeOverride` and `sourceLocationOverride` you can use `disable-source-override` input.
307+
234308
### What we did not do
235309
236310
This action intentionally does not let you specify every option
@@ -250,6 +324,12 @@ For this reason, and to simplify what we expect to be the most common use-cases,
250324
we chose to start with the simplest possible configuration.
251325
If you find that these options don't meet your needs, please open an issue to let us know.
252326
327+
## Release Process
328+
329+
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.
330+
331+
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.
332+
253333
## License
254334
255335
This SDK is distributed under the

action.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,30 @@ inputs:
1919
image-override:
2020
description: 'The name of an image for this build that overrides the one specified in the build project.'
2121
required: false
22+
image-pull-credentials-type-override:
23+
description: 'The type of credentials CodeBuild uses to pull images in your build.'
24+
required: false
2225
env-vars-for-codebuild:
2326
description: 'Comma separated list of environment variables to send to CodeBuild'
2427
required: false
28+
update-interval:
29+
description: 'How often the action calls the API for updates'
30+
required: false
31+
update-back-off:
32+
description: 'Base back-off time for the update calls for API if rate-limiting is encountered'
33+
required: false
34+
disable-source-override:
35+
description: 'Set to `true` if you want do disable source repo override'
36+
required: false
37+
hide-cloudwatch-logs:
38+
description: 'Set to `true` to prevent the CloudWatch logs from streaming the output to GitHub'
39+
required: false
40+
disable-github-env-vars:
41+
description: 'Set to `true` if you want do disable github environment variables in codebuild'
42+
required: false
2543
outputs:
2644
aws-build-id:
2745
description: 'The AWS CodeBuild Build ID for this build.'
2846
runs:
29-
using: 'node12'
47+
using: 'node16'
3048
main: 'dist/index.js'

0 commit comments

Comments
 (0)