| 1 |
name: merge |
| 2 |
|
| 3 |
concurrency: |
| 4 |
group: ${{ github.workflow }}-${{ github.ref }} |
| 5 |
cancel-in-progress: true |
| 6 |
|
| 7 |
on: |
| 8 |
push: |
| 9 |
branches: |
| 10 |
- 'main' |
| 11 |
tags: |
| 12 |
- 'v*' |
| 13 |
|
| 14 |
permissions: |
| 15 |
contents: read # to fetch code (actions/checkout) |
| 16 |
|
| 17 |
env: |
| 18 |
REPO_SLUG: "docker/compose-bin" |
| 19 |
|
| 20 |
jobs: |
| 21 |
e2e: |
| 22 |
name: Build and test |
| 23 |
runs-on: ${{ matrix.os }} |
| 24 |
timeout-minutes: 15 |
| 25 |
strategy: |
| 26 |
fail-fast: false |
| 27 |
matrix: |
| 28 |
os: [desktop-windows, desktop-macos, desktop-m1] |
| 29 |
# mode: [plugin, standalone] |
| 30 |
mode: [plugin] |
| 31 |
env: |
| 32 |
GO111MODULE: "on" |
| 33 |
steps: |
| 34 |
- uses: actions/checkout@v4 |
| 35 |
|
| 36 |
- uses: actions/setup-go@v5 |
| 37 |
with: |
| 38 |
go-version-file: go.mod |
| 39 |
cache: true |
| 40 |
check-latest: true |
| 41 |
|
| 42 |
- name: List Docker resources on machine |
| 43 |
run: | |
| 44 |
docker ps --all |
| 45 |
docker volume ls |
| 46 |
docker network ls |
| 47 |
docker image ls |
| 48 |
- name: Remove Docker resources on machine |
| 49 |
continue-on-error: true |
| 50 |
run: | |
| 51 |
docker kill $(docker ps -q) |
| 52 |
docker rm -f $(docker ps -aq) |
| 53 |
docker volume rm -f $(docker volume ls -q) |
| 54 |
docker ps --all |
| 55 |
|
| 56 |
- name: Unit tests |
| 57 |
run: make test |
| 58 |
|
| 59 |
- name: Build binaries |
| 60 |
run: | |
| 61 |
make |
| 62 |
- name: Check arch of go compose binary |
| 63 |
run: | |
| 64 |
file ./bin/build/docker-compose |
| 65 |
if: ${{ !contains(matrix.os, 'desktop-windows') }} |
| 66 |
- |
| 67 |
name: Test plugin mode |
| 68 |
if: ${{ matrix.mode == 'plugin' }} |
| 69 |
run: | |
| 70 |
make e2e-compose |
| 71 |
- |
| 72 |
name: Test standalone mode |
| 73 |
if: ${{ matrix.mode == 'standalone' }} |
| 74 |
run: | |
| 75 |
make e2e-compose-standalone |
| 76 |
|
| 77 |
bin-image: |
| 78 |
runs-on: ubuntu-22.04 |
| 79 |
outputs: |
| 80 |
digest: ${{ fromJSON(steps.bake.outputs.metadata).image-cross['containerimage.digest'] }} |
| 81 |
steps: |
| 82 |
- |
| 83 |
name: Free disk space |
| 84 |
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1 |
| 85 |
with: |
| 86 |
android: true |
| 87 |
dotnet: true |
| 88 |
haskell: true |
| 89 |
large-packages: true |
| 90 |
swap-storage: true |
| 91 |
- |
| 92 |
name: Checkout |
| 93 |
uses: actions/checkout@v4 |
| 94 |
- |
| 95 |
name: Login to DockerHub |
| 96 |
if: github.event_name != 'pull_request' |
| 97 |
uses: docker/login-action@v3 |
| 98 |
with: |
| 99 |
username: ${{ secrets.DOCKERPUBLICBOT_USERNAME }} |
| 100 |
password: ${{ secrets.DOCKERPUBLICBOT_WRITE_PAT }} |
| 101 |
- |
| 102 |
name: Set up QEMU |
| 103 |
uses: docker/setup-qemu-action@v3 |
| 104 |
- |
| 105 |
name: Set up Docker Buildx |
| 106 |
uses: docker/setup-buildx-action@v3 |
| 107 |
- |
| 108 |
name: Docker meta |
| 109 |
id: meta |
| 110 |
uses: docker/metadata-action@v5 |
| 111 |
with: |
| 112 |
images: | |
| 113 |
${{ env.REPO_SLUG }} |
| 114 |
tags: | |
| 115 |
type=ref,event=tag |
| 116 |
type=edge |
| 117 |
bake-target: meta-helper |
| 118 |
- |
| 119 |
name: Build and push image |
| 120 |
uses: docker/bake-action@v6 |
| 121 |
id: bake |
| 122 |
with: |
| 123 |
source: . |
| 124 |
files: | |
| 125 |
./docker-bake.hcl |
| 126 |
${{ steps.meta.outputs.bake-file }} |
| 127 |
targets: image-cross |
| 128 |
push: ${{ github.event_name != 'pull_request' }} |
| 129 |
sbom: true |
| 130 |
provenance: mode=max |
| 131 |
set: | |
| 132 |
*.cache-from=type=gha,scope=bin-image |
| 133 |
*.cache-to=type=gha,scope=bin-image,mode=max |
| 134 |
|
| 135 |
desktop-edge-test: |
| 136 |
runs-on: ubuntu-latest |
| 137 |
needs: bin-image |
| 138 |
steps: |
| 139 |
- |
| 140 |
name: Generate Token |
| 141 |
id: generate_token |
| 142 |
uses: actions/create-github-app-token@v1 |
| 143 |
with: |
| 144 |
app-id: ${{ vars.DOCKERDESKTOP_APP_ID }} |
| 145 |
private-key: ${{ secrets.DOCKERDESKTOP_APP_PRIVATEKEY }} |
| 146 |
owner: docker |
| 147 |
repositories: | |
| 148 |
${{ secrets.DOCKERDESKTOP_REPO }} |
| 149 |
- |
| 150 |
name: Trigger Docker Desktop e2e with edge version |
| 151 |
uses: actions/github-script@v7 |
| 152 |
with: |
| 153 |
github-token: ${{ steps.generate_token.outputs.token }} |
| 154 |
script: | |
| 155 |
await github.rest.actions.createWorkflowDispatch({ |
| 156 |
owner: 'docker', |
| 157 |
repo: '${{ secrets.DOCKERDESKTOP_REPO }}', |
| 158 |
workflow_id: 'compose-edge-integration.yml', |
| 159 |
ref: 'main', |
| 160 |
inputs: { |
| 161 |
"image-tag": "${{ needs.bin-image.outputs.digest }}" |
| 162 |
} |
| 163 |
}) |