mirror of
				https://github.moeyy.xyz/https://github.com/docker/setup-docker-action.git
				synced 2025-10-27 19:16:40 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			246 lines
		
	
	
		
			5.3 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
			
		
		
	
	
			246 lines
		
	
	
		
			5.3 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
| name: ci
 | |
| 
 | |
| on:
 | |
|   workflow_dispatch:
 | |
|   schedule:
 | |
|     - cron: '0 10 * * *'
 | |
|   push:
 | |
|     branches:
 | |
|       - 'master'
 | |
|       - 'releases/v*'
 | |
|     tags:
 | |
|       - 'v*'
 | |
|   pull_request:
 | |
| 
 | |
| env:
 | |
|   DOCKER_VERSION: v23.0.6
 | |
|   SIGN_QEMU_BINARY: 1
 | |
| 
 | |
| jobs:
 | |
|   main:
 | |
|     runs-on: ${{ matrix.os }}
 | |
|     strategy:
 | |
|       fail-fast: false
 | |
|       matrix:
 | |
|         os:
 | |
|           - ubuntu-latest
 | |
|           - macos-latest
 | |
|           - windows-latest
 | |
|         version:
 | |
|           - pinned
 | |
|           - latest
 | |
|     steps:
 | |
|       -
 | |
|         name: Checkout
 | |
|         uses: actions/checkout@v3
 | |
|       -
 | |
|         name: Set version
 | |
|         shell: bash
 | |
|         run: |
 | |
|           if [ "${{ matrix.version }}" != "pinned" ]; then
 | |
|             echo "DOCKER_VERSION=${{ matrix.version }}" >> $GITHUB_ENV
 | |
|           fi
 | |
|       -
 | |
|         name: Set up Docker
 | |
|         uses: ./
 | |
|         with:
 | |
|           version: ${{ env.DOCKER_VERSION }}
 | |
|       -
 | |
|         name: Dump context
 | |
|         if: always()
 | |
|         uses: crazy-max/ghaction-dump-context@v2
 | |
| 
 | |
|   channel:
 | |
|     runs-on: ${{ matrix.os }}
 | |
|     strategy:
 | |
|       fail-fast: false
 | |
|       matrix:
 | |
|         os:
 | |
|           - ubuntu-latest
 | |
|           - macos-latest
 | |
|           - windows-latest
 | |
|     steps:
 | |
|       -
 | |
|         name: Checkout
 | |
|         uses: actions/checkout@v3
 | |
|       -
 | |
|         name: Set up Docker
 | |
|         uses: ./
 | |
|         with:
 | |
|           version: v23.0.0-rc.4
 | |
|           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-latest
 | |
|           - windows-latest
 | |
|     steps:
 | |
|       -
 | |
|         name: Checkout
 | |
|         uses: actions/checkout@v3
 | |
|       -
 | |
|         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:
 | |
|     runs-on: ${{ matrix.os }}
 | |
|     strategy:
 | |
|       fail-fast: false
 | |
|       matrix:
 | |
|         os:
 | |
|           - ubuntu-latest
 | |
|           - macos-latest
 | |
|           - windows-latest
 | |
|     steps:
 | |
|       -
 | |
|         name: Checkout
 | |
|         uses: actions/checkout@v3
 | |
|       -
 | |
|         name: Set up Docker
 | |
|         uses: ./
 | |
|         with:
 | |
|           version: ${{ env.DOCKER_VERSION }}
 | |
|           context: foo
 | |
|       -
 | |
|         name: Check context
 | |
|         run: |
 | |
|           docker context inspect foo
 | |
|       -
 | |
|         name: Dump context
 | |
|         if: always()
 | |
|         uses: crazy-max/ghaction-dump-context@v2
 | |
| 
 | |
|   colima-start-args:
 | |
|     runs-on: macos-latest
 | |
|     steps:
 | |
|       -
 | |
|         name: Checkout
 | |
|         uses: actions/checkout@v3
 | |
|       -
 | |
|         name: Set up Docker
 | |
|         uses: ./
 | |
|         env:
 | |
|           COLIMA_START_ARGS: --cpu 4 --memory 8 --disk 32 --dns 1.1.1.1 --dns 8.8.8.8 --dns-host example.com=1.2.3.4
 | |
| 
 | |
|   build-linux:
 | |
|     runs-on: ubuntu-latest
 | |
|     steps:
 | |
|       -
 | |
|         name: Checkout
 | |
|         uses: actions/checkout@v3
 | |
|       -
 | |
|         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@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: |
 | |
|           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: macos-latest
 | |
|     steps:
 | |
|       -
 | |
|         name: Checkout
 | |
|         uses: actions/checkout@v3
 | |
|       -
 | |
|         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@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: |
 | |
|           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:
 | |
|     runs-on: windows-latest
 | |
|     steps:
 | |
|       -
 | |
|         name: Checkout
 | |
|         uses: actions/checkout@v3
 | |
|       -
 | |
|         name: Set up Docker
 | |
|         uses: ./
 | |
|         with:
 | |
|           version: ${{ env.DOCKER_VERSION }}
 | |
|       -
 | |
|         name: Build
 | |
|         working-directory: ./test
 | |
|         run: |
 | |
|           docker build -f win.Dockerfile -t test .
 | |
|       -
 | |
|         name: Inspect
 | |
|         run: |
 | |
|           docker image inspect test
 | |
|       -
 | |
|         name: Dump context
 | |
|         if: always()
 | |
|         uses: crazy-max/ghaction-dump-context@v2
 | 
