From dfb9a0b02bd16db24cdae2c0af799129cadb1024 Mon Sep 17 00:00:00 2001 From: Maxim Biro Date: Tue, 27 Feb 2024 21:13:38 -0500 Subject: [PATCH] fix: Test the current Windows Dockerfile, not an old Dockerhub image A bit infuriating that when you submit a PR modifying the Windows cross-compilation script, the CI *builds* the current image in one job, but then *runs* an older (!) image from Dockerhub in another. So it tests that the modified image builds successfully but doesn't test if it runs successfully, instead testing if an older image runs successfully / testing if the current toxcore changes run successfully in an older image. This should build and run the same image with the current changes. --- .github/scripts/cmake-windows.sh | 2 ++ .github/workflows/ci.yml | 14 +--------- .github/workflows/docker.yml | 48 ++++++++++++++------------------ 3 files changed, 24 insertions(+), 40 deletions(-) diff --git a/.github/scripts/cmake-windows.sh b/.github/scripts/cmake-windows.sh index ed2f677375..fdcd7a8b91 100644 --- a/.github/scripts/cmake-windows.sh +++ b/.github/scripts/cmake-windows.sh @@ -26,4 +26,6 @@ docker run \ -v "$PWD:/toxcore" \ -v "$PWD/result:/prefix" \ --rm \ + -t \ + --pull never \ "toxchat/windows:$WINDOWS_ARCH" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bf60fa0352..7988ea26b1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -83,7 +83,7 @@ jobs: - name: Build and test run: .github/scripts/cmake-osx - build-msvc: + build-windows-msvc: strategy: matrix: version: [2019, 2022] @@ -110,18 +110,6 @@ jobs: cd _build ctest -j50 --output-on-failure --rerun-failed --repeat until-pass:6 --build-config Debug - build-windows: - strategy: - matrix: - bits: [32, 64] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - name: Cross compilation - run: .github/scripts/cmake-win${{ matrix.bits }} script - build-netbsd: runs-on: ubuntu-latest steps: diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index f2ff16fefd..9b7092fc55 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -138,9 +138,15 @@ jobs: cache-from: type=registry,ref=toxchat/c-toxcore:esp32 cache-to: type=inline - docker-win32: + docker-windows-mingw: + strategy: + matrix: + bits: [32, 64] runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 + with: + submodules: recursive - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Login to DockerHub @@ -149,39 +155,27 @@ jobs: with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push + - name: Build and store to local Docker daemon uses: docker/build-push-action@v5 with: - context: "{{defaultContext}}:other/docker/windows" - push: ${{ github.event_name == 'push' }} - tags: toxchat/windows:win32 - cache-from: type=registry,ref=toxchat/windows:win32 - cache-to: type=inline + context: other/docker/windows + load: true + tags: toxchat/windows:win${{ matrix.bits }} + cache-from: type=registry,ref=toxchat/windows:win${{ matrix.bits }} build-args: | - SUPPORT_ARCH_i686=true - SUPPORT_ARCH_x86_64=false + SUPPORT_ARCH_i686=${{ matrix.bits == '32' }} + SUPPORT_ARCH_x86_64=${{ matrix.bits == '64' }} SUPPORT_TEST=true - - docker-win64: - runs-on: ubuntu-latest - steps: - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to DockerHub + - name: Push the stored image to Dockerhub if: ${{ github.event_name == 'push' }} - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push uses: docker/build-push-action@v5 with: - context: "{{defaultContext}}:other/docker/windows" + context: other/docker/windows push: ${{ github.event_name == 'push' }} - tags: toxchat/windows:win64 - cache-from: type=registry,ref=toxchat/windows:win64 - cache-to: type=inline + tags: toxchat/windows:win${{ matrix.bits }} build-args: | - SUPPORT_ARCH_i686=false - SUPPORT_ARCH_x86_64=true + SUPPORT_ARCH_i686=${{ matrix.bits == '32' }} + SUPPORT_ARCH_x86_64=${{ matrix.bits == '64' }} SUPPORT_TEST=true + - name: Cross-compile + run: .github/scripts/cmake-win${{ matrix.bits }} script