Skip to content

Commit

Permalink
Optimize Docker caching
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeymakinen committed Nov 13, 2021
1 parent 6808659 commit 55d2b7e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,26 @@ jobs:
- ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
- name: Start strongswan containers
- name: Start and wait for libreswan containers
run: |
for i in {1..10}; do
echo $i:
docker-compose -f testdata/docker/strongswan/docker-compose.yml exec -T moon /bin/sh -c 'ipsec statusall || true' | grep '64 bytes_i' && break || (docker-compose -f testdata/docker/strongswan/docker-compose.yml up -d --force-recreate && sleep 30)
docker-compose -f testdata/docker/libreswan/docker-compose.yml exec -T moon /bin/sh -c 'ipsec status || true' | grep 'ESPin=84B' && break || (docker-compose -f testdata/docker/libreswan/docker-compose.yml up -d --force-recreate && sleep 30)
done
docker-compose -f testdata/docker/strongswan/docker-compose.yml exec -T moon /bin/sh -c 'ipsec statusall || true'
- name: Start libreswan containers
docker-compose -f testdata/docker/libreswan/docker-compose.yml exec -T moon /bin/sh -c 'ipsec status || true'
- name: Start and wait for strongswan containers
run: |
for i in {1..10}; do
echo $i:
docker-compose -f testdata/docker/libreswan/docker-compose.yml exec -T moon /bin/sh -c 'ipsec status || true' | grep 'ESPin=84B' && break || (docker-compose -f testdata/docker/libreswan/docker-compose.yml up -d --force-recreate && sleep 30)
docker-compose -f testdata/docker/strongswan/docker-compose.yml exec -T moon /bin/sh -c 'ipsec statusall || true' | grep '64 bytes_i' && break || (docker-compose -f testdata/docker/strongswan/docker-compose.yml up -d --force-recreate && sleep 30)
done
docker-compose -f testdata/docker/libreswan/docker-compose.yml exec -T moon /bin/sh -c 'ipsec status || true'
docker-compose -f testdata/docker/strongswan/docker-compose.yml exec -T moon /bin/sh -c 'ipsec statusall || true'
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Test
run: go test -coverprofile=coverage.txt -covermode=atomic ./...
- name: Upload coverage to Codecov
Expand Down
8 changes: 7 additions & 1 deletion testdata/docker/libreswan/moon/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@ FROM debian:bullseye

RUN set -x \
&& apt-get update \
&& apt-get install -y libreswan iputils-ping \
&& apt-get install -y libreswan \
&& rm -rf /var/lib/apt/lists/* \
&& set +x

RUN mkdir -p /run/pluto

RUN set -x \
&& apt-get update \
&& apt-get install -y iputils-ping \
&& rm -rf /var/lib/apt/lists/* \
&& set +x

COPY rootfs /

ENTRYPOINT ["/docker-entrypoint.sh"]
8 changes: 7 additions & 1 deletion testdata/docker/strongswan/moon/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ FROM debian:bullseye

RUN set -x \
&& apt-get update \
&& apt-get install -y iputils-ping strongswan-charon strongswan-swanctl \
&& apt-get install -y strongswan-charon strongswan-swanctl \
&& rm -rf /var/lib/apt/lists/* \
&& set +x

RUN set -x \
&& apt-get update \
&& apt-get install -y iputils-ping \
&& rm -rf /var/lib/apt/lists/* \
&& set +x

Expand Down

0 comments on commit 55d2b7e

Please sign in to comment.