Skip to content

Commit

Permalink
Finalize GHA workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
johnwparent committed Dec 13, 2023
1 parent cfd4fc0 commit 44470ef
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ on: workflow_dispatch


jobs:
build-gpg4win:
build-gpg:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -14,5 +14,5 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfiles/gpg4win/Dockerfile.gpg4win
file: Dockerfiles/gpg/Dockerfile.gpg
load: true
8 changes: 4 additions & 4 deletions .github/workflows/test-resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
outputs:
mingw: ${{ steps.changes.outputs.mingw }}
file: ${{ steps.changes.outputs.file }}
gpg4win: ${{ steps.changes.outputs.gpg4win }}
gpg: ${{ steps.changes.outputs.gpg }}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
Expand All @@ -27,8 +27,8 @@ jobs:
- 'Dockerfiles/mingw-w64/**'
file:
- 'Dockerfiles/file/**'
gpg4win:
- 'Dockerfiles/gpg4win/**'
gpg:
- 'Dockerfiles/gpg/**'
build-mingw:
name: "Mingw-w64 build"
if: ${{ needs.changed.outputs.mingw }}
Expand All @@ -37,7 +37,7 @@ jobs:

build-gpg:
name: "Gpg x-build for Windows"
if: ${{ !failure() && !cancelled() && needs.changed.outputs.gpg4win }}
if: ${{ !failure() && !cancelled() && needs.changed.outputs.gpg }}
needs: [build-mingw]
uses: ./.github/worflows/build-gpg.yml

Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/update-file.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ jobs:
fetch_depth: 0
- name: Extract file binary tree + archive
run: |
mkdir -p resources/file/file
docker cp $(docker create ${{ env.REGISTRY }}/${{ github.repository_owner }}/windows-resource/${{ env.IMAGE_NAME }}:latest):/opt/file binary/bootstrap/file
cd resources/file
mkdir -p tmp/resources/file
docker cp $(docker create ${{ env.REGISTRY }}/${{ github.repository_owner }}/windows-resource/${{ env.IMAGE_NAME }}:latest):/opt/file tmp/resources/file/file
cd tmp/resources/file
tar -cz file > file.tar.gz
- name: Checkout pages
run: |
Expand All @@ -61,6 +61,6 @@ jobs:
git config --local user.name "Github Actions from commit ${{ github.sha }}"
- name: Upload
run: |
setup-pages.py
rm -rf resources/file/*
mv tmp/resources/file/file.tar.gz resources/file/file.tar.gz
git add resources/file/file.tar.gz && git commit -m"Update file binary" && git push -f
38 changes: 35 additions & 3 deletions .github/workflows/update-gpg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ on: workflow_dispatch

env:
REGISTRY: ghcr.io
IMAGE_NAME: gpg4win
IMAGE_NAME: gpg

jobs:
build-mingw:
build-gpg:
permissions:
contents: read
packages: write
Expand All @@ -20,15 +20,47 @@ jobs:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/windows-resource/${{ env.IMAGE_NAME }}
tags: |
type=edge,enable=true,branch=main
flavor: |
latest=true
- name: Build and push Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
labels: ${{ steps.meta.outputs.labels }}
push-gpg:
runs-on: ubuntu-latest
needs: [build-gpg]
steps:
- uses: actions/checkout@v4
with:
fetch_depth: 0
- name: Extract gpg binary tree + archive
run: |
mkdir -p tmp/resources/gpg
docker cp $(docker create ${{ env.REGISTRY }}/${{ github.repository_owner }}/windows-resource/${{ env.IMAGE_NAME }}:latest):/opt/gpg tmp/resources/gpg/gpg
cd tmp/resources/gpg
tar -cz gpg > gpg.tar.gz
- name: Checkout pages
run: |
git fetch --all
git checkout -f -B pages --track origin/pages
- name: Config git user
run: |
git config --local user.email "[email protected]"
git config --local user.name "Github Actions from commit ${{ github.sha }}"
- name: Upload
run: |
rm -rf resources/gpg/*
mv tmp/resources/gpg/gpg.tar.gz resources/gpg/gpg.tar.gz
git add resources/gpg/gpg.tar.gz && git commit -m"Update gpg binary" && git push -f
35 changes: 33 additions & 2 deletions .github/workflows/update-mingw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ env:
IMAGE_NAME: mingw-w64

jobs:
build-mingw:
build-mingw-w64:
permissions:
contents: read
packages: write
Expand All @@ -20,16 +20,47 @@ jobs:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/windows-resource/${{ env.IMAGE_NAME }}
tags: |
type=edge,enable=true,branch=main
flavor: |
latest=true
- name: Build and push Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

push-mingw-w64:
runs-on: ubuntu-latest
needs: [build-mingw-w64]
steps:
- uses: actions/checkout@v4
with:
fetch_depth: 0
- name: Extract mingw-w64 binary tree + archive
run: |
mkdir -p tmp/resources/mingw_w64
docker cp $(docker create ${{ env.REGISTRY }}/${{ github.repository_owner }}/windows-resource/${{ env.IMAGE_NAME }}:latest):/opt/mingw64-w64 tmp/resources/mingw_w64/mingw_w64
cd tmp/resources/mingw_w64
tar -cz mingw_w64 > mingw_w64.tar.gz
- name: Checkout pages
run: |
git fetch --all
git checkout -f -B pages --track origin/pages
- name: Config git user
run: |
git config --local user.email "[email protected]"
git config --local user.name "Github Actions from commit ${{ github.sha }}"
- name: Upload
run: |
rm -rf resources/mingw_w64/*
mv tmp/resources/mingw_w64/mingw_w64.tar.gz resources/mingw_w64/mingw_w64.tar.gz
git add resources/mingw_w64/mingw_w64.tar.gz && git commit -m"Update mingw_w64 binary" && git push -f
8 changes: 4 additions & 4 deletions .github/workflows/update-resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
outputs:
mingw: ${{ steps.changes.outputs.mingw }}
file: ${{ steps.changes.outputs.file }}
gpg4win: ${{ steps.changes.outputs.gpg4win }}
gpg: ${{ steps.changes.outputs.gpg }}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
Expand All @@ -27,16 +27,16 @@ jobs:
- 'Dockerfiles/mingw-w64/**'
file:
- 'Dockerfiles/file/**'
gpg4win:
- 'Dockerfiles/gpg4win/**'
gpg:
- 'Dockerfiles/gpg/**'
build-upload-mingw:
name: "Mingw-w64 build and Upload"
if: ${{ needs.changed.outputs.mingw }}
needs: [changed]
uses: ./.github/worflows/update-mingw.yml
build-upload-gpg:
name: "Gpg x-build and upload for Windows"
if: ${{ !failure() && !cancelled() && needs.changed.outputs.gpg4win }}
if: ${{ !failure() && !cancelled() && needs.changed.outputs.gpg }}
needs: [build-upload-mingw]
uses: ./.github/worflows/update-gpg.yml
build-upload-file:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfiles/file/Dockerfile.file
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN curl -o file.tar.gz https://github.com/file/file/archive/refs/tags/FILE5_45.
WORKDIR /opt/file/src/file

# Build file
RUN $BUILD_ROOT/src/mingw-w64/mingw-w64-headers/configure \\
RUN ./confgiure \\
--prefix=/opt/file \\
--host=x86_64-w64-mingw32 \\
--target=x86_64-w64-mingw32 \\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ FROM ghcr.io/spack/windows-resource/mingw-w64:latest

RUN mkdir -p /sources/tarballs /opt/deps /opt/gpg
ENV DEP_PREFIX=/opt/deps
ENV PREFIX=/opt/gpg
WORKDIR /sources/tarballs
# Fetch sources
RUN curl -L --remote-name-all\
Expand Down Expand Up @@ -41,7 +42,7 @@ RUN cd npth && \
RUN cd libgpg-erro && \
libgpg-error/configure \
--host=x86_64-w64-mingw32 \
--prefix="/deps" \
--prefix="${DEP_PREFIX}" \
--enable-shared=no \
--enable-static=yes \
--disable-nls \
Expand All @@ -56,45 +57,45 @@ RUN cd libgpg-erro && \
RUN cd libassuan && \
libassuan-2.5.5/configure \
--host=x86_64-w64-mingw32 \
--prefix="/deps" \
--prefix="${DEP_PREFIX}" \
--enable-shared=no \
--enable-static=yes \
--with-libgpg-error-prefix="/deps" \
--with-libgpg-error-prefix="${DEP_PREFIX}" \
CFLAGS="-Os" \
&& make -j$(nproc) \
&& make install

WORKDIR /libgcrypt
RUN /libgcrypt-$LIBGCRYPT_VERSION/configure \
--host=x86_64-w64-mingw32 \
--prefix="/deps" \
--prefix="${DEP_PREFIX}" \
--enable-shared=no \
--enable-static=yes \
--disable-doc \
--with-libgpg-error-prefix="/deps" \
--with-libgpg-error-prefix="${DEP_PREFIX}" \
CFLAGS="-Os" \
&& make -j$(nproc) \
&& make install

WORKDIR /libksba
RUN /libksba-$LIBKSBA_VERSION/configure \
--host=x86_64-w64-mingw32 \
--prefix="/deps" \
--prefix="${DEP_PREFIX}" \
--enable-shared=no \
--enable-static=yes \
--with-libgpg-error-prefix="/deps" \
--with-libgpg-error-prefix="${DEP_PREFIX}" \
&& make -j$(nproc) \
&& make install

WORKDIR /gnupg
RUN /gnupg-$GNUPG_VERSION/configure \
--host=x86_64-w64-mingw32 \
--prefix="$PREFIX" \
--with-npth-prefix="/deps" \
--with-libgpg-error-prefix="/deps" \
--with-libgcrypt-prefix="/deps" \
--with-libassuan-prefix="/deps" \
--with-ksba-prefix="/deps" \
--prefix="${PREFIX}" \
--with-npth-prefix="${DEP_PREFIX}" \
--with-libgpg-error-prefix="${DEP_PREFIX}" \
--with-libgcrypt-prefix="${DEP_PREFIX}" \
--with-libassuan-prefix="${DEP_PREFIX}" \
--with-ksba-prefix="${DEP_PREFIX}" \
--disable-bzip2 \
--disable-card-support \
--disable-ccid-driver \
Expand Down Expand Up @@ -126,7 +127,7 @@ RUN /gnupg-$GNUPG_VERSION/configure \
WORKDIR /iconv
RUN /libiconv-$ICONV_VERSION/configure \
--host=x86_64-w64-mingw32 \
--prefix="/deps" \
--prefix="${DEP_PREFIX}" \
--enable-shared=no \
--enable-static=yes \
--disable-nls \
Expand All @@ -138,10 +139,10 @@ RUN /libiconv-$ICONV_VERSION/configure \
WORKDIR /pinentry
RUN /pinentry-$PINENTRY_VERSION/configure \
--host=x86_64-w64-mingw32 \
--prefix="$PREFIX" \
--with-libgpg-error-prefix="/deps" \
--with-libassuan-prefix="/deps" \
--with-libiconv-prefix="/deps" \
--prefix="${PREFIX}" \
--with-libgpg-error-prefix="${DEP_PREFIX}" \
--with-libassuan-prefix="${DEP_PREFIX}" \
--with-libiconv-prefix="${DEP_PREFIX}" \
--disable-ncurses \
--disable-libsecret \
--disable-pinentry-tty \
Expand Down

0 comments on commit 44470ef

Please sign in to comment.