diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 06e265af5..39eb13f05 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -86,7 +86,7 @@ jobs: - name: Install Python dependencies run: | - pip install pixl_core/[test] + pip install pixl_core/[test] - name: Run tests working-directory: pixl_core/tests @@ -143,10 +143,33 @@ jobs: ehr-api-tests: runs-on: ubuntu-22.04 - timeout-minutes: 15 + timeout-minutes: 30 steps: - uses: actions/checkout@v3 + - uses: docker/setup-buildx-action@v3 + # pre-build and cache the postgres container as installing python3 takes a while, doesn't push + - name: Cache Docker layers + uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + - uses: docker/build-push-action@v5 + with: + context: . + file: docker/postgres/Dockerfile + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max + - # Temp fix + # https://github.com/docker/build-push-action/issues/252 + # https://github.com/moby/buildkit/issues/1896 + name: Move cache + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache + - name: Init Python uses: actions/setup-python@v4 with: @@ -184,11 +207,35 @@ jobs: ./run-tests.sh system-test: + if: '! github.event.pull_request.draft' runs-on: ubuntu-22.04 - timeout-minutes: 15 + timeout-minutes: 30 steps: - uses: actions/checkout@v3 + - uses: docker/setup-buildx-action@v3 + # pre-build and cache the postgres container as installing python3 takes a while, doesn't push + - name: Cache Docker layers + uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + - uses: docker/build-push-action@v5 + with: + context: . + file: docker/postgres/Dockerfile + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max + - # Temp fix + # https://github.com/docker/build-push-action/issues/252 + # https://github.com/moby/buildkit/issues/1896 + name: Move cache + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache + - name: Init Python uses: actions/setup-python@v4 with: diff --git a/docker/postgres/Dockerfile b/docker/postgres/Dockerfile index cd7c09e57..6ab7dde5a 100644 --- a/docker/postgres/Dockerfile +++ b/docker/postgres/Dockerfile @@ -20,9 +20,12 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* RUN sed -i '/en_GB.UTF-8/s/^# //g' /etc/locale.gen && locale-gen -RUN wget https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz && \ - tar -xvf Python-3.10.0.tgz && \ - cd Python-3.10.0 && \ + +ADD https://www.python.org/ftp/python/3.10.13/Python-3.10.13.tgz /pixl/python/ + +RUN cd /pixl/python/ && \ + tar -xvf Python-3.10.13.tgz && \ + cd Python-3.10.13 && \ ./configure --enable-optimizations && \ make -j 2 && \ make altinstall