Skip to content

Commit

Permalink
WIP: github: Test manually building docker images, test Dockerfile.cross
Browse files Browse the repository at this point in the history
  • Loading branch information
mstorsjo committed Feb 20, 2024
1 parent 838a9a1 commit 2fccf75
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 15 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
name: Builds
on:
push:
branches:
- '**'
pull_request:
schedule:
- cron: '0 0 * * *'
Expand Down
79 changes: 67 additions & 12 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Build docker images
on:
push:
workflow_dispatch:
inputs:
commit:
Expand All @@ -24,6 +25,7 @@ jobs:
TAG: ${{steps.get-parameters.outputs.TAG}}
steps:
- name: Download build parameters
if: false
uses: dawidd6/action-download-artifact@v3
with:
workflow: build.yml
Expand All @@ -35,7 +37,8 @@ jobs:
- name: Get build parameters
id: get-parameters
run: |
cat parameters.txt >> $GITHUB_OUTPUT
echo TAG=test >> $GITHUB_OUTPUT
#cat parameters.txt >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
docker-build:
Expand All @@ -49,10 +52,8 @@ jobs:
- { file: Dockerfile.dev, maintag: dev, prefix: dev- }
steps:
- uses: actions/checkout@v4
with:
ref: ${{ (inputs.commit != '' && inputs.commit) || inputs.branch }}
- name: Log in to Docker Hub
if: ${{inputs.login}}
if: false
uses: docker/login-action@v3
with:
username: ${{secrets.DOCKER_USERNAME}}
Expand All @@ -61,30 +62,84 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
push: ${{inputs.push}}
push: false
file: ./${{matrix.file}}
tags: |
mstorsjo/llvm-mingw:${{matrix.maintag}}
mstorsjo/llvm-mingw:${{matrix.prefix}}${{needs.prepare.outputs.TAG}}
- name: Inspect Docker images
run: |
docker images
- name: Extract toolchain
if: ${{ (matrix.file == 'Dockerfile') }}
env:
TAG: ${{needs.prepare.outputs.TAG}}
run: |
DISTRO=ubuntu-20.04-$(uname -m)
docker run --rm mstorsjo/llvm-mingw:latest sh -c "cd /opt && mv llvm-mingw llvm-mingw-$TAG-ucrt-$DISTRO && tar -Jcvf - --format=ustar --numeric-owner --owner=0 --group=0 llvm-mingw-$TAG-ucrt-$DISTRO" > llvm-mingw-$TAG-ucrt-$DISTRO.tar.xz
- name: Upload image
if: ${{ (matrix.file == 'Dockerfile') }}
uses: ishworkh/container-image-artifact-upload@v1.0.0
with:
retention_days: 3
image: mstorsjo/llvm-mingw:latest
- uses: actions/upload-artifact@v4
if: ${{ (matrix.file == 'Dockerfile') }}
with:
name: linux-ucrt-x86_64-toolchain
path: |
llvm-mingw-*.tar.xz
retention-days: 7

docker-build-cross:
needs: [docker-build, prepare]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download image
uses: ishworkh/container-image-artifact-download@v1.0.0
with:
image: mstorsjo/llvm-mingw:latest
- name: Build Docker images
uses: docker/build-push-action@v5
with:
context: .
push: false
file: ./Dockerfile.cross
load: true
build-args: |
BASE=mstorsjo/llvm-mingw:latest
CROSS_ARCH=x86_64
TAG=${{needs.prepare.outputs.TAG}}-ucrt-
WITH_PYTHON=1
tags: |
mstorsjo/llvm-mingw-cross:latest
- name: Inspect Docker images, extract output
env:
TAG: ${{needs.prepare.outputs.TAG}}
run: |
docker images
./extract-docker.sh mstorsjo/llvm-mingw-cross:latest /llvm-mingw-$TAG-ucrt-x86_64.zip
- uses: actions/upload-artifact@v4
with:
name: windows-ucrt-x86_64-toolchain
path: |
llvm-mingw-*.zip
retention-days: 7

docker-build-toolchain:
needs: [prepare]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ (inputs.commit != '' && inputs.commit) || inputs.branch }}
- name: Download toolchain
uses: dawidd6/action-download-artifact@v3
with:
workflow: build.yml
workflow_conclusion: success
commit: ${{inputs.commit}}
branch: ${{inputs.branch}}
event: push
commit:
branch: master
event: schedule
name: linux-ucrt-.*
name_is_regexp: true
path: toolchain
Expand All @@ -93,7 +148,7 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
if: ${{inputs.login}}
if: false
uses: docker/login-action@v3
with:
username: ${{secrets.DOCKER_USERNAME}}
Expand All @@ -103,7 +158,7 @@ jobs:
with:
context: .
platforms: linux/arm64
push: ${{inputs.push}}
push: false
file: ./Dockerfile.toolchain
load: true
tags: |
Expand Down

0 comments on commit 2fccf75

Please sign in to comment.