Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Multi-Platform Docker Images and Build Pipelines #291

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
55932e9
create unified Dockerfile with compiled m68k toolchian
justgook Aug 12, 2023
1094b72
move build toolchain script to docker commands, and improve performan…
justgook Aug 13, 2023
5083032
create build job for m68k-gcc
justgook Aug 13, 2023
3f03030
create build job for m68k-gcc (fix yaml file)
justgook Aug 13, 2023
cd22ec9
create github action test build job for multi-platform docker image
justgook Aug 13, 2023
e3e29f4
create github action test build job for multi-platform docker image (…
justgook Aug 13, 2023
53030e3
create github action test build job for multi-platform docker image (…
justgook Aug 13, 2023
0d5ca28
update version of download-artifact action
justgook Aug 13, 2023
8291394
add file filtes to track updates in github actions
justgook Aug 13, 2023
b90e046
add file filtes to track updates in github actions (attempt 2)
justgook Aug 13, 2023
75cea98
add file filtes to track updates in github actions (attempt 3)
justgook Aug 13, 2023
546cc8d
add second workflow for building main sgdk docker image
justgook Aug 13, 2023
4ad13d7
fix build-args syntax in github action workflow
justgook Aug 13, 2023
929214f
add build trigger on push for main docker file
justgook Aug 13, 2023
cb81940
add latest tag to images
justgook Aug 13, 2023
aeabe8e
add cuncurrency test to gh workflow
justgook Aug 13, 2023
edd6d78
update workflows with real dockerfiles
justgook Aug 13, 2023
b08f253
remove workflow mock files
justgook Aug 13, 2023
03c06f4
fix Docker file (and add job for deploy docs to gp-pages, wile waitin…
justgook Aug 13, 2023
f0bf3f0
fix documentation publeshing
justgook Aug 13, 2023
283b924
update readme.md to with info how to pull prebuild docker image
justgook Aug 13, 2023
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
12 changes: 10 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,22 @@
/doc/
/sample/
/vstudio/
/.*/

#prebuilds
**.exe
**.dll
/lib/
/out/
# Ignore non-build related files
/.dockerignore
/.gitignore
.*
.DS_Store
/docker/
/build_adv.bat
/build_lib.bat
/changelog.txt
/COPYING.RUNTIME
/Dockerfile
/Dockerfile-m1
/license.txt
/readme.md
133 changes: 133 additions & 0 deletions .github/workflows/gcc-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
name: gcc-docker
concurrency:
group: ${{ github.ref }}-docker
cancel-in-progress: true
env:
REGISTRY_IMAGE: ghcr.io/${{ github.actor }}/sgdk-m68k-gcc
DOCKERFILE: deps/gcc.Dockerfile

on:
workflow_dispatch:
push:
paths:
- github-actions-test.Dockerfile

jobs:
build:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm64
steps:
- name: Checkout
uses: actions/[email protected]

- name: Docker meta
id: meta_dogecoin
uses: docker/[email protected]
with:
images: ${{ env.REGISTRY_IMAGE }}
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
type=raw,latest

- name: Set up QEMU
uses: docker/[email protected]

- name: Set up Docker Buildx
uses: docker/[email protected]

- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push by digest
id: build
uses: docker/[email protected]
with:
file: ${{ env.DOCKERFILE }}
context: .
platforms: ${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true

- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"

- name: Upload digest
uses: actions/upload-artifact@v3
with:
name: digests
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1

merge:
if: ${{ github.event_name != 'pull_request' }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
needs:
- build
steps:
- name: Download digests
uses: actions/[email protected]
with:
name: digests
path: /tmp/digests

- name: Set up Docker Buildx
uses: docker/[email protected]

- name: Docker meta
id: meta
uses: docker/[email protected]
with:
images: ${{ env.REGISTRY_IMAGE }}
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
type=raw,latest

- name: Login to GHCR
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Create manifest list and push
working-directory: /tmp/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
-
name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}

52 changes: 52 additions & 0 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: publish-docs

on:
workflow_dispatch:
workflow_run:
workflows: ["gcc-docker"]
branches:
- 'master'
types:
- completed
push:
# paths:
# - github-actions-test.Dockerfile
# - .github/workflows/gcc-docker.yml
branches:
- 'master'
tags:
- 'v*'
pull_request:
branches:
- 'master'


jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Install package
run: sudo apt-get install doxygen graphviz
- name: Checkout
uses: actions/[email protected]
- name: Build Github Pages
working-directory: deployment
run: doxygen Doxyfile
- name: Upload artifact
uses: actions/[email protected]
with:
path: ./deployment/html

deploy:
needs: build
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/[email protected]
157 changes: 157 additions & 0 deletions .github/workflows/sgdk-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
name: sgdk-docker

concurrency:
group: ${{ github.ref }}-docker
cancel-in-progress: false

env:
REGISTRY_IMAGE: ghcr.io/${{ github.actor }}/sgdk
BASE_IMAGE: ghcr.io/${{ github.actor }}/sgdk-m68k-gcc
DOCKERFILE: Dockerfile

on:
workflow_dispatch:
workflow_run:
workflows: ["gcc-docker"]
branches:
- 'master'
types:
- completed
push:
paths-ignore:
- '.github/**'
- 'deployment/**'
- 'doc/**'
- 'vstudio/**'
- 'bin/**'
- 'sample/**'
- '**.md'
branches:
- 'master'
tags:
- 'v*'
pull_request:
branches:
- 'master'


jobs:
build:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm64
steps:
- name: Checkout
uses: actions/[email protected]

- name: Docker meta
id: meta_dogecoin
uses: docker/[email protected]
with:
images: ${{ env.REGISTRY_IMAGE }}
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
type=raw,latest

- name: Set up QEMU
uses: docker/[email protected]

- name: Set up Docker Buildx
uses: docker/[email protected]

- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push by digest
id: build
uses: docker/[email protected]
with:
file: ${{ env.DOCKERFILE }}
context: .
build-args: |
BASE_IMAGE=${{ env.BASE_IMAGE }}
platforms: ${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true

- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"

- name: Upload digest
uses: actions/upload-artifact@v3
with:
name: digests
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1

merge:
if: ${{ github.event_name != 'pull_request' }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
needs:
- build
steps:
- name: Download digests
uses: actions/[email protected]
with:
name: digests
path: /tmp/digests

- name: Set up Docker Buildx
uses: docker/[email protected]

- name: Docker meta
id: meta
uses: docker/[email protected]
with:
images: ${{ env.REGISTRY_IMAGE }}
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
type=raw,latest

- name: Login to GHCR
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Create manifest list and push
working-directory: /tmp/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
-
name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,5 @@ tools/rescomp/format
tools/rescomp/rescomp.jar
tools/xgm rom builder/bin
src/z80_*.h

/deployment/html
Loading