mirror of
https://github.com/docker/setup-docker-action.git
synced 2025-06-14 07:27:13 +02:00
Compare commits
142 Commits
Author | SHA1 | Date | |
---|---|---|---|
26145a578d | |||
0692aeebfc | |||
47611ea40b | |||
7bb565780b | |||
9794ac9406 | |||
701bc4e9ed | |||
958155397b | |||
de4e249b98 | |||
a2e96b1577 | |||
2e05eb17ec | |||
b52307508d | |||
a3485f7b8f | |||
1977c86a96 | |||
e98084b722 | |||
ca246a1805 | |||
40c64fb090 | |||
4acbcb8479 | |||
8f832606d8 | |||
4f5bb9fcef | |||
da44386179 | |||
f4a5b99d88 | |||
c794b17d99 | |||
e188b1d368 | |||
e0c95fcf69 | |||
25cb73f3c4 | |||
a93701ec9b | |||
3a19e60609 | |||
78318f8be5 | |||
54f3988321 | |||
f437b67409 | |||
06b9bc80b3 | |||
a6fae2d4e8 | |||
a4ef905acc | |||
41a5151e81 | |||
e96e0e2c98 | |||
8d0a8e33ff | |||
9bd97ff018 | |||
bca5e4d3e2 | |||
031a2987b7 | |||
753106f35c | |||
a1e4314d8f | |||
a7f3aad3f5 | |||
faa196892b | |||
796ce734cb | |||
3eb24de4f6 | |||
5bddaa4323 | |||
17819a1af9 | |||
d20884258e | |||
b74351ab97 | |||
0f5a011c3d | |||
99cad45695 | |||
aceee1722e | |||
0cb459c59a | |||
81886c7276 | |||
fdc6583d4e | |||
a4b15f09d5 | |||
c2351bbd0b | |||
c14b6e1c32 | |||
f1d16883d0 | |||
5de1d6bef5 | |||
7d4fd999a5 | |||
38c07112bd | |||
c6f8a8a2ba | |||
2960188cea | |||
8e060aa468 | |||
fc6fa62ba9 | |||
7864da88cb | |||
36eedea576 | |||
95a170fa60 | |||
1ea15ee881 | |||
729d91c21f | |||
c553dd0c3f | |||
a307846a9f | |||
57929789e6 | |||
d9be6cade4 | |||
e1c24ba1f0 | |||
979d352bf6 | |||
db8a75eba6 | |||
69b561f709 | |||
c33ee55bce | |||
12e445b81b | |||
60457dabd3 | |||
8f158b20ff | |||
9057e9e607 | |||
addf8fa212 | |||
63346e6cc5 | |||
83adf3b3da | |||
828496ee08 | |||
df46d8995c | |||
6ac516eae5 | |||
df974f607b | |||
cf7c9d54cf | |||
1026ab4694 | |||
4c602a2061 | |||
806baaed75 | |||
cadd55dc3d | |||
f3fe780861 | |||
9aeea9f032 | |||
f920b5cca7 | |||
784197509a | |||
72f088c678 | |||
94fed099f6 | |||
87e8022576 | |||
64ced80536 | |||
cc7ab4747a | |||
2105ee4f68 | |||
32402da4e2 | |||
6a07d2066a | |||
8fac59bbad | |||
e031a1afa4 | |||
bba98f9cf3 | |||
c9a433aeef | |||
35358c035e | |||
ce60bfdfe1 | |||
24d5692d29 | |||
c322702919 | |||
ba6df22a99 | |||
751eb0de7b | |||
2c7b4c9ba9 | |||
0e98cdfc95 | |||
e5467b74ef | |||
d298db0f7d | |||
74272b7110 | |||
d3292ed6bc | |||
5566df4cd9 | |||
766484b9a8 | |||
1a21164cad | |||
0b0e2e14f8 | |||
3ff7a3f336 | |||
d1b108b3cc | |||
ff0fd563eb | |||
3edb28603d | |||
0a0eee06ff | |||
d00caf720d | |||
26bcb039d3 | |||
e22f202df2 | |||
99e070f51d | |||
f5b7761d05 | |||
2dcc4846c6 | |||
92951761fa | |||
dd105ffea1 | |||
8ad3d347be |
@ -1,2 +1,12 @@
|
|||||||
/coverage
|
/coverage
|
||||||
/node_modules
|
|
||||||
|
# Dependency directories
|
||||||
|
node_modules/
|
||||||
|
jspm_packages/
|
||||||
|
|
||||||
|
# yarn v2
|
||||||
|
.yarn/cache
|
||||||
|
.yarn/unplugged
|
||||||
|
.yarn/build-state.yml
|
||||||
|
.yarn/install-state.gz
|
||||||
|
.pnp.*
|
||||||
|
3
.eslintignore
Normal file
3
.eslintignore
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
/dist/**
|
||||||
|
/coverage/**
|
||||||
|
/node_modules/**
|
@ -1,11 +1,12 @@
|
|||||||
{
|
{
|
||||||
"env": {
|
"env": {
|
||||||
"node": true,
|
"node": true,
|
||||||
"es2021": true,
|
"es6": true,
|
||||||
"jest": true
|
"jest": true
|
||||||
},
|
},
|
||||||
"extends": [
|
"extends": [
|
||||||
"eslint:recommended",
|
"eslint:recommended",
|
||||||
|
"plugin:@typescript-eslint/eslint-recommended",
|
||||||
"plugin:@typescript-eslint/recommended",
|
"plugin:@typescript-eslint/recommended",
|
||||||
"plugin:jest/recommended",
|
"plugin:jest/recommended",
|
||||||
"plugin:prettier/recommended"
|
"plugin:prettier/recommended"
|
||||||
|
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -1,2 +1,4 @@
|
|||||||
|
/.yarn/releases/** binary
|
||||||
|
/.yarn/plugins/** binary
|
||||||
/dist/** linguist-generated=true
|
/dist/** linguist-generated=true
|
||||||
/lib/** linguist-generated=true
|
/lib/** linguist-generated=true
|
||||||
|
5
.github/dependabot.yml
vendored
5
.github/dependabot.yml
vendored
@ -4,6 +4,11 @@ updates:
|
|||||||
directory: "/"
|
directory: "/"
|
||||||
schedule:
|
schedule:
|
||||||
interval: "daily"
|
interval: "daily"
|
||||||
|
ignore:
|
||||||
|
# ignore this dependency
|
||||||
|
# it seems a bug with dependabot as pining to commit sha should not
|
||||||
|
# trigger a new version similar to https://github.com/docker/buildx/pull/2222#issuecomment-1919092153
|
||||||
|
- dependency-name: "docker/actions-toolkit"
|
||||||
labels:
|
labels:
|
||||||
- "dependencies"
|
- "dependencies"
|
||||||
- "bot"
|
- "bot"
|
||||||
|
248
.github/workflows/ci.yml
vendored
248
.github/workflows/ci.yml
vendored
@ -1,6 +1,11 @@
|
|||||||
name: ci
|
name: ci
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 10 * * *'
|
- cron: '0 10 * * *'
|
||||||
push:
|
push:
|
||||||
@ -11,6 +16,9 @@ on:
|
|||||||
- 'v*'
|
- 'v*'
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
|
env:
|
||||||
|
DOCKER_VERSION: v24.0.9
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
main:
|
main:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
@ -19,17 +27,37 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
os:
|
os:
|
||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
- macos-latest
|
#- macos-14 # no virt: https://github.com/docker/actions-toolkit/issues/317
|
||||||
|
- macos-13
|
||||||
- windows-latest
|
- windows-latest
|
||||||
|
version:
|
||||||
|
- pinned
|
||||||
|
- latest
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
-
|
||||||
|
# https://github.com/crazy-max/ghaction-setup-docker/issues/108
|
||||||
|
name: Set up QEMU
|
||||||
|
if: startsWith(matrix.os, 'macos')
|
||||||
|
uses: docker/actions-toolkit/.github/actions/macos-setup-qemu@19ca9ade20f5da695f76a10988d6532058575f82
|
||||||
|
-
|
||||||
|
name: Set version
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if [ "${{ matrix.version }}" != "pinned" ]; then
|
||||||
|
echo "DOCKER_VERSION=${{ matrix.version }}" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
version: v23.0.0
|
version: ${{ env.DOCKER_VERSION }}
|
||||||
|
-
|
||||||
|
name: Dump context
|
||||||
|
if: always()
|
||||||
|
uses: crazy-max/ghaction-dump-context@v2
|
||||||
|
|
||||||
channel:
|
channel:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
@ -38,18 +66,63 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
os:
|
os:
|
||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
- macos-latest
|
#- macos-14 # no virt: https://github.com/docker/actions-toolkit/issues/317
|
||||||
|
- macos-13
|
||||||
- windows-latest
|
- windows-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
-
|
||||||
|
# https://github.com/crazy-max/ghaction-setup-docker/issues/108
|
||||||
|
name: Set up QEMU
|
||||||
|
if: startsWith(matrix.os, 'macos')
|
||||||
|
uses: docker/actions-toolkit/.github/actions/macos-setup-qemu@19ca9ade20f5da695f76a10988d6532058575f82
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
version: v23.0.0-rc.4
|
version: v24.0.0-rc.4
|
||||||
channel: test
|
channel: test
|
||||||
|
-
|
||||||
|
name: Dump context
|
||||||
|
if: always()
|
||||||
|
uses: crazy-max/ghaction-dump-context@v2
|
||||||
|
|
||||||
|
daemon-config:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- ubuntu-latest
|
||||||
|
#- macos-14 # no virt: https://github.com/docker/actions-toolkit/issues/317
|
||||||
|
- macos-13
|
||||||
|
- windows-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
-
|
||||||
|
# https://github.com/crazy-max/ghaction-setup-docker/issues/108
|
||||||
|
name: Set up QEMU
|
||||||
|
if: startsWith(matrix.os, 'macos')
|
||||||
|
uses: docker/actions-toolkit/.github/actions/macos-setup-qemu@19ca9ade20f5da695f76a10988d6532058575f82
|
||||||
|
-
|
||||||
|
name: Set up Docker
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
daemon-config: |
|
||||||
|
{
|
||||||
|
"debug": true,
|
||||||
|
"features": {
|
||||||
|
"containerd-snapshotter": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
-
|
||||||
|
name: Dump context
|
||||||
|
if: always()
|
||||||
|
uses: crazy-max/ghaction-dump-context@v2
|
||||||
|
|
||||||
context:
|
context:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
@ -58,78 +131,85 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
os:
|
os:
|
||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
- macos-latest
|
#- macos-14 # no virt: https://github.com/docker/actions-toolkit/issues/317
|
||||||
|
- macos-13
|
||||||
- windows-latest
|
- windows-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
-
|
||||||
|
# https://github.com/crazy-max/ghaction-setup-docker/issues/108
|
||||||
|
name: Set up QEMU
|
||||||
|
if: startsWith(matrix.os, 'macos')
|
||||||
|
uses: docker/actions-toolkit/.github/actions/macos-setup-qemu@19ca9ade20f5da695f76a10988d6532058575f82
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
version: v23.0.0
|
version: ${{ env.DOCKER_VERSION }}
|
||||||
context: foo
|
context: foo
|
||||||
-
|
-
|
||||||
name: Check context
|
name: Check context
|
||||||
run: |
|
run: |
|
||||||
docker context inspect foo
|
docker context inspect foo
|
||||||
|
-
|
||||||
|
name: Dump context
|
||||||
|
if: always()
|
||||||
|
uses: crazy-max/ghaction-dump-context@v2
|
||||||
|
|
||||||
|
lima-start-args:
|
||||||
|
#runs-on: macos-14 # no virt: https://github.com/docker/actions-toolkit/issues/317
|
||||||
|
runs-on: macos-13
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
-
|
||||||
|
# https://github.com/crazy-max/ghaction-setup-docker/issues/108
|
||||||
|
name: Set up QEMU
|
||||||
|
uses: docker/actions-toolkit/.github/actions/macos-setup-qemu@19ca9ade20f5da695f76a10988d6532058575f82
|
||||||
|
-
|
||||||
|
name: Set up Docker
|
||||||
|
uses: ./
|
||||||
|
env:
|
||||||
|
LIMA_START_ARGS: --cpus 4 --memory 8
|
||||||
|
|
||||||
build-linux:
|
build-linux:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
services:
|
strategy:
|
||||||
registry:
|
fail-fast: false
|
||||||
image: registry:2
|
matrix:
|
||||||
ports:
|
containerd:
|
||||||
- 5000:5000
|
- containerd-system
|
||||||
|
- containerd-tarball
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Uninstall containerd
|
||||||
uses: ./
|
if: matrix.containerd == 'containerd-tarball'
|
||||||
-
|
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v2
|
|
||||||
with:
|
|
||||||
driver: docker
|
|
||||||
driver-opts: network=host
|
|
||||||
-
|
|
||||||
name: Build and push
|
|
||||||
uses: docker/build-push-action@v4
|
|
||||||
with:
|
|
||||||
context: ./test
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
localhost:5000/name/app:latest
|
|
||||||
-
|
|
||||||
name: Inspect
|
|
||||||
run: |
|
run: |
|
||||||
docker buildx imagetools inspect localhost:5000/name/app:latest --format '{{json .}}'
|
sudo apt-get remove -y containerd.io
|
||||||
|
|
||||||
build-macos:
|
|
||||||
runs-on: macos-latest
|
|
||||||
steps:
|
|
||||||
-
|
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
uses: ./
|
uses: ./
|
||||||
|
with:
|
||||||
|
version: ${{ env.DOCKER_VERSION }}
|
||||||
-
|
-
|
||||||
name: Start registry
|
name: Start registry
|
||||||
run: |
|
run: |
|
||||||
docker run -d -p 5000:5000 --restart=always --name registry registry:2
|
docker run -d -p 5000:5000 --restart=always --name registry registry:2
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v3
|
||||||
with:
|
with:
|
||||||
driver: docker
|
driver: docker
|
||||||
driver-opts: network=host
|
driver-opts: network=host
|
||||||
-
|
-
|
||||||
name: Build and push
|
name: Build and push
|
||||||
uses: docker/build-push-action@v4
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: ./test
|
context: ./test
|
||||||
push: true
|
push: true
|
||||||
@ -139,16 +219,72 @@ jobs:
|
|||||||
name: Inspect
|
name: Inspect
|
||||||
run: |
|
run: |
|
||||||
docker buildx imagetools inspect localhost:5000/name/app:latest --format '{{json .}}'
|
docker buildx imagetools inspect localhost:5000/name/app:latest --format '{{json .}}'
|
||||||
|
-
|
||||||
|
name: Dump context
|
||||||
|
if: always()
|
||||||
|
uses: crazy-max/ghaction-dump-context@v2
|
||||||
|
|
||||||
|
build-macos:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
#- macos-14 # no virt: https://github.com/docker/actions-toolkit/issues/317
|
||||||
|
- macos-13
|
||||||
|
- macos-12
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
-
|
||||||
|
# https://github.com/crazy-max/ghaction-setup-docker/issues/108
|
||||||
|
name: Set up QEMU
|
||||||
|
if: startsWith(matrix.os, 'macos')
|
||||||
|
uses: docker/actions-toolkit/.github/actions/macos-setup-qemu@19ca9ade20f5da695f76a10988d6532058575f82
|
||||||
|
-
|
||||||
|
name: Set up Docker
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
version: ${{ env.DOCKER_VERSION }}
|
||||||
|
-
|
||||||
|
name: Start registry
|
||||||
|
run: |
|
||||||
|
docker run -d -p 5000:5000 --restart=always --name registry registry:2
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
with:
|
||||||
|
driver: docker
|
||||||
|
driver-opts: network=host
|
||||||
|
-
|
||||||
|
name: Build and push
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: ./test
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
localhost:5000/name/app:latest
|
||||||
|
-
|
||||||
|
name: Inspect
|
||||||
|
run: |
|
||||||
|
docker buildx imagetools inspect localhost:5000/name/app:latest --format '{{json .}}'
|
||||||
|
-
|
||||||
|
name: Dump context
|
||||||
|
if: always()
|
||||||
|
uses: crazy-max/ghaction-dump-context@v2
|
||||||
|
|
||||||
build-windows:
|
build-windows:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
uses: ./
|
uses: ./
|
||||||
|
with:
|
||||||
|
version: ${{ env.DOCKER_VERSION }}
|
||||||
-
|
-
|
||||||
name: Build
|
name: Build
|
||||||
working-directory: ./test
|
working-directory: ./test
|
||||||
@ -158,3 +294,27 @@ jobs:
|
|||||||
name: Inspect
|
name: Inspect
|
||||||
run: |
|
run: |
|
||||||
docker image inspect test
|
docker image inspect test
|
||||||
|
-
|
||||||
|
name: Dump context
|
||||||
|
if: always()
|
||||||
|
uses: crazy-max/ghaction-dump-context@v2
|
||||||
|
|
||||||
|
set-host:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
-
|
||||||
|
name: Set up Docker
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
set-host: true
|
||||||
|
-
|
||||||
|
name: List contexts
|
||||||
|
run: |
|
||||||
|
docker context ls
|
||||||
|
-
|
||||||
|
name: Dump context
|
||||||
|
if: always()
|
||||||
|
uses: crazy-max/ghaction-dump-context@v2
|
||||||
|
11
.github/workflows/test.yml
vendored
11
.github/workflows/test.yml
vendored
@ -1,5 +1,9 @@
|
|||||||
name: test
|
name: test
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
@ -13,14 +17,15 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Test
|
name: Test
|
||||||
uses: docker/bake-action@v2
|
uses: docker/bake-action@v5
|
||||||
with:
|
with:
|
||||||
targets: test
|
targets: test
|
||||||
-
|
-
|
||||||
name: Upload coverage
|
name: Upload coverage
|
||||||
uses: codecov/codecov-action@v3
|
uses: codecov/codecov-action@v4
|
||||||
with:
|
with:
|
||||||
file: ./coverage/clover.xml
|
file: ./coverage/clover.xml
|
||||||
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
10
.github/workflows/validate.yml
vendored
10
.github/workflows/validate.yml
vendored
@ -1,5 +1,9 @@
|
|||||||
name: validate
|
name: validate
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
@ -15,7 +19,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Targets matrix
|
name: Targets matrix
|
||||||
id: targets
|
id: targets
|
||||||
@ -33,9 +37,9 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Validate
|
name: Validate
|
||||||
uses: docker/bake-action@v2
|
uses: docker/bake-action@v5
|
||||||
with:
|
with:
|
||||||
targets: ${{ matrix.target }}
|
targets: ${{ matrix.target }}
|
||||||
|
66
.gitignore
vendored
66
.gitignore
vendored
@ -1,7 +1,5 @@
|
|||||||
node_modules
|
# https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore
|
||||||
lib
|
|
||||||
|
|
||||||
# Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
|
|
||||||
# Logs
|
# Logs
|
||||||
logs
|
logs
|
||||||
*.log
|
*.log
|
||||||
@ -9,6 +7,7 @@ npm-debug.log*
|
|||||||
yarn-debug.log*
|
yarn-debug.log*
|
||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
lerna-debug.log*
|
lerna-debug.log*
|
||||||
|
.pnpm-debug.log*
|
||||||
|
|
||||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||||
@ -19,34 +18,14 @@ pids
|
|||||||
*.seed
|
*.seed
|
||||||
*.pid.lock
|
*.pid.lock
|
||||||
|
|
||||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
||||||
lib-cov
|
|
||||||
|
|
||||||
# Coverage directory used by tools like istanbul
|
# Coverage directory used by tools like istanbul
|
||||||
coverage
|
coverage
|
||||||
*.lcov
|
*.lcov
|
||||||
|
|
||||||
# nyc test coverage
|
|
||||||
.nyc_output
|
|
||||||
|
|
||||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
|
||||||
.grunt
|
|
||||||
|
|
||||||
# Bower dependency directory (https://bower.io/)
|
|
||||||
bower_components
|
|
||||||
|
|
||||||
# node-waf configuration
|
|
||||||
.lock-wscript
|
|
||||||
|
|
||||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
|
||||||
build/Release
|
|
||||||
|
|
||||||
# Dependency directories
|
# Dependency directories
|
||||||
|
node_modules/
|
||||||
jspm_packages/
|
jspm_packages/
|
||||||
|
|
||||||
# TypeScript v1 declaration files
|
|
||||||
typings/
|
|
||||||
|
|
||||||
# TypeScript cache
|
# TypeScript cache
|
||||||
*.tsbuildinfo
|
*.tsbuildinfo
|
||||||
|
|
||||||
@ -56,36 +35,19 @@ typings/
|
|||||||
# Optional eslint cache
|
# Optional eslint cache
|
||||||
.eslintcache
|
.eslintcache
|
||||||
|
|
||||||
# Optional REPL history
|
|
||||||
.node_repl_history
|
|
||||||
|
|
||||||
# Output of 'npm pack'
|
|
||||||
*.tgz
|
|
||||||
|
|
||||||
# Yarn Integrity file
|
# Yarn Integrity file
|
||||||
.yarn-integrity
|
.yarn-integrity
|
||||||
|
|
||||||
# dotenv environment variables file
|
# dotenv environment variable files
|
||||||
.env
|
.env
|
||||||
.env.test
|
.env.development.local
|
||||||
|
.env.test.local
|
||||||
|
.env.production.local
|
||||||
|
.env.local
|
||||||
|
|
||||||
# parcel-bundler cache (https://parceljs.org/)
|
# yarn v2
|
||||||
.cache
|
.yarn/cache
|
||||||
|
.yarn/unplugged
|
||||||
# next.js build output
|
.yarn/build-state.yml
|
||||||
.next
|
.yarn/install-state.gz
|
||||||
|
.pnp.*
|
||||||
# nuxt.js build output
|
|
||||||
.nuxt
|
|
||||||
|
|
||||||
# vuepress build output
|
|
||||||
.vuepress/dist
|
|
||||||
|
|
||||||
# Serverless directories
|
|
||||||
.serverless/
|
|
||||||
|
|
||||||
# FuseBox cache
|
|
||||||
.fusebox/
|
|
||||||
|
|
||||||
# DynamoDB Local files
|
|
||||||
.dynamodb/
|
|
||||||
|
6
.prettierignore
Normal file
6
.prettierignore
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# Dependency directories
|
||||||
|
node_modules/
|
||||||
|
jspm_packages/
|
||||||
|
|
||||||
|
# yarn v2
|
||||||
|
.yarn/
|
541
.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
vendored
Normal file
541
.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
vendored
Normal file
File diff suppressed because one or more lines are too long
13
.yarnrc.yml
Normal file
13
.yarnrc.yml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
logFilters:
|
||||||
|
- code: YN0013
|
||||||
|
level: discard
|
||||||
|
- code: YN0019
|
||||||
|
level: discard
|
||||||
|
- code: YN0076
|
||||||
|
level: discard
|
||||||
|
|
||||||
|
nodeLinker: node-modules
|
||||||
|
|
||||||
|
plugins:
|
||||||
|
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
|
||||||
|
spec: "@yarnpkg/plugin-interactive-tools"
|
115
README.md
115
README.md
@ -9,18 +9,29 @@
|
|||||||
GitHub Action to set up (download and install) [Docker CE](https://docs.docker.com/engine/).
|
GitHub Action to set up (download and install) [Docker CE](https://docs.docker.com/engine/).
|
||||||
Works on Linux, macOS and Windows.
|
Works on Linux, macOS and Windows.
|
||||||
|
|
||||||
|
> [!WARNING]
|
||||||
|
> Does not work on macOS runners with ARM architecture (no nested virtualization):
|
||||||
|
> * https://github.com/crazy-max/ghaction-setup-docker/pull/53
|
||||||
|
> * https://github.com/docker/actions-toolkit/issues/317
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
___
|
___
|
||||||
|
|
||||||
* [Usage](#usage)
|
* [Usage](#usage)
|
||||||
|
* [Quick start](#quick-start)
|
||||||
|
* [Daemon configuration](#daemon-configuration)
|
||||||
|
* [Define custom `limactl start` arguments (macOS)](#define-custom-limactl-start-arguments-macos)
|
||||||
* [Customizing](#customizing)
|
* [Customizing](#customizing)
|
||||||
* [inputs](#inputs)
|
* [inputs](#inputs)
|
||||||
|
* [outputs](#outputs)
|
||||||
* [Contributing](#contributing)
|
* [Contributing](#contributing)
|
||||||
* [License](#license)
|
* [License](#license)
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
### Quick start
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
name: ci
|
name: ci
|
||||||
|
|
||||||
@ -33,28 +44,110 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
uses: crazy-max/ghaction-setup-docker@v1
|
uses: crazy-max/ghaction-setup-docker@v3
|
||||||
|
```
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> macOS runners hang with latest QEMU 9.1.0. You need to install QEMU 9.0.2 as
|
||||||
|
> a workaround:
|
||||||
|
> ```yaml
|
||||||
|
> name: ci
|
||||||
|
>
|
||||||
|
> on:
|
||||||
|
> push:
|
||||||
|
>
|
||||||
|
> jobs:
|
||||||
|
> docker:
|
||||||
|
> runs-on: macos-13
|
||||||
|
> steps:
|
||||||
|
> -
|
||||||
|
> # https://github.com/crazy-max/ghaction-setup-docker/issues/108
|
||||||
|
> name: Install QEMU 9.0.2
|
||||||
|
> uses: docker/actions-toolkit/.github/actions/macos-setup-qemu@19ca9ade20f5da695f76a10988d6532058575f82
|
||||||
|
> -
|
||||||
|
> name: Set up Docker
|
||||||
|
> uses: crazy-max/ghaction-setup-docker@v3
|
||||||
|
> ```
|
||||||
|
> More info: https://github.com/crazy-max/ghaction-setup-docker/issues/108.
|
||||||
|
|
||||||
|
### Daemon configuration
|
||||||
|
|
||||||
|
You can [configure the Docker daemon](https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file)
|
||||||
|
using the `daemon-config` input. In the following example, we configure the
|
||||||
|
Docker daemon to enable debug and the [containerd image store](https://docs.docker.com/storage/containerd/)
|
||||||
|
feature:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
name: ci
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Set up Docker
|
||||||
|
uses: crazy-max/ghaction-setup-docker@v3
|
||||||
|
with:
|
||||||
|
daemon-config: |
|
||||||
|
{
|
||||||
|
"debug": true,
|
||||||
|
"features": {
|
||||||
|
"containerd-snapshotter": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Define custom `limactl start` arguments (macOS)
|
||||||
|
|
||||||
|
You can define custom [`limactl start` arguments](https://lima-vm.io/docs/reference/limactl_start/)
|
||||||
|
using the `LIMA_START_ARGS` environment variable to customize the VM:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
name: ci
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker:
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Set up Docker
|
||||||
|
uses: crazy-max/ghaction-setup-docker@v3
|
||||||
|
env:
|
||||||
|
LIMA_START_ARGS: --cpus 4 --memory 8
|
||||||
```
|
```
|
||||||
|
|
||||||
## Customizing
|
## Customizing
|
||||||
|
|
||||||
### inputs
|
### inputs
|
||||||
|
|
||||||
Following inputs can be used as `step.with` keys
|
The following inputs can be used as `step.with` keys
|
||||||
|
|
||||||
| Name | Type | Default | Description |
|
| Name | Type | Default | Description |
|
||||||
|-----------|--------|-----------------------|---------------------------------------------------------------------------------------------------|
|
|-----------------|--------|-----------------------|-----------------------------------------------------------------------------------------------------------------------------|
|
||||||
| `version` | String | `latest` | Docker CE version (e.g., `v23.0.1`). |
|
| `version` | String | `latest` | Docker CE version (e.g., `v24.0.6`). |
|
||||||
| `channel` | String | `stable` | Docker CE [channel](https://download.docker.com/linux/static/) (e.g, `stable`, `edge` or `test`). |
|
| `channel` | String | `stable` | Docker CE [channel](https://download.docker.com/linux/static/) (e.g, `stable`, `edge` or `test`). |
|
||||||
| `context` | String | `setup-docker-action` | Docker context name. |
|
| `daemon-config` | String | | [Docker daemon JSON configuration](https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file) |
|
||||||
|
| `context` | String | `setup-docker-action` | Docker context name. |
|
||||||
|
| `set-host` | Bool | `false` | Set `DOCKER_HOST` environment variable to docker socket path. |
|
||||||
|
|
||||||
|
### outputs
|
||||||
|
|
||||||
|
The following outputs are available
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
|--------|--------|--------------------|
|
||||||
|
| `sock` | String | Docker socket path |
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
Want to contribute? Awesome! The most basic way to show your support is to star
|
Want to contribute? Awesome! The most basic way to show your support is to star
|
||||||
the project, or to raise issues. If you want to open a pull request, please
|
the project, or to raise issues. You can also support this project by [**becoming a sponsor on GitHub**](https://github.com/sponsors/crazy-max)
|
||||||
read the [contributing guidelines](.github/CONTRIBUTING.md).
|
|
||||||
|
|
||||||
You can also support this project by [**becoming a sponsor on GitHub**](https://github.com/sponsors/crazy-max)
|
|
||||||
or by making a [PayPal donation](https://www.paypal.me/crazyws) to ensure this
|
or by making a [PayPal donation](https://www.paypal.me/crazyws) to ensure this
|
||||||
journey continues indefinitely!
|
journey continues indefinitely!
|
||||||
|
|
||||||
|
@ -17,34 +17,45 @@ describe('getInputs', () => {
|
|||||||
[
|
[
|
||||||
0,
|
0,
|
||||||
new Map<string, string>([
|
new Map<string, string>([
|
||||||
['version', 'v23.0.1'],
|
['version', 'v24.0.8'],
|
||||||
|
['set-host', 'false'],
|
||||||
]),
|
]),
|
||||||
{
|
{
|
||||||
version: 'v23.0.1',
|
version: 'v24.0.8',
|
||||||
channel: '',
|
channel: '',
|
||||||
context: '',
|
context: '',
|
||||||
|
daemonConfig: '',
|
||||||
|
setHost: false
|
||||||
} as context.Inputs
|
} as context.Inputs
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
1,
|
1,
|
||||||
new Map<string, string>([
|
new Map<string, string>([
|
||||||
['version', 'v23.0.0-rc.4'],
|
['version', 'v24.0.0-rc.4'],
|
||||||
['channel', 'test'],
|
['channel', 'test'],
|
||||||
['context', 'foo'],
|
['context', 'foo'],
|
||||||
|
['daemon-config', `{"debug":true,"features":{"containerd-snapshotter":true}}`],
|
||||||
|
['set-host', 'false'],
|
||||||
]),
|
]),
|
||||||
{
|
{
|
||||||
version: 'v23.0.0-rc.4',
|
version: 'v24.0.0-rc.4',
|
||||||
channel: 'test',
|
channel: 'test',
|
||||||
context: 'foo',
|
context: 'foo',
|
||||||
|
daemonConfig: `{"debug":true,"features":{"containerd-snapshotter":true}}`,
|
||||||
|
setHost: false
|
||||||
} as context.Inputs
|
} as context.Inputs
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
2,
|
2,
|
||||||
new Map<string, string>([]),
|
new Map<string, string>([
|
||||||
|
['set-host', 'true'],
|
||||||
|
]),
|
||||||
{
|
{
|
||||||
version: 'latest',
|
version: 'latest',
|
||||||
channel: '',
|
channel: '',
|
||||||
context: '',
|
context: '',
|
||||||
|
daemonConfig: '',
|
||||||
|
setHost: true
|
||||||
} as context.Inputs
|
} as context.Inputs
|
||||||
]
|
]
|
||||||
])(
|
])(
|
||||||
|
15
action.yml
15
action.yml
@ -8,17 +8,28 @@ branding:
|
|||||||
|
|
||||||
inputs:
|
inputs:
|
||||||
version:
|
version:
|
||||||
description: 'Docker CE version. (e.g, v23.0.1)'
|
description: 'Docker CE version. (e.g, v24.0.9)'
|
||||||
required: false
|
required: false
|
||||||
default: 'latest'
|
default: 'latest'
|
||||||
channel:
|
channel:
|
||||||
description: 'Docker CE channel. (e.g, stable, edge or test)'
|
description: 'Docker CE channel. (e.g, stable, edge or test)'
|
||||||
required: false
|
required: false
|
||||||
|
daemon-config:
|
||||||
|
description: 'Docker daemon JSON configuration'
|
||||||
|
required: false
|
||||||
context:
|
context:
|
||||||
description: 'Docker context name. (default setup-docker-action)'
|
description: 'Docker context name. (default setup-docker-action)'
|
||||||
required: false
|
required: false
|
||||||
|
set-host:
|
||||||
|
description: 'Set DOCKER_HOST environment variable to docker socket path'
|
||||||
|
default: 'false'
|
||||||
|
required: false
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
sock:
|
||||||
|
description: "Docker socket path"
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'node16'
|
using: 'node20'
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
||||||
post: 'dist/index.js'
|
post: 'dist/index.js'
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
comment: false
|
comment: false
|
||||||
|
|
||||||
|
coverage:
|
||||||
|
status:
|
||||||
|
project: # settings affecting project coverage
|
||||||
|
default:
|
||||||
|
target: auto # auto % coverage target
|
||||||
|
threshold: 5% # allow for 5% reduction of coverage without failing
|
||||||
|
patch: off
|
||||||
|
|
||||||
github_checks:
|
github_checks:
|
||||||
annotations: false
|
annotations: false
|
||||||
|
@ -1,13 +1,20 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
ARG NODE_VERSION=16
|
ARG NODE_VERSION=20
|
||||||
|
|
||||||
FROM node:${NODE_VERSION}-alpine AS base
|
FROM node:${NODE_VERSION}-alpine AS base
|
||||||
RUN apk add --no-cache cpio findutils git
|
RUN apk add --no-cache cpio findutils git
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
RUN --mount=type=bind,target=.,rw \
|
||||||
|
--mount=type=cache,target=/src/.yarn/cache <<EOT
|
||||||
|
corepack enable
|
||||||
|
yarn --version
|
||||||
|
yarn config set --home enableTelemetry 0
|
||||||
|
EOT
|
||||||
|
|
||||||
FROM base AS deps
|
FROM base AS deps
|
||||||
RUN --mount=type=bind,target=.,rw \
|
RUN --mount=type=bind,target=.,rw \
|
||||||
|
--mount=type=cache,target=/src/.yarn/cache \
|
||||||
--mount=type=cache,target=/src/node_modules \
|
--mount=type=cache,target=/src/node_modules \
|
||||||
yarn install && mkdir /vendor && cp yarn.lock /vendor
|
yarn install && mkdir /vendor && cp yarn.lock /vendor
|
||||||
|
|
||||||
@ -28,6 +35,7 @@ EOT
|
|||||||
|
|
||||||
FROM deps AS build
|
FROM deps AS build
|
||||||
RUN --mount=type=bind,target=.,rw \
|
RUN --mount=type=bind,target=.,rw \
|
||||||
|
--mount=type=cache,target=/src/.yarn/cache \
|
||||||
--mount=type=cache,target=/src/node_modules \
|
--mount=type=cache,target=/src/node_modules \
|
||||||
yarn run build && mkdir /out && cp -Rf dist /out/
|
yarn run build && mkdir /out && cp -Rf dist /out/
|
||||||
|
|
||||||
@ -48,6 +56,7 @@ EOT
|
|||||||
|
|
||||||
FROM deps AS format
|
FROM deps AS format
|
||||||
RUN --mount=type=bind,target=.,rw \
|
RUN --mount=type=bind,target=.,rw \
|
||||||
|
--mount=type=cache,target=/src/.yarn/cache \
|
||||||
--mount=type=cache,target=/src/node_modules \
|
--mount=type=cache,target=/src/node_modules \
|
||||||
yarn run format \
|
yarn run format \
|
||||||
&& mkdir /out && find . -name '*.ts' -not -path './node_modules/*' | cpio -pdm /out
|
&& mkdir /out && find . -name '*.ts' -not -path './node_modules/*' | cpio -pdm /out
|
||||||
@ -57,13 +66,15 @@ COPY --from=format /out /
|
|||||||
|
|
||||||
FROM deps AS lint
|
FROM deps AS lint
|
||||||
RUN --mount=type=bind,target=.,rw \
|
RUN --mount=type=bind,target=.,rw \
|
||||||
|
--mount=type=cache,target=/src/.yarn/cache \
|
||||||
--mount=type=cache,target=/src/node_modules \
|
--mount=type=cache,target=/src/node_modules \
|
||||||
yarn run lint
|
yarn run lint
|
||||||
|
|
||||||
FROM deps AS test
|
FROM deps AS test
|
||||||
RUN --mount=type=bind,target=.,rw \
|
RUN --mount=type=bind,target=.,rw \
|
||||||
|
--mount=type=cache,target=/src/.yarn/cache \
|
||||||
--mount=type=cache,target=/src/node_modules \
|
--mount=type=cache,target=/src/node_modules \
|
||||||
yarn run test --coverageDirectory=/tmp/coverage
|
yarn run test --coverage --coverageDirectory=/tmp/coverage
|
||||||
|
|
||||||
FROM scratch AS test-coverage
|
FROM scratch AS test-coverage
|
||||||
COPY --from=test /tmp/coverage /
|
COPY --from=test /tmp/coverage /
|
||||||
|
93
dist/index.js
generated
vendored
93
dist/index.js
generated
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
3337
dist/licenses.txt
generated
vendored
3337
dist/licenses.txt
generated
vendored
File diff suppressed because it is too large
Load Diff
2
dist/sourcemap-register.js
generated
vendored
2
dist/sourcemap-register.js
generated
vendored
File diff suppressed because one or more lines are too long
@ -15,6 +15,7 @@ process.env = Object.assign({}, process.env, {
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
clearMocks: true,
|
clearMocks: true,
|
||||||
|
testEnvironment: 'node',
|
||||||
moduleFileExtensions: ['js', 'ts'],
|
moduleFileExtensions: ['js', 'ts'],
|
||||||
testMatch: ['**/*.test.ts'],
|
testMatch: ['**/*.test.ts'],
|
||||||
transform: {
|
transform: {
|
||||||
|
42
package.json
42
package.json
@ -4,9 +4,13 @@
|
|||||||
"main": "lib/main.js",
|
"main": "lib/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "ncc build src/main.ts --source-map --minify --license licenses.txt",
|
"build": "ncc build src/main.ts --source-map --minify --license licenses.txt",
|
||||||
"lint": "eslint src/**/*.ts __tests__/**/*.ts",
|
"lint": "yarn run prettier && yarn run eslint",
|
||||||
"format": "eslint --fix src/**/*.ts __tests__/**/*.ts",
|
"format": "yarn run prettier:fix && yarn run eslint:fix",
|
||||||
"test": "jest --coverage",
|
"eslint": "eslint --max-warnings=0 .",
|
||||||
|
"eslint:fix": "eslint --fix .",
|
||||||
|
"prettier": "prettier --check \"./**/*.ts\"",
|
||||||
|
"prettier:fix": "prettier --write \"./**/*.ts\"",
|
||||||
|
"test": "jest",
|
||||||
"all": "yarn run build && yarn run format && yarn test"
|
"all": "yarn run build && yarn run format && yarn test"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
@ -20,24 +24,24 @@
|
|||||||
],
|
],
|
||||||
"author": "CrazyMax",
|
"author": "CrazyMax",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
"packageManager": "yarn@3.6.3",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.10.0",
|
"@actions/core": "^1.11.1",
|
||||||
"@docker/actions-toolkit": "^0.1.0-beta.18",
|
"@docker/actions-toolkit": "^0.40.0"
|
||||||
"uuid": "^9.0.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^16.11.26",
|
"@types/node": "^20.6.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.14.0",
|
"@typescript-eslint/eslint-plugin": "^6.6.0",
|
||||||
"@typescript-eslint/parser": "^5.14.0",
|
"@typescript-eslint/parser": "^6.6.0",
|
||||||
"@vercel/ncc": "^0.33.3",
|
"@vercel/ncc": "^0.38.0",
|
||||||
"eslint": "^8.11.0",
|
"eslint": "^8.49.0",
|
||||||
"eslint-config-prettier": "^8.5.0",
|
"eslint-config-prettier": "^9.0.0",
|
||||||
"eslint-plugin-jest": "^26.1.1",
|
"eslint-plugin-jest": "^27.2.3",
|
||||||
"eslint-plugin-prettier": "^4.0.0",
|
"eslint-plugin-prettier": "^5.0.0",
|
||||||
"jest": "^27.2.5",
|
"jest": "^29.6.4",
|
||||||
"prettier": "^2.3.1",
|
"prettier": "^3.0.3",
|
||||||
"ts-jest": "^27.1.2",
|
"ts-jest": "^29.1.1",
|
||||||
"ts-node": "^10.7.0",
|
"ts-node": "^10.9.1",
|
||||||
"typescript": "^4.4.4"
|
"typescript": "^5.2.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,13 +3,17 @@ import * as core from '@actions/core';
|
|||||||
export interface Inputs {
|
export interface Inputs {
|
||||||
version: string;
|
version: string;
|
||||||
channel: string;
|
channel: string;
|
||||||
|
daemonConfig?: string;
|
||||||
context: string;
|
context: string;
|
||||||
|
setHost: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getInputs(): Inputs {
|
export function getInputs(): Inputs {
|
||||||
return {
|
return {
|
||||||
version: core.getInput('version') || 'latest',
|
version: core.getInput('version') || 'latest',
|
||||||
channel: core.getInput('channel'),
|
channel: core.getInput('channel'),
|
||||||
context: core.getInput('context')
|
daemonConfig: core.getInput('daemon-config'),
|
||||||
|
context: core.getInput('context'),
|
||||||
|
setHost: core.getBooleanInput('set-host')
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
20
src/main.ts
20
src/main.ts
@ -1,6 +1,6 @@
|
|||||||
|
import * as crypto from 'crypto';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import * as uuid from 'uuid';
|
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as actionsToolkit from '@docker/actions-toolkit';
|
import * as actionsToolkit from '@docker/actions-toolkit';
|
||||||
import {Install} from '@docker/actions-toolkit/lib/docker/install';
|
import {Install} from '@docker/actions-toolkit/lib/docker/install';
|
||||||
@ -13,7 +13,7 @@ actionsToolkit.run(
|
|||||||
// main
|
// main
|
||||||
async () => {
|
async () => {
|
||||||
const input: context.Inputs = context.getInputs();
|
const input: context.Inputs = context.getInputs();
|
||||||
const runDir = path.join(os.homedir(), `setup-docker-action-${uuid.v4()}`);
|
const runDir = path.join(os.homedir(), `setup-docker-action-${crypto.randomUUID().slice(0, 8)}`);
|
||||||
|
|
||||||
if (input.context == 'default') {
|
if (input.context == 'default') {
|
||||||
throw new Error(`'default' context cannot be used.`);
|
throw new Error(`'default' context cannot be used.`);
|
||||||
@ -23,7 +23,8 @@ actionsToolkit.run(
|
|||||||
runDir: runDir,
|
runDir: runDir,
|
||||||
version: input.version,
|
version: input.version,
|
||||||
channel: input.channel || 'stable',
|
channel: input.channel || 'stable',
|
||||||
contextName: input.context || 'setup-docker-action'
|
contextName: input.context || 'setup-docker-action',
|
||||||
|
daemonConfig: input.daemonConfig
|
||||||
});
|
});
|
||||||
let toolDir;
|
let toolDir;
|
||||||
if (!(await Docker.isAvailable()) || input.version) {
|
if (!(await Docker.isAvailable()) || input.version) {
|
||||||
@ -33,7 +34,18 @@ actionsToolkit.run(
|
|||||||
}
|
}
|
||||||
if (toolDir) {
|
if (toolDir) {
|
||||||
stateHelper.setRunDir(runDir);
|
stateHelper.setRunDir(runDir);
|
||||||
await install.install();
|
const sockPath = await install.install();
|
||||||
|
await core.group(`Setting outputs`, async () => {
|
||||||
|
core.info(`sock=${sockPath}`);
|
||||||
|
core.setOutput('sock', sockPath);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (input.setHost) {
|
||||||
|
await core.group(`Setting Docker host`, async () => {
|
||||||
|
core.exportVariable('DOCKER_HOST', sockPath);
|
||||||
|
core.info(`DOCKER_HOST=${sockPath}`);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await core.group(`Docker info`, async () => {
|
await core.group(`Docker info`, async () => {
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"target": "es6",
|
"target": "es6",
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"strict": true,
|
|
||||||
"newLine": "lf",
|
"newLine": "lf",
|
||||||
"outDir": "./lib",
|
"outDir": "./lib",
|
||||||
"rootDir": "./src",
|
"rootDir": "./src",
|
||||||
@ -13,9 +12,8 @@
|
|||||||
"useUnknownInCatchVariables": false,
|
"useUnknownInCatchVariables": false,
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"./__tests__/**/*",
|
|
||||||
"./lib/**/*",
|
|
||||||
"node_modules",
|
"node_modules",
|
||||||
|
"**/*.test.ts",
|
||||||
"jest.config.ts"
|
"jest.config.ts"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user