Skip to content
This repository has been archived by the owner on Dec 24, 2024. It is now read-only.

ci: test workflow #39

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: test

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

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

env:
BUILD_TAG: docker:test
CONTAINER_NAME: docker

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
docker_file:
- Dockerfile-26.1
- Dockerfile-26.0
- Dockerfile-25.0
context:
- qemu
- xx
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Docker Build
uses: docker/bake-action@v4
with:
targets: image-local
env:
DEFAULT_TAG: ${{ env.BUILD_TAG }}
DOCKERFILE: ${{ matrix.docker_file }}
-
name: Start
run: |
docker compose config
docker compose up -d
sleep 20
docker ps -a
netstat -atpn
docker compose logs
working-directory: test
env:
DOCKER_IMAGE: ${{ env.BUILD_TAG }}
DOCKER_CONTAINER: ${{ env.CONTAINER_NAME }}
CONTEXT_DIR: ${{ matrix.context }}
# -
# name: Check container logs
# uses: crazy-max/.github/.github/actions/container-logs-check@main
# with:
# container_name: ${{ env.CONTAINER_NAME }}
# log_check: "API listen on [::]:2375"
-
name: Create context
run: |
docker context create docker-test --docker "host=tcp://127.0.0.1:12375,skip-tls-verify=true"
docker context use docker-test
-
name: Build
uses: docker/build-push-action@v5
with:
context: ./test/${{ matrix.context }}
-
name: Build within container
run: |
docker compose exec ${{ env.CONTAINER_NAME }} \
docker build --platform linux/amd64,linux/arm64 --output type=cacheonly .
working-directory: test
env:
DOCKER_IMAGE: ${{ env.BUILD_TAG }}
DOCKER_CONTAINER: ${{ env.CONTAINER_NAME }}
CONTEXT_DIR: ${{ matrix.context }}
-
name: Logs
if: always()
run: |
docker compose logs
working-directory: test
env:
DOCKER_IMAGE: ${{ env.BUILD_TAG }}
DOCKER_CONTAINER: ${{ env.CONTAINER_NAME }}
CONTEXT_DIR: ${{ matrix.context }}
12 changes: 12 additions & 0 deletions test/compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
services:
docker:
image: ${DOCKER_IMAGE:-crazymax/docker}
container_name: ${DOCKER_CONTAINER:-docker}
privileged: true
command: --host=tcp://0.0.0.0:2375 --tlsverify=false --debug
ports:
- "12375:2375"
volumes:
- "./${CONTEXT_DIR:-qemu}:/src"
working_dir: /src
restart: always
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions test/xx/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/crazy-max/docker-docker/test

go 1.17
7 changes: 7 additions & 0 deletions test/xx/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main

import "fmt"

func main() {
fmt.Println("Hello, Go!")
}
Loading