mirror of
https://github.com/crazy-max/ghaction-upx.git
synced 2024-11-21 18:06:08 -07:00
Container dev workflow (#139)
Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
228b9aebd5
commit
925acc7207
6
.dockerignore
Normal file
6
.dockerignore
Normal file
|
@ -0,0 +1,6 @@
|
|||
/.dev
|
||||
/coverage
|
||||
/dist
|
||||
/lib
|
||||
/node_modules
|
||||
/.env
|
10
.github/CONTRIBUTING.md
vendored
10
.github/CONTRIBUTING.md
vendored
|
@ -7,11 +7,11 @@ Contributions to this project are [released](https://help.github.com/articles/gi
|
|||
## Submitting a pull request
|
||||
|
||||
1. [Fork](https://github.com/crazy-max/ghaction-upx/fork) and clone the repository
|
||||
2. Configure and install the dependencies: `yarn install`
|
||||
3. Make sure the tests pass on your machine: `yarn run test`
|
||||
4. Create a new branch: `git checkout -b my-branch-name`
|
||||
5. Make your change, add tests, and make sure the tests still pass
|
||||
6. Run pre-checkin: `yarn run pre-checkin`
|
||||
2. Configure and install the dependencies locally: `yarn install`
|
||||
3. Create a new branch: `git checkout -b my-branch-name`
|
||||
4. Make your changes
|
||||
5. Format code and build javascript artifacts: `docker buildx bake pre-checkin`
|
||||
6. Validate all code has correctly formatted and built: `docker buildx bake validate`
|
||||
7. Push to your fork and [submit a pull request](https://github.com/crazy-max/ghaction-upx/compare)
|
||||
8. Pat your self on the back and wait for your pull request to be reviewed and merged.
|
||||
|
||||
|
|
16
.github/workflows/ci.yml
vendored
16
.github/workflows/ci.yml
vendored
|
@ -3,14 +3,18 @@ name: ci
|
|||
on:
|
||||
schedule:
|
||||
- cron: '0 10 * * *' # everyday at 10am
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- releases/v*
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- releases/v*
|
||||
- 'master'
|
||||
- 'releases/v*'
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
pull_request:
|
||||
branches:
|
||||
- 'master'
|
||||
- 'releases/v*'
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
|
|
30
.github/workflows/pre-checkin.yml
vendored
30
.github/workflows/pre-checkin.yml
vendored
|
@ -1,30 +0,0 @@
|
|||
name: pre-checkin
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
|
||||
jobs:
|
||||
pre-checkin:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
-
|
||||
name: Install
|
||||
run: yarn install
|
||||
-
|
||||
name: Pre-checkin
|
||||
run: yarn run pre-checkin
|
||||
-
|
||||
name: Check for uncommitted changes
|
||||
run: |
|
||||
if [[ `git status --porcelain` ]]; then
|
||||
git status --porcelain
|
||||
echo "::warning::Found changes. Please run 'yarn run pre-checkin' and push"
|
||||
fi
|
27
.github/workflows/test.yml
vendored
27
.github/workflows/test.yml
vendored
|
@ -3,15 +3,37 @@ name: test
|
|||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- releases/v*
|
||||
- 'master'
|
||||
- 'releases/v*'
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
pull_request:
|
||||
branches:
|
||||
- 'master'
|
||||
- 'releases/v*'
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
|
||||
jobs:
|
||||
test-containerized:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
-
|
||||
name: Validate
|
||||
uses: docker/bake-action@v1
|
||||
with:
|
||||
targets: validate
|
||||
-
|
||||
name: Test
|
||||
uses: docker/bake-action@v1
|
||||
with:
|
||||
targets: test
|
||||
|
||||
test:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
|
@ -35,5 +57,4 @@ jobs:
|
|||
uses: codecov/codecov-action@v1
|
||||
if: success()
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
file: ./coverage/clover.xml
|
||||
|
|
51
dev.Dockerfile
Normal file
51
dev.Dockerfile
Normal file
|
@ -0,0 +1,51 @@
|
|||
#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
|
||||
ENV RUNNER_TEMP=/tmp/github_runner
|
||||
ENV RUNNER_TOOL_CACHE=/tmp/github_tool_cache
|
||||
COPY . .
|
||||
RUN --mount=type=cache,target=/src/node_modules \
|
||||
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"]
|
4
dist/index.js
generated
vendored
4
dist/index.js
generated
vendored
|
@ -1685,7 +1685,9 @@ class HttpClient {
|
|||
maxSockets: maxSockets,
|
||||
keepAlive: this._keepAlive,
|
||||
proxy: {
|
||||
proxyAuth: `${proxyUrl.username}:${proxyUrl.password}`,
|
||||
...((proxyUrl.username || proxyUrl.password) && {
|
||||
proxyAuth: `${proxyUrl.username}:${proxyUrl.password}`
|
||||
}),
|
||||
host: proxyUrl.hostname,
|
||||
port: proxyUrl.port
|
||||
}
|
||||
|
|
57
docker-bake.hcl
Normal file
57
docker-bake.hcl
Normal file
|
@ -0,0 +1,57 @@
|
|||
variable "GITHUB_REPOSITORY" {
|
||||
default = "crazy-max/ghaction-upx"
|
||||
}
|
||||
|
||||
group "default" {
|
||||
targets = ["build"]
|
||||
}
|
||||
|
||||
group "pre-checkin" {
|
||||
targets = ["update-yarn", "format", "build"]
|
||||
}
|
||||
|
||||
group "validate" {
|
||||
targets = ["validate-format", "validate-build", "validate-yarn"]
|
||||
}
|
||||
|
||||
target "dockerfile" {
|
||||
dockerfile = "dev.Dockerfile"
|
||||
}
|
||||
|
||||
target "update-yarn" {
|
||||
inherits = ["dockerfile"]
|
||||
target = "update-yarn"
|
||||
output = ["."]
|
||||
}
|
||||
|
||||
target "build" {
|
||||
inherits = ["dockerfile"]
|
||||
target = "dist"
|
||||
output = ["."]
|
||||
}
|
||||
|
||||
target "test" {
|
||||
inherits = ["dockerfile"]
|
||||
target = "test"
|
||||
}
|
||||
|
||||
target "format" {
|
||||
inherits = ["dockerfile"]
|
||||
target = "format"
|
||||
output = ["."]
|
||||
}
|
||||
|
||||
target "validate-format" {
|
||||
inherits = ["dockerfile"]
|
||||
target = "validate-format"
|
||||
}
|
||||
|
||||
target "validate-build" {
|
||||
inherits = ["dockerfile"]
|
||||
target = "validate-build"
|
||||
}
|
||||
|
||||
target "validate-yarn" {
|
||||
inherits = ["dockerfile"]
|
||||
target = "validate-yarn"
|
||||
}
|
Loading…
Reference in New Issue
Block a user