diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 2e24e83..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,100 +0,0 @@ -version: 2.1 -orbs: - gcp-gcr: circleci/gcp-gcr@0.6.1 -jobs: - build: - docker: - - image: ubuntu:eoan - steps: - - run: - name: Use AWS Ubuntu mirror - command: > - sed -i /etc/apt/sources.list - -e 's#archive.ubuntu.com#us-east-2.ec2.archive.ubuntu.com#' - - run: - name: Accept EULAs - command: | - echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections - - run: - name: Install base dependencies - command: > - apt-get update && apt-get install -y -q - autoconf - bison - cmake - flex - gettext - git-core - intltool - libglib2.0-dev - libtool - mingw-w64 - nsis - pkg-config - protobuf-compiler - python - python-dev - stow - sudo - texinfo - unzip - wget - wine-stable - yasm - - run: - name: Configure Mingw for POSIX threads - command: update-alternatives --set i686-w64-mingw32-gcc /usr/bin/i686-w64-mingw32-gcc-posix - - run: - name: Configure Mingw for POSIX threads - command: update-alternatives --set i686-w64-mingw32-g++ /usr/bin/i686-w64-mingw32-g++-posix - - checkout: - path: /src - - run: - name: Create target directory - command: mkdir -p /target/stow - - run: - name: Build dependencies - command: make - working_directory: /src/windows - - persist_to_workspace: - root: /target - paths: - - "*" - build_docker: - executor: gcp-gcr/default - steps: - - run: - name: Install dependencies - command: sudo apt-get update && sudo apt-get install -y curl - - checkout - - attach_workspace: - at: ./target - - gcp-gcr/gcr-auth - - gcp-gcr/build-image: - dockerfile: windows.Dockerfile - image: mingw-w64 - registry-url: eu.gcr.io - tag: $CIRCLE_SHA1 - - gcp-gcr/push-image: - image: mingw-w64 - registry-url: eu.gcr.io - tag: $CIRCLE_SHA1 - - gcp-gcr/tag-image: - image: mingw-w64 - registry-url: eu.gcr.io - source-tag: $CIRCLE_SHA1 - target-tag: latest - -workflows: - version: 2 - all: - jobs: - - build - - build_docker: - context: gcp - requires: - - build - filters: - branches: - only: master - diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dbfeba5..77d5db7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,53 +4,14 @@ on: branches: - master +env: + IMAGE_NAME: europe-north1-docker.pkg.dev/clementine-data/mingw-w64 + jobs: build: - runs-on: ubuntu-18.04 - container: - image: ubuntu:eoan + runs-on: ubuntu-24.04 steps: - - name: Accept EULAs - env: - DEBIAN_FRONTEND: interactive - run: echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections - - name: Install dependencies - run: > - apt-get update && apt-get install -y -q - autoconf - bison - cmake - flex - gettext - git-core - intltool - libglib2.0-dev - libtool - mingw-w64 - nsis - pkg-config - protobuf-compiler - python - python-dev - stow - sudo - texinfo - unzip - wget - wine-stable - yasm - - name: Configure Mingw for POSIX threads - run: update-alternatives --set i686-w64-mingw32-gcc /usr/bin/i686-w64-mingw32-gcc-posix - - name: Configure Mingw for POSIX threads - run: update-alternatives --set i686-w64-mingw32-g++ /usr/bin/i686-w64-mingw32-g++-posix - name: Checkout - uses: actions/checkout@v2 - with: - path: deps - - name: Fix source path - run: mv deps /src - - name: Create target directory - run: mkdir -p /target/stow - - name: Build dependencies - working-directory: /src/windows - run: make + uses: actions/checkout@v6 + - name: Docker build + run: docker build -f windows.Dockerfile -t ${{ env.IMAGE_NAME }}:${{ github.sha }} . diff --git a/downloader/downloader.py b/downloader/downloader.py index d87d610..542c0d5 100644 --- a/downloader/downloader.py +++ b/downloader/downloader.py @@ -2,7 +2,7 @@ import hashlib import os import sys -import urllib +import urllib.request, urllib.parse, urllib.error DOWNLOAD_URL = 'https://storage.googleapis.com/clementine-data.appspot.com/Build%20dependencies/' @@ -72,19 +72,12 @@ def Md5File(path): """Returns the MD5 checksum of a file, or None if it doesn't exist.""" - file_hash = hashlib.md5() try: - with open(path) as fh: - while True: - chunk = fh.read(4096) - if len(chunk) == 0: - break - file_hash.update(chunk) + with open(path, 'rb') as fh: + return hashlib.file_digest(fh, "md5").hexdigest() except IOError: return None - return file_hash.hexdigest() - def DownloadFiles(flags): # Create the output directory if it doesn't exist. @@ -103,8 +96,8 @@ def DownloadFiles(flags): if actual_md5_checksum != md5_checksum: url = DOWNLOAD_URL + name - print 'Downloading %s...' % name - urllib.urlretrieve(url, path) + print('Downloading %s...' % name) + urllib.request.urlretrieve(url, path) actual_md5_checksum = Md5File(path) # If the checksum still didn't match the download must have failed. @@ -113,7 +106,7 @@ def DownloadFiles(flags): 'Download failed - checksums do not match (got %s, expected %s)' % (actual_md5_checksum, md5_checksum)) - print 'All files are up-to-date' + print('All files are up-to-date') def Main(argv): diff --git a/makefile.common b/makefile.common index e7c0074..6eb8bbe 100644 --- a/makefile.common +++ b/makefile.common @@ -137,7 +137,7 @@ all: $(MAKE) clementine-deps clean: - realstow=`python -c "import os.path; print os.path.realpath('$(stow)')"`; \ + realstow=`python3 -c "import os.path; print os.path.realpath('$(stow)')"`; \ for path in $(stow)/*; do \ directory=`basename $$path`; \ stow -d $$realstow -D $$directory; \ @@ -148,7 +148,7 @@ clean: -rm .done-* all-downloads: - python $(src)/downloader/downloader.py --output "$(downloads)" + python3 $(src)/downloader/downloader.py --output "$(downloads)" boost: .done-boost cdio: .done-cdio diff --git a/windows.Dockerfile b/windows.Dockerfile index 46a30f7..b3e50dc 100644 --- a/windows.Dockerfile +++ b/windows.Dockerfile @@ -1,10 +1,11 @@ -FROM ubuntu:eoan +FROM ubuntu:noble RUN echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections RUN apt-get update && apt-get install -y -q \ autoconf \ bison \ + bzip2 \ cmake \ flex \ gettext \ @@ -16,15 +17,28 @@ RUN apt-get update && apt-get install -y -q \ nsis \ pkg-config \ protobuf-compiler \ - python \ + python3 \ + python3-dev \ stow \ sudo \ texinfo \ unzip \ wget \ wine-stable \ + xz-utils \ yasm RUN update-alternatives --set i686-w64-mingw32-gcc /usr/bin/i686-w64-mingw32-gcc-posix RUN update-alternatives --set i686-w64-mingw32-g++ /usr/bin/i686-w64-mingw32-g++-posix -COPY target /target + +RUN mkdir -p /src +RUN mkdir -p /target/stow + +COPY . /src +WORKDIR /src/windows + +# Separate this step to cache it before any build failures. +RUN make all-downloads + +RUN make +