From 27c5f3db8d4ac1442ea5e789bc2ada2d31f97339 Mon Sep 17 00:00:00 2001 From: umarcor Date: Wed, 17 Feb 2021 19:46:09 +0100 Subject: [PATCH 01/10] ci: enable DOCKER_BUILDKIT --- .github/workflows/verible-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/verible-ci.yml b/.github/workflows/verible-ci.yml index 3ab8f94bd..24e182e7b 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" From 5505066a2ad2e0f4586fc175917b9aeb75ffda07 Mon Sep 17 00:00:00 2001 From: umarcor Date: Wed, 17 Feb 2021 19:48:13 +0100 Subject: [PATCH 02/10] ci: style --- .github/workflows/verible-ci.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/verible-ci.yml b/.github/workflows/verible-ci.yml index 24e182e7b..e5022b7e1 100644 --- a/.github/workflows/verible-ci.yml +++ b/.github/workflows/verible-ci.yml @@ -14,8 +14,8 @@ jobs: VerifyFormatting: runs-on: ubuntu-20.04 - steps: + - name: Checkout code uses: actions/checkout@v2 with: @@ -43,6 +43,7 @@ jobs: MODE: ${{ matrix.mode }} name: Check 路 ${{ matrix.mode }} steps: + - name: Checkout code uses: actions/checkout@v2 with: @@ -83,8 +84,8 @@ jobs: Kythe: runs-on: ubuntu-20.04 - steps: + - name: Checkout code uses: actions/checkout@v2 with: @@ -117,20 +118,23 @@ 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 + name: Run 'generate_matrix.sh' run: ./.github/workflows/generate_matrix.sh @@ -178,7 +182,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" @@ -191,7 +195,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: From fa1b20113ff7f5391e60f0b4da7942e84bdfc5ce Mon Sep 17 00:00:00 2001 From: umarcor Date: Wed, 17 Feb 2021 20:58:47 +0100 Subject: [PATCH 03/10] ci: update Matrix generated args --- .github/workflows/generate_matrix.sh | 3 ++- .github/workflows/verible-ci.yml | 8 +++++--- releasing/docker-run.sh | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/generate_matrix.sh b/.github/workflows/generate_matrix.sh index 54314102d..5284e2493 100755 --- a/.github/workflows/generate_matrix.sh +++ b/.github/workflows/generate_matrix.sh @@ -17,7 +17,8 @@ set -e matrix='[' for item in releasing/*/; do - matrix+='{"os": "'"`echo $(basename $item) | cut -d- -f1`"'", "version": "'"`echo $(basename $item) | cut -d- -f2`"'"},' + _name="$(basename $item)" + matrix+="{\"os\": \"$(echo "$_name" | cut -d- -f1)\", \"ver\": \"$(echo "$_name" | cut -d- -f2)\"}," done matrix+=']' diff --git a/.github/workflows/verible-ci.yml b/.github/workflows/verible-ci.yml index e5022b7e1..276213b93 100644 --- a/.github/workflows/verible-ci.yml +++ b/.github/workflows/verible-ci.yml @@ -145,7 +145,9 @@ 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 @@ -153,14 +155,14 @@ 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 }} + ./docker-run.sh $MATRIX_OS - name: 馃摛 Upload artifact uses: actions/upload-artifact@v2 diff --git a/releasing/docker-run.sh b/releasing/docker-run.sh index 50fda5a09..eac1cdfe9 100755 --- a/releasing/docker-run.sh +++ b/releasing/docker-run.sh @@ -15,7 +15,7 @@ set -e -DIRS=${1:-$(find -mindepth 1 -maxdepth 1 -type d)} +DIRS=$( echo ${1:-$(find -mindepth 1 -maxdepth 1 -type d)} | sed 's#:#-#') export TAG=${TAG:-$(git describe --match=v*)} ./docker-generate.sh $DIRS From 23d017b2d2ad268cd4c466bea96e3d3a1c3781b5 Mon Sep 17 00:00:00 2001 From: umarcor Date: Wed, 17 Feb 2021 22:02:20 +0100 Subject: [PATCH 04/10] ci: add 'releasing/supported_bases.txt' --- .github/workflows/generate_matrix.sh | 4 ++-- releasing/centos-7/.keepme | 0 releasing/centos-8/.keepme | 0 releasing/docker-generate.sh | 2 ++ releasing/supported_bases.txt | 6 ++++++ releasing/ubuntu-bionic/.keepme | 0 releasing/ubuntu-focal/.keepme | 0 releasing/ubuntu-groovy/.keepme | 0 releasing/ubuntu-xenial/.keepme | 0 9 files changed, 10 insertions(+), 2 deletions(-) delete mode 100644 releasing/centos-7/.keepme delete mode 100644 releasing/centos-8/.keepme create mode 100644 releasing/supported_bases.txt delete mode 100644 releasing/ubuntu-bionic/.keepme delete mode 100644 releasing/ubuntu-focal/.keepme delete mode 100644 releasing/ubuntu-groovy/.keepme delete mode 100644 releasing/ubuntu-xenial/.keepme diff --git a/.github/workflows/generate_matrix.sh b/.github/workflows/generate_matrix.sh index 5284e2493..068568fb2 100755 --- a/.github/workflows/generate_matrix.sh +++ b/.github/workflows/generate_matrix.sh @@ -16,9 +16,9 @@ set -e matrix='[' -for item in releasing/*/; do +for item in $(cat $(dirname "$0")/../../releasing/supported_bases.txt); do _name="$(basename $item)" - matrix+="{\"os\": \"$(echo "$_name" | cut -d- -f1)\", \"ver\": \"$(echo "$_name" | cut -d- -f2)\"}," + matrix+="{\"os\": \"$(echo "$_name" | cut -d: -f1)\", \"ver\": \"$(echo "$_name" | cut -d: -f2)\"}," done matrix+=']' 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 index c981fbaae..45893822b 100755 --- a/releasing/docker-generate.sh +++ b/releasing/docker-generate.sh @@ -47,6 +47,7 @@ fi for UBUNTU_VERSION in xenial bionic focal groovy; do # Install basic tools # -------------------------------------------------------------- + mkdir -p ubuntu-${UBUNTU_VERSION} sed "s#ubuntu:VERSION#ubuntu:${UBUNTU_VERSION}#g" $(dirname "$0")/ubuntu.dockerfile > ubuntu-${UBUNTU_VERSION}/Dockerfile # Install compiler @@ -106,6 +107,7 @@ done for CENTOS_VERSION in 7 8; do # Install basic tools # -------------------------------------------------------------- + mkdir -p centos-${CENTOS_VERSION} sed "s#centos:VERSION#centos:${CENTOS_VERSION}#g" $(dirname "$0")/centos.dockerfile > centos-${CENTOS_VERSION}/Dockerfile # Install compiler diff --git a/releasing/supported_bases.txt b/releasing/supported_bases.txt new file mode 100644 index 000000000..c2244250b --- /dev/null +++ b/releasing/supported_bases.txt @@ -0,0 +1,6 @@ +centos:7 +centos:8 +ubuntu:bionic +ubuntu:focal +ubuntu:groovy +ubuntu:xenial diff --git a/releasing/ubuntu-bionic/.keepme b/releasing/ubuntu-bionic/.keepme deleted file mode 100644 index e69de29bb..000000000 diff --git a/releasing/ubuntu-focal/.keepme b/releasing/ubuntu-focal/.keepme deleted file mode 100644 index e69de29bb..000000000 diff --git a/releasing/ubuntu-groovy/.keepme b/releasing/ubuntu-groovy/.keepme deleted file mode 100644 index e69de29bb..000000000 diff --git a/releasing/ubuntu-xenial/.keepme b/releasing/ubuntu-xenial/.keepme deleted file mode 100644 index e69de29bb..000000000 From 866e760ee70df10c64629277268551f427391143 Mon Sep 17 00:00:00 2001 From: umarcor Date: Thu, 18 Feb 2021 00:04:44 +0100 Subject: [PATCH 05/10] releasing: merge docker-generate into docker-run --- releasing/docker-generate.sh | 265 ----------------------------------- releasing/docker-run.sh | 245 +++++++++++++++++++++++++++++++- 2 files changed, 244 insertions(+), 266 deletions(-) delete mode 100755 releasing/docker-generate.sh diff --git a/releasing/docker-generate.sh b/releasing/docker-generate.sh deleted file mode 100755 index 45893822b..000000000 --- a/releasing/docker-generate.sh +++ /dev/null @@ -1,265 +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 - # -------------------------------------------------------------- - mkdir -p ubuntu-${UBUNTU_VERSION} - 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-${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 < Date: Thu, 18 Feb 2021 00:10:28 +0100 Subject: [PATCH 06/10] releasing/docker-run: require one and only one arg --- .github/workflows/verible-ci.yml | 3 +- releasing/docker-run.sh | 90 ++++++++++++++++---------------- 2 files changed, 46 insertions(+), 47 deletions(-) diff --git a/.github/workflows/verible-ci.yml b/.github/workflows/verible-ci.yml index 276213b93..609bf2166 100644 --- a/.github/workflows/verible-ci.yml +++ b/.github/workflows/verible-ci.yml @@ -161,8 +161,7 @@ jobs: run: | set -x source ./.github/settings.sh - cd releasing - ./docker-run.sh $MATRIX_OS + ./releasing/docker-run.sh $MATRIX_OS - name: 馃摛 Upload artifact uses: actions/upload-artifact@v2 diff --git a/releasing/docker-run.sh b/releasing/docker-run.sh index 8e63427a8..fa1407c51 100755 --- a/releasing/docker-run.sh +++ b/releasing/docker-run.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright 2020 The Verible Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,7 +15,20 @@ set -e -DIRS=$( echo ${1:-$(find -mindepth 1 -maxdepth 1 -type d)} | sed 's#:#-#') +cd $(dirname "$0") + +# Get target OS and version + +if [ -z "${1}" ]; then + echo "Make sure that \$1 ($1) is set." + exit 1 +fi + +export TARGET=`echo "$1" | sed 's#:#-#g'` + +TARGET_VERSION=`echo $TARGET | cut -d- -f2` +TARGET_OS=`echo $TARGET | cut -d- -f1` + export TAG=${TAG:-$(git describe --match=v*)} REPO_SLUG=${GITHUB_REPOSITORY_SLUG:-google/verible} @@ -46,7 +59,7 @@ for UBUNTU_VERSION in xenial bionic focal groovy; do # Install basic tools # -------------------------------------------------------------- mkdir -p ubuntu-${UBUNTU_VERSION} - sed "s#ubuntu:VERSION#ubuntu:${UBUNTU_VERSION}#g" $(dirname "$0")/ubuntu.dockerfile > ubuntu-${UBUNTU_VERSION}/Dockerfile + sed "s#ubuntu:VERSION#ubuntu:${UBUNTU_VERSION}#g" ubuntu.dockerfile > ubuntu-${UBUNTU_VERSION}/Dockerfile # Install compiler # -------------------------------------------------------------- @@ -106,7 +119,7 @@ for CENTOS_VERSION in 7 8; do # Install basic tools # -------------------------------------------------------------- mkdir -p centos-${CENTOS_VERSION} - sed "s#centos:VERSION#centos:${CENTOS_VERSION}#g" $(dirname "$0")/centos.dockerfile > centos-${CENTOS_VERSION}/Dockerfile + sed "s#centos:VERSION#centos:${CENTOS_VERSION}#g" centos.dockerfile > centos-${CENTOS_VERSION}/Dockerfile # Install compiler # -------------------------------------------------------------- @@ -210,11 +223,9 @@ EOF done # ================================================================== -for DFILE in $(find -name Dockerfile); do - # Install gflags2man - # -------------------------------------------------------------- - cat >> $DFILE <> ${TARGET_OS}-${TARGET_VERSION}/Dockerfile <> $DFILE < Date: Thu, 18 Feb 2021 01:01:01 +0100 Subject: [PATCH 07/10] releasing/docker-run: use TARGET_VERSION instead of UBUNTU_VERSION and CENTOS_VERSION --- releasing/docker-run.sh | 47 ++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/releasing/docker-run.sh b/releasing/docker-run.sh index fa1407c51..87951a487 100755 --- a/releasing/docker-run.sh +++ b/releasing/docker-run.sh @@ -55,17 +55,17 @@ fi # ================================================================== # Generate the Docker files for ubuntu versions # ================================================================== -for UBUNTU_VERSION in xenial bionic focal groovy; do +if [ "$TARGET_OS" = "ubuntu" ]; then # Install basic tools # -------------------------------------------------------------- - mkdir -p ubuntu-${UBUNTU_VERSION} - sed "s#ubuntu:VERSION#ubuntu:${UBUNTU_VERSION}#g" ubuntu.dockerfile > ubuntu-${UBUNTU_VERSION}/Dockerfile + mkdir -p ubuntu-${TARGET_VERSION} + sed "s#ubuntu:VERSION#ubuntu:${TARGET_VERSION}#g" ubuntu.dockerfile > ubuntu-${TARGET_VERSION}/Dockerfile # Install compiler # -------------------------------------------------------------- - case $UBUNTU_VERSION in + case $TARGET_VERSION in xenial) - cat >> ubuntu-${UBUNTU_VERSION}/Dockerfile <> ubuntu-${TARGET_VERSION}/Dockerfile <> ubuntu-${UBUNTU_VERSION}/Dockerfile <> ubuntu-${TARGET_VERSION}/Dockerfile <> ubuntu-${UBUNTU_VERSION}/Dockerfile <> ubuntu-${TARGET_VERSION}/Dockerfile < centos-${CENTOS_VERSION}/Dockerfile + mkdir -p centos-${TARGET_VERSION} + sed "s#centos:VERSION#centos:${TARGET_VERSION}#g" centos.dockerfile > centos-${TARGET_VERSION}/Dockerfile # Install compiler # -------------------------------------------------------------- - case $CENTOS_VERSION in + case $TARGET_VERSION in 6|7) - cat >> centos-${CENTOS_VERSION}/Dockerfile <> centos-${TARGET_VERSION}/Dockerfile <> centos-${CENTOS_VERSION}/Dockerfile <> centos-${TARGET_VERSION}/Dockerfile <> centos-${CENTOS_VERSION}/Dockerfile <> centos-${TARGET_VERSION}/Dockerfile <> centos-${CENTOS_VERSION}/Dockerfile <> centos-${TARGET_VERSION}/Dockerfile <> centos-${CENTOS_VERSION}/Dockerfile <> centos-${TARGET_VERSION}/Dockerfile <> centos-${CENTOS_VERSION}/Dockerfile <> centos-${TARGET_VERSION}/Dockerfile < Date: Thu, 18 Feb 2021 02:04:44 +0100 Subject: [PATCH 08/10] releasing: split 'build.sh' from 'docker-run.sh' --- releasing/build.sh | 22 +++++++++++++++ releasing/docker-run.sh | 59 ++++++++++++++++++----------------------- 2 files changed, 48 insertions(+), 33 deletions(-) create mode 100755 releasing/build.sh diff --git a/releasing/build.sh b/releasing/build.sh new file mode 100755 index 000000000..699c9cfc3 --- /dev/null +++ b/releasing/build.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +# 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. + +set -e + +cd $(dirname "$0")/.. + +./.github/workflows/github-pages-setup.sh +./.github/workflows/github-releases-setup.sh /out diff --git a/releasing/docker-run.sh b/releasing/docker-run.sh index 87951a487..5a902b97c 100755 --- a/releasing/docker-run.sh +++ b/releasing/docker-run.sh @@ -31,11 +31,6 @@ TARGET_OS=`echo $TARGET | cut -d- -f1` export TAG=${TAG:-$(git describe --match=v*)} -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')" @@ -222,6 +217,11 @@ fi # ================================================================== +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)} + # Install gflags2man and build Verible # -------------------------------------------------------------- cat >> ${TARGET_OS}-${TARGET_VERSION}/Dockerfile < Date: Sat, 20 Feb 2021 23:48:53 +0100 Subject: [PATCH 09/10] ci: rewrite matrix generation in Python --- ...{generate_matrix.sh => generate-matrix.py} | 23 ++++++++++--------- .github/workflows/verible-ci.yml | 5 +--- 2 files changed, 13 insertions(+), 15 deletions(-) rename .github/workflows/{generate_matrix.sh => generate-matrix.py} (56%) diff --git a/.github/workflows/generate_matrix.sh b/.github/workflows/generate-matrix.py similarity index 56% rename from .github/workflows/generate_matrix.sh rename to .github/workflows/generate-matrix.py index 068568fb2..fb0bc435a 100755 --- a/.github/workflows/generate_matrix.sh +++ b/.github/workflows/generate-matrix.py @@ -1,5 +1,6 @@ -#!/usr/bin/env bash -# Copyright 2020 The Verible Authors. +#!/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. @@ -13,15 +14,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -set -e +from pathlib import Path -matrix='[' -for item in $(cat $(dirname "$0")/../../releasing/supported_bases.txt); do - _name="$(basename $item)" - matrix+="{\"os\": \"$(echo "$_name" | cut -d: -f1)\", \"ver\": \"$(echo "$_name" | cut -d: -f2)\"}," -done -matrix+=']' +matrix = [] -echo "$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] + }) -echo "::set-output name=matrix::$matrix" +print('::set-output name=matrix::' + str(matrix)) diff --git a/.github/workflows/verible-ci.yml b/.github/workflows/verible-ci.yml index 609bf2166..ea8dde1b4 100644 --- a/.github/workflows/verible-ci.yml +++ b/.github/workflows/verible-ci.yml @@ -130,12 +130,9 @@ jobs: outputs: matrix: ${{ steps.generate.outputs.matrix }} steps: - - uses: actions/checkout@v2 - - id: generate - name: Run 'generate_matrix.sh' - run: ./.github/workflows/generate_matrix.sh + run: ./.github/workflows/generate-matrix.py Build: From cac8067de7d3417ba4bd49be4bcd9c214fbbfdab Mon Sep 17 00:00:00 2001 From: Unai Martinez-Corral <38422348+umarcor@users.noreply.github.com> Date: Wed, 24 Feb 2021 19:09:26 +0000 Subject: [PATCH 10/10] update .github/workflows/verible-ci.yml Co-authored-by: Tim Ansell --- .github/workflows/verible-ci.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/verible-ci.yml b/.github/workflows/verible-ci.yml index ea8dde1b4..481a3f571 100644 --- a/.github/workflows/verible-ci.yml +++ b/.github/workflows/verible-ci.yml @@ -14,6 +14,7 @@ jobs: VerifyFormatting: runs-on: ubuntu-20.04 + steps: - name: Checkout code @@ -42,6 +43,7 @@ jobs: env: MODE: ${{ matrix.mode }} name: Check 路 ${{ matrix.mode }} + steps: - name: Checkout code @@ -84,6 +86,7 @@ jobs: Kythe: runs-on: ubuntu-20.04 + steps: - name: Checkout code @@ -129,8 +132,11 @@ jobs: name: Generate Build matrix outputs: matrix: ${{ steps.generate.outputs.matrix }} + steps: + - uses: actions/checkout@v2 + - id: generate run: ./.github/workflows/generate-matrix.py @@ -145,6 +151,7 @@ jobs: env: MATRIX_OS: '${{ matrix.os }}:${{ matrix.ver }}' name: 'Build 路 ${{ matrix.os }}:${{ matrix.ver }}' + steps: - uses: actions/checkout@v2 @@ -170,6 +177,7 @@ jobs: needs: [ Check, Build ] runs-on: ubuntu-20.04 name: 馃摝 Release + steps: - uses: actions/checkout@v2