diff --git a/.github/workflows/generate-matrix.py b/.github/workflows/generate-matrix.py new file mode 100755 index 000000000..fb0bc435a --- /dev/null +++ b/.github/workflows/generate-matrix.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 + +# Copyright 2021 The Verible Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from pathlib import Path + +matrix = [] + +with (Path(__file__).parent.resolve().parent.parent / 'releasing' / 'supported_bases.txt').open('r') as fptr: + for items in [line.strip().split(':') for line in fptr.readlines()]: + matrix.append({ + 'os': items[0], + 'ver': items[1] + }) + +print('::set-output name=matrix::' + str(matrix)) diff --git a/.github/workflows/verible-ci.yml b/.github/workflows/verible-ci.yml index 3ab8f94bd..481a3f571 100644 --- a/.github/workflows/verible-ci.yml +++ b/.github/workflows/verible-ci.yml @@ -5,6 +5,7 @@ on: pull_request: env: + DOCKER_BUILDKIT: 1 BOT_USER: "Deployment Bot" BOT_EMAIL: "verible-dev@googlegroups.com" @@ -15,6 +16,7 @@ jobs: runs-on: ubuntu-20.04 steps: + - name: Checkout code uses: actions/checkout@v2 with: @@ -41,7 +43,9 @@ jobs: env: MODE: ${{ matrix.mode }} name: Check · ${{ matrix.mode }} + steps: + - name: Checkout code uses: actions/checkout@v2 with: @@ -84,6 +88,7 @@ jobs: runs-on: ubuntu-20.04 steps: + - name: Checkout code uses: actions/checkout@v2 with: @@ -116,21 +121,24 @@ jobs: source ./.github/settings.sh ./.github/workflows/run-kythe.sh - - name: Upload Kythe output + - name: 📤 Upload Kythe output uses: actions/upload-artifact@v2 with: - name: verible-kythe-index path: kythe_output/*.kzip Matrix: runs-on: ubuntu-latest + name: Generate Build matrix outputs: matrix: ${{ steps.generate.outputs.matrix }} + steps: + - uses: actions/checkout@v2 + - id: generate - run: ./.github/workflows/generate_matrix.sh + run: ./.github/workflows/generate-matrix.py Build: @@ -140,7 +148,10 @@ jobs: fail-fast: false matrix: include: ${{ fromJson(needs.Matrix.outputs.matrix) }} - name: Build · ${{ matrix.os }} ${{ matrix.version }} + env: + MATRIX_OS: '${{ matrix.os }}:${{ matrix.ver }}' + name: 'Build · ${{ matrix.os }}:${{ matrix.ver }}' + steps: - uses: actions/checkout@v2 @@ -148,14 +159,13 @@ jobs: # Download complete repository + tags fetch-depth: 0 - - run: docker pull ${{ matrix.os }}:${{ matrix.version }} + - run: docker pull $MATRIX_OS - name: Main script run: | set -x source ./.github/settings.sh - cd releasing - ./docker-run.sh ${{ matrix.os }}-${{ matrix.version }} + ./releasing/docker-run.sh $MATRIX_OS - name: 📤 Upload artifact uses: actions/upload-artifact@v2 @@ -167,6 +177,7 @@ jobs: needs: [ Check, Build ] runs-on: ubuntu-20.04 name: 📦 Release + steps: - uses: actions/checkout@v2 @@ -177,7 +188,7 @@ jobs: - name: 📥 Download artifacts uses: actions/download-artifact@v2 - - name: After success + - name: Generate and apply TAG run: | git config --local user.name "$BOT_USER" git config --local user.email "$BOT_EMAIL" @@ -190,7 +201,7 @@ jobs: ls -lah artifact - - name: Deployment + - name: Deploy release and assets if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request' uses: svenstaro/upload-release-action@v2 with: diff --git a/.github/workflows/generate_matrix.sh b/releasing/build.sh similarity index 67% rename from .github/workflows/generate_matrix.sh rename to releasing/build.sh index 54314102d..699c9cfc3 100755 --- a/.github/workflows/generate_matrix.sh +++ b/releasing/build.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash -# Copyright 2020 The Verible Authors. + +# Copyright 2021 The Verible Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,12 +16,7 @@ set -e -matrix='[' -for item in releasing/*/; do - matrix+='{"os": "'"`echo $(basename $item) | cut -d- -f1`"'", "version": "'"`echo $(basename $item) | cut -d- -f2`"'"},' -done -matrix+=']' - -echo "$matrix" +cd $(dirname "$0")/.. -echo "::set-output name=matrix::$matrix" +./.github/workflows/github-pages-setup.sh +./.github/workflows/github-releases-setup.sh /out diff --git a/releasing/centos-7/.keepme b/releasing/centos-7/.keepme deleted file mode 100644 index e69de29bb..000000000 diff --git a/releasing/centos-8/.keepme b/releasing/centos-8/.keepme deleted file mode 100644 index e69de29bb..000000000 diff --git a/releasing/docker-generate.sh b/releasing/docker-generate.sh deleted file mode 100755 index c981fbaae..000000000 --- a/releasing/docker-generate.sh +++ /dev/null @@ -1,263 +0,0 @@ -#!/bin/bash -# Copyright 2020 The Verible Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# This script generates Dockerfile scripts to produce images used for -# releasing binary packages. - -set -e - -DIRS=${1:-$(find -mindepth 1 -maxdepth 1 -type d)} - -REPO_SLUG=${GITHUB_REPOSITORY_SLUG:-google/verible} -GIT_DATE=${GIT_DATE:-$(git show -s --format=%ci)} -GIT_VERSION=${GIT_VERSION:-$(git describe --match=v*)} -GIT_HASH=${GIT_HASH:-$(git rev-parse HEAD)} - -if [ -z "${BAZEL_VERSION}" ]; then - echo "Make sure that \$BAZEL_VERSION ($BAZEL_VERSION) is set." - echo " (try 'source ../.github/settings.sh')" - exit 1 -fi -if [ -z "${BAZEL_OPTS}" ]; then - echo "Make sure that \$BAZEL_OPTS ($BAZEL_OPTS) is set." - echo " (try 'source ../.github/settings.sh')" - exit 1 -fi -if [ -z "${BAZEL_CXXOPTS}" ]; then - echo "Make sure that \$BAZEL_CXXOPTS ($BAZEL_CXXOPTS) is set." - echo " (try 'source ../.github/settings.sh')" - exit 1 -fi - -# ================================================================== -# Generate the Docker files for ubuntu versions -# ================================================================== -for UBUNTU_VERSION in xenial bionic focal groovy; do - # Install basic tools - # -------------------------------------------------------------- - sed "s#ubuntu:VERSION#ubuntu:${UBUNTU_VERSION}#g" $(dirname "$0")/ubuntu.dockerfile > ubuntu-${UBUNTU_VERSION}/Dockerfile - - # Install compiler - # -------------------------------------------------------------- - case $UBUNTU_VERSION in - xenial) - cat >> ubuntu-${UBUNTU_VERSION}/Dockerfile <> ubuntu-${UBUNTU_VERSION}/Dockerfile <> ubuntu-${UBUNTU_VERSION}/Dockerfile < centos-${CENTOS_VERSION}/Dockerfile - - # Install compiler - # -------------------------------------------------------------- - case $CENTOS_VERSION in - 6|7) - cat >> centos-${CENTOS_VERSION}/Dockerfile <> centos-${CENTOS_VERSION}/Dockerfile <> centos-${CENTOS_VERSION}/Dockerfile <> centos-${CENTOS_VERSION}/Dockerfile <> centos-${CENTOS_VERSION}/Dockerfile <> centos-${CENTOS_VERSION}/Dockerfile <> $DFILE <> $DFILE < ubuntu-${TARGET_VERSION}/Dockerfile + + # Install compiler + # -------------------------------------------------------------- + case $TARGET_VERSION in + xenial) + cat >> ubuntu-${TARGET_VERSION}/Dockerfile <> ubuntu-${TARGET_VERSION}/Dockerfile <> ubuntu-${TARGET_VERSION}/Dockerfile < centos-${TARGET_VERSION}/Dockerfile + + # Install compiler + # -------------------------------------------------------------- + case $TARGET_VERSION in + 6|7) + cat >> centos-${TARGET_VERSION}/Dockerfile <> centos-${TARGET_VERSION}/Dockerfile <> centos-${TARGET_VERSION}/Dockerfile <> centos-${TARGET_VERSION}/Dockerfile <> centos-${TARGET_VERSION}/Dockerfile <> centos-${TARGET_VERSION}/Dockerfile <> ${TARGET_OS}-${TARGET_VERSION}/Dockerfile <