Configure a build matrix for GCC using containers.

Change-Id: If11de0c2056ebb6c2db6ec0388ed2f1f2e494d48
Reviewed-on: https://code-review.googlesource.com/c/re2/+/57797
Reviewed-by: Paul Wankadia <junyer@google.com>
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 52f7c75..d51fb5c 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -2,15 +2,28 @@
 on:
   push:
     branches: [master]
-env:
-  CC: clang
-  CXX: clang++
 jobs:
-  build:
+  build-clang:
     runs-on: ${{ matrix.os }}
     strategy:
       matrix:
         os: [macos-latest, ubuntu-latest]
+    env:
+      CC: clang
+      CXX: clang++
+    steps:
+    - uses: actions/checkout@v2
+    - run: make && make test
+      shell: bash
+  build-gcc:
+    runs-on: ubuntu-latest
+    container: gcc:${{ matrix.tag }}
+    strategy:
+      matrix:
+        tag: [4, 5, 6, 7, 8, 9, 10]
+    env:
+      CC: gcc
+      CXX: g++
     steps:
     - uses: actions/checkout@v2
     - run: make && make test