Skip to content

Commit cb02c5f

Browse files
committed
Enhance workflow
Signed-off-by: CrazyMax <[email protected]>
1 parent f0d07f4 commit cb02c5f

File tree

15 files changed

+184
-149
lines changed

15 files changed

+184
-149
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/coverage
2+
/node_modules

.github/CONTRIBUTING.md

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,24 @@
22

33
Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great.
44

5-
Contributions to this project are [released](https://help.github.com/articles/github-terms-of-service/#6-contributions-under-repository-license) to the public under the [project's open source license](LICENSE).
5+
Contributions to this project are [released](https://docs.github.com/en/github/site-policy/github-terms-of-service#6-contributions-under-repository-license)
6+
to the public under the [project's open source license](LICENSE).
67

78
## Submitting a pull request
89

910
1. [Fork](https://github.com/docker/setup-buildx-action/fork) and clone the repository
1011
2. Configure and install the dependencies: `yarn install`
1112
3. Create a new branch: `git checkout -b my-branch-name`
12-
4. Make your change, add tests, and make sure the tests still pass
13-
5. Run pre-checkin: `yarn run pre-checkin`
14-
6. Push to your fork and [submit a pull request](https://github.com/docker/setup-buildx-action/compare)
15-
7. Pat yourself on the back and wait for your pull request to be reviewed and merged.
16-
17-
## Container based developer flow
18-
19-
If you don't want to maintain a Node developer environment that fits this project you can use containerized commands instead of invoking yarn directly.
20-
21-
```
22-
# format code and build javascript artifacts
23-
docker buildx bake pre-checkin
24-
25-
# validate all code has correctly formatted and built
26-
docker buildx bake validate
27-
28-
# run tests
29-
docker buildx bake test
30-
```
13+
4. Make your changes
14+
5. Make sure the tests pass: `docker buildx bake test`
15+
6. Format code and build javascript artifacts: `docker buildx bake pre-checkin`
16+
7. Validate all code has correctly formatted and built: `docker buildx bake validate`
17+
8. Push to your fork and [submit a pull request](https://github.com/docker/setup-buildx-action/compare)
18+
9. Pat your self on the back and wait for your pull request to be reviewed and merged.
3119

3220
Here are a few things you can do that will increase the likelihood of your pull request being accepted:
3321

22+
- Write tests.
3423
- Make sure the `README.md` and any other relevant **documentation are kept up-to-date**.
3524
- We try to follow [SemVer v2.0.0](https://semver.org/). Randomly breaking public APIs is not an option.
3625
- Keep your change as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as **separate pull requests**.
@@ -39,5 +28,5 @@ Here are a few things you can do that will increase the likelihood of your pull
3928
## Resources
4029

4130
- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)
42-
- [Using Pull Requests](https://help.github.com/articles/about-pull-requests/)
43-
- [GitHub Help](https://help.github.com)
31+
- [Using Pull Requests](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests)
32+
- [GitHub Help](https://docs.github.com/en)

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,5 @@ about: Create a report to help us improve
3030

3131
### Logs
3232

33-
> Download the [log file of your build](https://help.github.com/en/actions/configuring-and-managing-workflows/managing-a-workflow-run#downloading-logs) and [attach it](https://help.github.com/en/github/managing-your-work-on-github/file-attachments-on-issues-and-pull-requests) to this issue.
33+
> Download the [log file of your build](https://docs.github.com/en/actions/managing-workflow-runs/using-workflow-run-logs#downloading-logs)
34+
> and [attach it](https://docs.github.com/en/github/managing-your-work-on-github/file-attachments-on-issues-and-pull-requests) to this issue.

.github/setup-buildx-action.png

565 Bytes
Loading

.github/workflows/ci.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
name: ci
22

33
on:
4+
schedule:
5+
- cron: '0 10 * * *' # everyday at 10am
46
push:
57
branches:
6-
- master
7-
- releases/v*
8-
paths-ignore:
9-
- "**.md"
8+
- 'master'
9+
- 'releases/v*'
10+
tags:
11+
- 'v*'
1012
pull_request:
1113
branches:
12-
- master
13-
- releases/v*
14-
paths-ignore:
15-
- "**.md"
14+
- 'master'
15+
- 'releases/v*'
1616

1717
jobs:
1818
main:

.github/workflows/test.yml

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,32 @@ name: test
33
on:
44
push:
55
branches:
6-
- master
7-
- releases/v*
8-
paths-ignore:
9-
- "**.md"
6+
- 'master'
7+
- 'releases/v*'
108
pull_request:
11-
paths-ignore:
12-
- "**.md"
9+
branches:
10+
- 'master'
11+
- 'releases/v*'
1312

1413
jobs:
15-
test-containerized:
16-
runs-on: ubuntu-latest
17-
steps:
18-
-
19-
name: Checkout
20-
uses: actions/checkout@v2
21-
-
22-
name: Validate
23-
run: docker buildx bake validate
24-
-
25-
name: Test
26-
run: docker buildx bake test
27-
2814
test:
2915
runs-on: ubuntu-latest
3016
steps:
3117
-
3218
name: Checkout
3319
uses: actions/checkout@v2
3420
-
35-
name: Install
36-
run: yarn install
21+
name: Validate
22+
uses: docker/bake-action@v1
23+
with:
24+
targets: validate
3725
-
3826
name: Test
39-
run: yarn run test
27+
uses: docker/bake-action@v1
28+
with:
29+
targets: test
4030
-
4131
name: Upload coverage
4232
uses: codecov/codecov-action@v1
43-
if: success()
4433
with:
45-
token: ${{ secrets.CODECOV_TOKEN }}
4634
file: ./coverage/clover.xml

Dockerfile

Lines changed: 0 additions & 52 deletions
This file was deleted.

dist/index.js

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docker-bake.hcl

Lines changed: 43 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,67 @@
1+
variable "NODE_VERSION" {
2+
default = "12"
3+
}
4+
5+
target "node-version" {
6+
args = {
7+
NODE_VERSION = NODE_VERSION
8+
}
9+
}
10+
111
group "default" {
212
targets = ["build"]
313
}
414

515
group "pre-checkin" {
6-
targets = ["update-yarn", "format", "build"]
16+
targets = ["vendor-update", "format", "build"]
717
}
818

919
group "validate" {
10-
targets = ["validate-format", "validate-build", "validate-yarn"]
11-
}
12-
13-
target "update-yarn" {
14-
target = "update-yarn"
15-
output = ["."]
20+
targets = ["format-validate", "build-validate", "vendor-validate"]
1621
}
1722

1823
target "build" {
19-
target = "dist"
24+
inherits = ["node-version"]
25+
dockerfile = "./hack/build.Dockerfile"
26+
target = "build-update"
2027
output = ["."]
2128
}
2229

23-
target "test" {
24-
target = "test"
30+
target "build-validate" {
31+
inherits = ["node-version"]
32+
dockerfile = "./hack/build.Dockerfile"
33+
target = "build-validate"
2534
}
2635

2736
target "format" {
28-
target = "format"
37+
inherits = ["node-version"]
38+
dockerfile = "./hack/build.Dockerfile"
39+
target = "format-update"
2940
output = ["."]
3041
}
3142

32-
target "validate-format" {
33-
target = "validate-format"
43+
target "format-validate" {
44+
inherits = ["node-version"]
45+
dockerfile = "./hack/build.Dockerfile"
46+
target = "format-validate"
47+
}
48+
49+
target "vendor-update" {
50+
inherits = ["node-version"]
51+
dockerfile = "./hack/vendor.Dockerfile"
52+
target = "update"
53+
output = ["."]
3454
}
3555

36-
target "validate-build" {
37-
target = "validate-build"
56+
target "vendor-validate" {
57+
inherits = ["node-version"]
58+
dockerfile = "./hack/vendor.Dockerfile"
59+
target = "validate"
3860
}
3961

40-
target "validate-yarn" {
41-
target = "validate-yarn"
42-
}
62+
target "test" {
63+
inherits = ["node-version"]
64+
dockerfile = "./hack/test.Dockerfile"
65+
target = "test-coverage"
66+
output = ["./coverage"]
67+
}

0 commit comments

Comments
 (0)