Skip to content

Commit

Permalink
Upd: Switch to docker actions and add caching
Browse files Browse the repository at this point in the history
  • Loading branch information
bokysan committed May 29, 2021
1 parent 13bdabe commit 4d0e7b9
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 8 deletions.
25 changes: 21 additions & 4 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,20 @@ jobs:
echo "RELEASE_VERSION=${GITHUB_REF:10}" >> $GITHUB_ENV
- name: Run unit tests
run: ./unit-tests.sh

- name: Set up Docker Buildx
id: buildx
uses: crazy-max/ghaction-docker-buildx@v1
uses: docker/setup-buildx-action@master

- name: Cache Docker layers
uses: actions/cache@v2
with:
buildx-version: latest
path: /tmp/.buildx-cache
key: ${{ runner.os }}-single-buildx-${{ hashFiles('**/Dockerfile') }}
#key: ${{ runner.os }}-single-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-single-buildx-
- name: Run integration tests
shell: bash
env: # Or as an environment variable
Expand All @@ -36,17 +45,25 @@ jobs:
echo "XOAUTH2_INITIAL_REFRESH_TOKEN=${XOAUTH2_INITIAL_REFRESH_TOKEN}" >> integration-tests/xoauth2/.env
cp integration-tests/xoauth2/.env integration-tests/xoauth2-error/.env
./integration-tests.sh
- name: Run HELM chart tests
run: ./helm/tests.sh

- name: Build Alpine master
env:
DOCKER_USERNAME: 'boky'
DOCKER_PASSWORD: '${{ secrets.DOCKER_ACCESS_TOKEN }}'
PLATFORMS: "linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le" # linux/s390x: "rsyslog (no such package)"
run: ./build.sh -t boky/postfix:latest --push
run: ./build.sh -t boky/postfix:latest --cache-from "type=local,src=/tmp/.buildx-cache" --cache-to "type=local,dest=/tmp/.buildx-cache-new" --push

- name: Build Ubuntu master
env:
DOCKER_USERNAME: 'boky'
DOCKER_PASSWORD: '${{ secrets.DOCKER_ACCESS_TOKEN }}'
PLATFORMS: "linux/amd64,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x"
run: ./build.sh -t boky/postfix:ubuntu-latest --build-arg=BASE_IMAGE=ubuntu:focal --push
run: ./build.sh -t boky/postfix:ubuntu-latest --cache-from "type=local,src=/tmp/.buildx-cache" --cache-to "type=local,dest=/tmp/.buildx-cache-new" --build-arg=BASE_IMAGE=ubuntu:focal --push

- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
24 changes: 20 additions & 4 deletions .github/workflows/tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,39 @@ jobs:
run: |
echo "RELEASE_VERSION=${GITHUB_REF:10}" >> $GITHUB_ENV
echo "::set-output name=RELEASE_VERSION::${GITHUB_REF:10}"
- name: Set up Docker Buildx
id: buildx
uses: crazy-max/ghaction-docker-buildx@v1
uses: docker/setup-buildx-action@master

- name: Cache Docker layers
uses: actions/cache@v2
with:
buildx-version: latest
path: /tmp/.buildx-cache
key: ${{ runner.os }}-single-buildx-${{ hashFiles('**/Dockerfile') }}
#key: ${{ runner.os }}-single-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-single-buildx-
- name: Build Alpine tag
env:
DOCKER_USERNAME: 'boky'
DOCKER_PASSWORD: '${{ secrets.DOCKER_ACCESS_TOKEN }}'
PLATFORMS: "linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le"
run: ./build.sh -t boky/postfix:$RELEASE_VERSION --push
run: ./build.sh -t boky/postfix:$RELEASE_VERSION --cache-from "type=local,src=/tmp/.buildx-cache" --cache-to "type=local,dest=/tmp/.buildx-cache-new" --push

- name: Build Ubuntu tag
env:
DOCKER_USERNAME: 'boky'
DOCKER_PASSWORD: '${{ secrets.DOCKER_ACCESS_TOKEN }}'
PLATFORMS: "linux/amd64,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x"
run: ./build.sh -t boky/postfix:ubuntu-$RELEASE_VERSION --build-arg=BASE_IMAGE=ubuntu:focal --push
run: ./build.sh -t boky/postfix:ubuntu-$RELEASE_VERSION --cache-from "type=local,src=/tmp/.buildx-cache" --cache-to "type=local,dest=/tmp/.buildx-cache-new" --build-arg=BASE_IMAGE=ubuntu:focal --push

- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: Copy `README.md` and `LICENCE` into the helm chart
id: readme_and_licence
shell: bash
Expand Down

0 comments on commit 4d0e7b9

Please sign in to comment.