From fb305eddb27cb29f1cd24df248d22778a0863e00 Mon Sep 17 00:00:00 2001 From: Anna Prosvetova Date: Sun, 25 Jul 2021 14:46:34 +0300 Subject: [PATCH] CI: Fix branch artifacts naming and submodules in the linter (#605) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix branch artifacts naming * Port submodules fix from build.yml * Github: port decontamination to python lint action * Github: skip decontamination on non existing repos * Github: skip submodules python lint Co-authored-by: あく --- .github/workflows/build.yml | 9 ++++++--- .github/workflows/lint_c.yml | 15 +++++++++------ .github/workflows/lint_python.yml | 24 +++++++++++++++++++++--- 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7f8653b0..5bf231fe 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,8 +14,11 @@ jobs: - name: 'Decontaminate previous build leftovers' run: | - git submodule status \ - || git checkout `git rev-list --max-parents=0 HEAD | tail -n 1` + if [ -d .git ] + then + git submodule status \ + || git checkout `git rev-list --max-parents=0 HEAD | tail -n 1` + fi - name: 'Checkout code' uses: actions/checkout@v2 @@ -44,7 +47,7 @@ jobs: - name: 'Generate branch suffix' if: startsWith(github.ref, 'refs/tags/') != true - run: echo "SUFFIX=$(date +'%Y-%m-%d')-$(git rev-parse --short HEAD)" >> $GITHUB_ENV + run: echo "SUFFIX=$(git rev-parse --abbrev-ref HEAD)-$(date +'%d%m%Y')-$(git rev-parse --short HEAD)" >> $GITHUB_ENV - name: 'Build bootloader in docker' uses: ./.github/actions/docker diff --git a/.github/workflows/lint_c.yml b/.github/workflows/lint_c.yml index e1955a7e..f4c0ce5a 100644 --- a/.github/workflows/lint_c.yml +++ b/.github/workflows/lint_c.yml @@ -12,16 +12,19 @@ jobs: - name: 'Cleanup workspace' uses: AutoModality/action-clean@v1 + - name: 'Decontaminate previous build leftovers' + run: | + if [ -d .git ] + then + git submodule status \ + || git checkout `git rev-list --max-parents=0 HEAD | tail -n 1` + fi + - name: 'Checkout code' uses: actions/checkout@v2 with: fetch-depth: 0 - - - name: 'Checkout submodules: update' - run: git submodule update --init --recursive - - - name: 'Checkout submodules: sync' - run: git submodule sync + submodules: true - name: 'Docker cache' uses: satackey/action-docker-layer-caching@v0.0.11 diff --git a/.github/workflows/lint_python.yml b/.github/workflows/lint_python.yml index dc0fefd1..adff291e 100644 --- a/.github/workflows/lint_python.yml +++ b/.github/workflows/lint_python.yml @@ -10,6 +10,24 @@ jobs: lint_python: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - - uses: psf/black@20.8b1 + - name: 'Cleanup workspace' + uses: AutoModality/action-clean@v1 + + - name: 'Decontaminate previous build leftovers' + run: | + if [ -d .git ] + then + git submodule status \ + || git checkout `git rev-list --max-parents=0 HEAD | tail -n 1` + fi + + - name: 'Checkout code' + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: 'Setup python' + uses: actions/setup-python@v2 + + - name: 'Check python code with black' + uses: psf/black@20.8b1