From 44470efb296329d23b41cb921ad3dbaea895a41f Mon Sep 17 00:00:00 2001 From: John Parent Date: Wed, 13 Dec 2023 12:05:08 -0500 Subject: [PATCH] Finalize GHA workflow --- .../{build-gpg4win.yml => build-gpg.yml} | 4 +- .github/workflows/test-resources.yml | 8 ++-- .github/workflows/update-file.yml | 10 ++--- .github/workflows/update-gpg.yml | 38 +++++++++++++++++-- .github/workflows/update-mingw.yml | 35 ++++++++++++++++- .github/workflows/update-resources.yml | 8 ++-- Dockerfiles/file/Dockerfile.file | 2 +- .../Dockerfile.gpg4win => gpg/Dockerfile.gpg} | 37 +++++++++--------- 8 files changed, 103 insertions(+), 39 deletions(-) rename .github/workflows/{build-gpg4win.yml => build-gpg.yml} (83%) rename Dockerfiles/{gpg4win/Dockerfile.gpg4win => gpg/Dockerfile.gpg} (83%) diff --git a/.github/workflows/build-gpg4win.yml b/.github/workflows/build-gpg.yml similarity index 83% rename from .github/workflows/build-gpg4win.yml rename to .github/workflows/build-gpg.yml index 6fc38b9..377344d 100644 --- a/.github/workflows/build-gpg4win.yml +++ b/.github/workflows/build-gpg.yml @@ -2,7 +2,7 @@ on: workflow_dispatch jobs: - build-gpg4win: + build-gpg: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -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 \ No newline at end of file diff --git a/.github/workflows/test-resources.yml b/.github/workflows/test-resources.yml index 9efa20d..950e24b 100644 --- a/.github/workflows/test-resources.yml +++ b/.github/workflows/test-resources.yml @@ -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 @@ -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 }} @@ -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 diff --git a/.github/workflows/update-file.yml b/.github/workflows/update-file.yml index af3e4f8..e55c5fc 100644 --- a/.github/workflows/update-file.yml +++ b/.github/workflows/update-file.yml @@ -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: | @@ -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 - diff --git a/.github/workflows/update-gpg.yml b/.github/workflows/update-gpg.yml index 0366369..ac57870 100644 --- a/.github/workflows/update-gpg.yml +++ b/.github/workflows/update-gpg.yml @@ -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 @@ -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 }} \ No newline at end of file + 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 "action@github.com" + 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 diff --git a/.github/workflows/update-mingw.yml b/.github/workflows/update-mingw.yml index b78dfad..2477fc7 100644 --- a/.github/workflows/update-mingw.yml +++ b/.github/workflows/update-mingw.yml @@ -5,7 +5,7 @@ env: IMAGE_NAME: mingw-w64 jobs: - build-mingw: + build-mingw-w64: permissions: contents: read packages: write @@ -20,11 +20,17 @@ 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: @@ -32,4 +38,29 @@ jobs: 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 "action@github.com" + 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 diff --git a/.github/workflows/update-resources.yml b/.github/workflows/update-resources.yml index 329ab6a..197debf 100644 --- a/.github/workflows/update-resources.yml +++ b/.github/workflows/update-resources.yml @@ -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 @@ -27,8 +27,8 @@ 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 }} @@ -36,7 +36,7 @@ jobs: 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: diff --git a/Dockerfiles/file/Dockerfile.file b/Dockerfiles/file/Dockerfile.file index 350d23e..fc84577 100644 --- a/Dockerfiles/file/Dockerfile.file +++ b/Dockerfiles/file/Dockerfile.file @@ -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 \\ diff --git a/Dockerfiles/gpg4win/Dockerfile.gpg4win b/Dockerfiles/gpg/Dockerfile.gpg similarity index 83% rename from Dockerfiles/gpg4win/Dockerfile.gpg4win rename to Dockerfiles/gpg/Dockerfile.gpg index 3a77677..e71fe1f 100644 --- a/Dockerfiles/gpg4win/Dockerfile.gpg4win +++ b/Dockerfiles/gpg/Dockerfile.gpg @@ -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\ @@ -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 \ @@ -56,10 +57,10 @@ 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 @@ -67,11 +68,11 @@ RUN cd libassuan && \ 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 @@ -79,22 +80,22 @@ RUN /libgcrypt-$LIBGCRYPT_VERSION/configure \ 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 \ @@ -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 \ @@ -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 \