summaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
authorLukas Larsson <lukas@erlang.org>2021-01-20 13:31:59 +0100
committerLukas Larsson <lukas@erlang.org>2021-01-20 13:31:59 +0100
commit7b8a8a46cc4fa56c28e52b65c8ee89d5a900e180 (patch)
treef7700d339fd7a8d9b7ddcbbc9e919e9fcfcd16dc /.github
parent0d8d1a1f5c9e8aee70189c5e588479d5e25b85cc (diff)
parent883e70011fa0130f24ac1fac704e759009bd2dea (diff)
downloaderlang-7b8a8a46cc4fa56c28e52b65c8ee89d5a900e180.tar.gz
Merge branch 'maint'
Diffstat (limited to '.github')
-rwxr-xr-x.github/scripts/base-tag20
-rw-r--r--.github/workflows/main.yaml51
-rw-r--r--.github/workflows/update-base.yaml60
3 files changed, 72 insertions, 59 deletions
diff --git a/.github/scripts/base-tag b/.github/scripts/base-tag
new file mode 100755
index 0000000000..994192e6d2
--- /dev/null
+++ b/.github/scripts/base-tag
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+set -x
+
+case "$1" in
+ *i386-debian-base)
+ BASE=i386/debian
+ BASE_TYPE=debian-base
+ ;;
+ *debian-base)
+ BASE="debian"
+ BASE_TYPE=debian-base
+ ;;
+ *ubuntu-base)
+ BASE="debian"
+ BASE_TYPE=ubuntu-base
+ ;;
+esac
+echo "::set-output name=BASE::${BASE}"
+echo "::set-output name=BASE_TYPE::${BASE_TYPE}"
diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml
index 5e64d6fb9a..55e6d43085 100644
--- a/.github/workflows/main.yaml
+++ b/.github/workflows/main.yaml
@@ -10,6 +10,12 @@
## Also once the windows runner supports WSL we should implement
## support for building Erlang/OTP here.
##
+## When ghcr.io support using the GITHUB_TOKEN we should migrate
+## over to use it instead as that should allow us to use the
+## built-in caching mechanisms of docker/build-push-action@v2.
+## However as things are now we manually pull the correct image
+## from docker.pkg.github.com
+##
name: Build and check Erlang/OTP
@@ -48,39 +54,38 @@ jobs:
uses: actions/download-artifact@v2
with:
name: otp_git_archive
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v1
+ with:
+ driver: docker
## We need to login to the package registry in order to pull
## the base debian image.
- name: Docker login
- run: docker login https://docker.pkg.github.com -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }}
- - name: Build base image
+ uses: docker/login-action@v1
+ with:
+ registry: docker.pkg.github.com
+ username: ${{ github.repository_owner }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+ - name: Calculate BASE image
+ id: base
run: |
BASE_TAG=$(grep "^FROM" .github/dockerfiles/Dockerfile.${{ matrix.type }} | head -1 | awk '{print $2}')
- docker pull "${BASE_TAG}"
- case "${BASE_TAG}" in
- */i386-debian-base)
- docker build -t "${BASE_TAG}" \
- --build-arg BASE=i386/debian -f .github/dockerfiles/Dockerfile.debian-base .
- ;;
- */debian-base)
- docker build -t "${BASE_TAG}" \
- -f .github/dockerfiles/Dockerfile.debian-base .
- ;;
- */ubuntu-base)
- docker build -t "${BASE_TAG}" \
- -f .github/dockerfiles/Dockerfile.ubuntu-base .
- ;;
- esac
-
+ echo "::set-output name=BASE_TAG::${BASE_TAG}"
+ .github/scripts/base-tag "${BASE_TAG}"
+ - name: Pull BASE image
+ run: docker pull ${{ steps.base.outputs.BASE_TAG }}
- name: Build ${{ matrix.type }} image
- run: |
- docker build -t otp --build-arg ARCHIVE=otp_src.tar.gz \
- -f .github/dockerfiles/Dockerfile.${{ matrix.type }} .
+ uses: docker/build-push-action@v2
+ with:
+ context: .
+ tags: otp:latest
+ file: .github/dockerfiles/Dockerfile.${{ matrix.type }}
+ build-args: ARCHIVE=otp_src.tar.gz
## Smoke build tests
- if: matrix.type == '32-bit' || matrix.type == '64-bit' || matrix.type == 'cross-compile'
name: Run smoke test
- run: |
- docker run -v $PWD/scripts:/scripts otp "cd /tests && /scripts/run-smoke-tests"
+ run: docker run -v $PWD/scripts:/scripts otp "cd /tests && /scripts/run-smoke-tests"
## Documentation checks
- if: matrix.type == 'documentation'
diff --git a/.github/workflows/update-base.yaml b/.github/workflows/update-base.yaml
index 8da36c8b69..3aac8db052 100644
--- a/.github/workflows/update-base.yaml
+++ b/.github/workflows/update-base.yaml
@@ -10,48 +10,36 @@ on:
## Build base images to be used by other github workflows
jobs:
- build-debian-64bit:
+ build:
+ name: Update base Erlang/OTP build images
if: github.repository == 'erlang/otp'
runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v2
- - name: Build and push 64-bit base image
- uses: docker/build-push-action@v1
- with:
- username: ${{ github.actor }}
- password: ${{ secrets.GITHUB_TOKEN }}
- registry: docker.pkg.github.com
- dockerfile: .github/dockerfiles/Dockerfile.debian-base
- repository: erlang/otp/debian-base
- tags: latest
- build-debian-32bit:
- if: github.repository == 'erlang/otp'
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v2
- - name: Build and push 32-bit base image
- uses: docker/build-push-action@v1
- with:
- username: ${{ github.actor }}
- password: ${{ secrets.GITHUB_TOKEN }}
- registry: docker.pkg.github.com
- dockerfile: .github/dockerfiles/Dockerfile.debian-base
- build_args: "BASE=i386/debian"
- repository: erlang/otp/i386-debian-base
- tags: latest
+ strategy:
+ matrix:
+ type: [debian-base,ubuntu-base,i386-debian-base]
- build-ubuntu-64bit:
- if: github.repository == 'erlang/otp'
- runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- - name: Build and push 64-bit base image
- uses: docker/build-push-action@v1
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v1
+ with:
+ driver: docker
+ - name: Docker login
+ uses: docker/login-action@v1
with:
+ registry: docker.pkg.github.com
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- registry: docker.pkg.github.com
- dockerfile: .github/dockerfiles/Dockerfile.ubuntu-base
- repository: erlang/otp/ubuntu-base
- tags: latest
+ - name: Calculate BASE image
+ id: base
+ run: .github/scripts/base-tag "${{ matrix.type }}"
+ - name: Build and push base image
+ uses: docker/build-push-action@v2
+ with:
+ context: .
+ file: .github/dockerfiles/Dockerfile.${{ steps.base.outputs.BASE_TYPE }}
+ pull: true
+ push: true
+ build-args: BASE=${{ steps.base.outputs.BASE }}
+ tags: docker.pkg.github.com/${{ github.repository }}/${{ matrix.type }}:latest