Skip to content

Commit

Permalink
Container based developer flow (#122)
Browse files Browse the repository at this point in the history
Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
  • Loading branch information
crazy-max and crazy-max committed Dec 16, 2020
1 parent 1479af0 commit 3fada34
Show file tree
Hide file tree
Showing 11 changed files with 168 additions and 3,106 deletions.
6 changes: 6 additions & 0 deletions .dockerignore
@@ -0,0 +1,6 @@
/.dev
/coverage
/dist
/lib
/node_modules
/.env
11 changes: 6 additions & 5 deletions .github/CONTRIBUTING.md
Expand Up @@ -7,12 +7,13 @@ Contributions to this project are [released](https://help.github.com/articles/gi
## Submitting a pull request

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

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

Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/ci.yml
Expand Up @@ -3,14 +3,13 @@ name: ci
on:
schedule:
- cron: '0 10 * * *' # everyday at 10am
pull_request:
branches:
- master
- releases/v*
push:
branches:
- master
- releases/v*
- 'master'
- 'releases/v*'
pull_request:
branches:
- 'master'

jobs:
ci:
Expand Down
30 changes: 0 additions & 30 deletions .github/workflows/pre-checkin.yml

This file was deleted.

7 changes: 4 additions & 3 deletions .github/workflows/test.yml
Expand Up @@ -3,11 +3,13 @@ name: test
on:
push:
branches:
- master
- releases/v*
- 'master'
- 'releases/v*'
paths-ignore:
- '**.md'
pull_request:
branches:
- 'master'
paths-ignore:
- '**.md'

Expand All @@ -29,7 +31,6 @@ jobs:
-
name: Upload coverage
uses: codecov/codecov-action@v1
if: success()
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage/clover.xml
25 changes: 25 additions & 0 deletions .github/workflows/validate.yml
@@ -0,0 +1,25 @@
name: validate

on:
push:
branches:
- 'master'
- 'releases/v*'
paths-ignore:
- '**.md'
pull_request:
branches:
- 'master'
paths-ignore:
- '**.md'

jobs:
validate:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Validate
run: docker buildx bake validate
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -28,7 +28,7 @@ pids
lib-cov

# Coverage directory used by tools like istanbul
coverage
/coverage
*.lcov

# nyc test coverage
Expand Down
54 changes: 54 additions & 0 deletions Dockerfile.dev
@@ -0,0 +1,54 @@
#syntax=docker/dockerfile:1.2

FROM node:12 AS deps
WORKDIR /src
COPY package.json yarn.lock ./
RUN --mount=type=cache,target=/src/node_modules \
yarn install

FROM scratch AS update-yarn
COPY --from=deps /src/yarn.lock /

FROM deps AS validate-yarn
COPY .git .git
RUN status=$(git status --porcelain -- yarn.lock); if [ -n "$status" ]; then echo $status; exit 1; fi

FROM deps AS base
COPY . .

FROM base AS build
RUN --mount=type=cache,target=/src/node_modules \
yarn build

#FROM deps AS test
#ARG GITHUB_REPOSITORY
#ENV RUNNER_TEMP=/tmp/github_runner
#ENV RUNNER_TOOL_CACHE=/tmp/github_tool_cache
#ENV GITHUB_REPOSITORY=${GITHUB_REPOSITORY}
#COPY . .
#RUN --mount=type=cache,target=/src/node_modules \
# --mount=type=secret,id=github_token \
# GITHUB_TOKEN=$(cat /run/secrets/github_token) env|sort && yarn run test
#
#FROM scratch AS test-coverage
#COPY --from=test /src/coverage /coverage/

FROM base AS run-format
RUN --mount=type=cache,target=/src/node_modules \
yarn run format

FROM scratch AS format
COPY --from=run-format /src/src/*.ts /src/

FROM base AS validate-format
RUN --mount=type=cache,target=/src/node_modules \
yarn run format-check

FROM scratch AS dist
COPY --from=build /src/dist/ /dist/

FROM build AS validate-build
RUN status=$(git status --porcelain -- dist); if [ -n "$status" ]; then echo $status; exit 1; fi

FROM base AS dev
ENTRYPOINT ["bash"]

0 comments on commit 3fada34

Please sign in to comment.