Skip to content

Commit 3fada34

Browse files
authored
Container based developer flow (#122)
Co-authored-by: CrazyMax <[email protected]>
1 parent 1479af0 commit 3fada34

11 files changed

+168
-3106
lines changed

.dockerignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/.dev
2+
/coverage
3+
/dist
4+
/lib
5+
/node_modules
6+
/.env

.github/CONTRIBUTING.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ Contributions to this project are [released](https://help.github.com/articles/gi
77
## Submitting a pull request
88

99
1. [Fork](https://github.com/crazy-max/ghaction-github-labeler/fork) and clone the repository
10-
2. Configure and install the dependencies: `yarn install`
10+
2. Configure and install the dependencies locally: `yarn install`
1111
4. Create a new branch: `git checkout -b my-branch-name`
12-
5. Make your change
13-
6. Run pre-checkin: `yarn run pre-checkin`
14-
7. Push to your fork and [submit a pull request](https://github.com/crazy-max/ghaction-github-labeler/compare)
15-
8. Pat your self on the back and wait for your pull request to be reviewed and merged.
12+
5. Make your changes
13+
6. Format code and build javascript artifacts: `docker buildx bake pre-checkin`
14+
7. Validate all code has correctly formatted and built: `docker buildx bake validate`
15+
8. Push to your fork and [submit a pull request](https://github.com/crazy-max/ghaction-github-labeler/compare)
16+
9. Pat your self on the back and wait for your pull request to be reviewed and merged.
1617

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

.github/workflows/ci.yml

+5-6
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@ name: ci
33
on:
44
schedule:
55
- cron: '0 10 * * *' # everyday at 10am
6-
pull_request:
7-
branches:
8-
- master
9-
- releases/v*
106
push:
117
branches:
12-
- master
13-
- releases/v*
8+
- 'master'
9+
- 'releases/v*'
10+
pull_request:
11+
branches:
12+
- 'master'
1413

1514
jobs:
1615
ci:

.github/workflows/pre-checkin.yml

-30
This file was deleted.

.github/workflows/test.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ name: test
33
on:
44
push:
55
branches:
6-
- master
7-
- releases/v*
6+
- 'master'
7+
- 'releases/v*'
88
paths-ignore:
99
- '**.md'
1010
pull_request:
11+
branches:
12+
- 'master'
1113
paths-ignore:
1214
- '**.md'
1315

@@ -29,7 +31,6 @@ jobs:
2931
-
3032
name: Upload coverage
3133
uses: codecov/codecov-action@v1
32-
if: success()
3334
with:
3435
token: ${{ secrets.CODECOV_TOKEN }}
3536
file: ./coverage/clover.xml

.github/workflows/validate.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: validate
2+
3+
on:
4+
push:
5+
branches:
6+
- 'master'
7+
- 'releases/v*'
8+
paths-ignore:
9+
- '**.md'
10+
pull_request:
11+
branches:
12+
- 'master'
13+
paths-ignore:
14+
- '**.md'
15+
16+
jobs:
17+
validate:
18+
runs-on: ubuntu-latest
19+
steps:
20+
-
21+
name: Checkout
22+
uses: actions/checkout@v2
23+
-
24+
name: Validate
25+
run: docker buildx bake validate

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pids
2828
lib-cov
2929

3030
# Coverage directory used by tools like istanbul
31-
coverage
31+
/coverage
3232
*.lcov
3333

3434
# nyc test coverage

Dockerfile.dev

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#syntax=docker/dockerfile:1.2
2+
3+
FROM node:12 AS deps
4+
WORKDIR /src
5+
COPY package.json yarn.lock ./
6+
RUN --mount=type=cache,target=/src/node_modules \
7+
yarn install
8+
9+
FROM scratch AS update-yarn
10+
COPY --from=deps /src/yarn.lock /
11+
12+
FROM deps AS validate-yarn
13+
COPY .git .git
14+
RUN status=$(git status --porcelain -- yarn.lock); if [ -n "$status" ]; then echo $status; exit 1; fi
15+
16+
FROM deps AS base
17+
COPY . .
18+
19+
FROM base AS build
20+
RUN --mount=type=cache,target=/src/node_modules \
21+
yarn build
22+
23+
#FROM deps AS test
24+
#ARG GITHUB_REPOSITORY
25+
#ENV RUNNER_TEMP=/tmp/github_runner
26+
#ENV RUNNER_TOOL_CACHE=/tmp/github_tool_cache
27+
#ENV GITHUB_REPOSITORY=${GITHUB_REPOSITORY}
28+
#COPY . .
29+
#RUN --mount=type=cache,target=/src/node_modules \
30+
# --mount=type=secret,id=github_token \
31+
# GITHUB_TOKEN=$(cat /run/secrets/github_token) env|sort && yarn run test
32+
#
33+
#FROM scratch AS test-coverage
34+
#COPY --from=test /src/coverage /coverage/
35+
36+
FROM base AS run-format
37+
RUN --mount=type=cache,target=/src/node_modules \
38+
yarn run format
39+
40+
FROM scratch AS format
41+
COPY --from=run-format /src/src/*.ts /src/
42+
43+
FROM base AS validate-format
44+
RUN --mount=type=cache,target=/src/node_modules \
45+
yarn run format-check
46+
47+
FROM scratch AS dist
48+
COPY --from=build /src/dist/ /dist/
49+
50+
FROM build AS validate-build
51+
RUN status=$(git status --porcelain -- dist); if [ -n "$status" ]; then echo $status; exit 1; fi
52+
53+
FROM base AS dev
54+
ENTRYPOINT ["bash"]

0 commit comments

Comments
 (0)