Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce CI time #208

Merged
merged 11 commits into from
Jan 5, 2024
53 changes: 50 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
9 changes: 6 additions & 3 deletions docker/postgres/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down