Minor improvements to GitHub CI (#3994)

* Logging for ci/actions/linux/install_deps.sh

* Add logging to ci/build-docker-image.sh

* Also publish docker nanocurrency-env:centos

* Upgrade actions/checkout to v3.1.0 to fix deprecation warnings.

The current method will stop working in some months.
https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

* Update actions/setup-python to v4.3.0 to avoid warning about set-Output

* Rename Tests workflow to Unit Tests

* Rename Develop workflow to Develop Branch Dockers Deploy
This commit is contained in:
Dimitrios Siganos 2022-11-11 10:56:01 +02:00 committed by GitHub
commit ff3cf18816
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 32 additions and 20 deletions

View file

@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-20.04
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0
- name: Installing clang-format 12
env:
DEBIAN_FRONTEND: noninteractive
@ -19,8 +19,8 @@ jobs:
runs-on: ubuntu-20.04
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e
- uses: actions/setup-python@41b7212b1668f5de9d65e9c82aa777e6bbedb3a8
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0
- uses: actions/setup-python@13ae5bb136fac2878aff31522b9efb785519f984 #v4.3.0
with:
python-version: '3.x'
architecture: 'x64'
@ -35,6 +35,6 @@ jobs:
runs-on: ubuntu-20.04
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0
- name: Run code-inspector
run: ci/code-inspector-check.sh

View file

@ -25,7 +25,7 @@ jobs:
continue-on-error: true
timeout-minutes: 60
steps:
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0
with:
submodules: "recursive"
- name: Fetch Deps

View file

@ -1,4 +1,4 @@
name: Develop
name: Develop Branch Dockers Deploy
on:
push:
@ -9,7 +9,7 @@ jobs:
linux_job:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0
with:
submodules: "recursive"
- name: Fetch Deps

View file

@ -24,7 +24,7 @@ jobs:
- name: tag
run: |
echo "TAG=${{ github.event.inputs.ref }}" >> $GITHUB_ENV
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0
with:
submodules: "recursive"
ref: ${{ github.event.inputs.ref }}
@ -48,7 +48,7 @@ jobs:
- name: tag
run: |
echo "TAG=${{ github.event.inputs.ref }}" >> $GITHUB_ENV
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0
with:
submodules: "recursive"
ref: ${{ github.event.inputs.ref }}
@ -74,7 +74,7 @@ jobs:
- name: tag
run: |
echo "TAG=${{ github.event.inputs.ref }}" >> $GITHUB_ENV
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0
with:
submodules: "recursive"
ref: ${{ github.event.inputs.ref }}
@ -106,7 +106,7 @@ jobs:
- name: tag
run: |
Write-Output "TAG=${{ github.event.inputs.ref }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0
with:
submodules: "recursive"
ref: ${{ github.event.inputs.ref }}

View file

@ -1,4 +1,4 @@
name: Tests
name: Unit Tests
on: [push, pull_request]
@ -22,7 +22,7 @@ jobs:
runs-on: macOS-11
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0
with:
submodules: "recursive"
- name: Fetch Deps
@ -55,7 +55,7 @@ jobs:
RELEASE: ${{ matrix.RELEASE }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0
with:
submodules: "recursive"
- name: Fetch Deps
@ -87,7 +87,7 @@ jobs:
RELEASE: ${{ matrix.RELEASE }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0
with:
submodules: "recursive"
- name: Windows Defender

View file

@ -26,7 +26,7 @@ elif [[ "$GITHUB_WORKFLOW" = "Test" ]]; then
network="test"
fi
if [[ "$GITHUB_WORKFLOW" != "Develop" ]]; then
if [[ "$GITHUB_WORKFLOW" != "Develop Branch Dockers Deploy" ]]; then
docker_image_name="nanocurrency/nano${network_tag_suffix}"
fi
@ -37,7 +37,7 @@ docker_build()
ci_version_pre_release="$CI_VERSION_PRE_RELEASE"
fi
if [[ "$GITHUB_WORKFLOW" != "Develop" ]]; then
if [[ "$GITHUB_WORKFLOW" != "Develop Branch Dockers Deploy" ]]; then
ghcr_image_name="ghcr.io/${GITHUB_REPOSITORY}/nano${network_tag_suffix}"
"$scripts"/build-docker-image.sh docker/node/Dockerfile "$docker_image_name" --build-arg NETWORK="$network" --build-arg CI_BUILD=true --build-arg CI_VERSION_PRE_RELEASE="$ci_version_pre_release" --build-arg CI_TAG="$CI_TAG"
for tag in "${tags[@]}"; do
@ -56,7 +56,7 @@ docker_deploy()
{
if [ -n "$DOCKER_PASSWORD" ]; then
echo "$DOCKER_PASSWORD" | docker login -u nanoreleaseteam --password-stdin
if [[ "$GITHUB_WORKFLOW" = "Develop" ]]; then
if [[ "$GITHUB_WORKFLOW" = "Develop Branch Dockers Deploy" ]]; then
"$scripts"/custom-timeout.sh 30 docker push "nanocurrency/nano-env:base"
"$scripts"/custom-timeout.sh 30 docker push "nanocurrency/nano-env:gcc"
"$scripts"/custom-timeout.sh 30 docker push "nanocurrency/nano-env:clang"

View file

@ -2,10 +2,11 @@
set -e
scripts="$PWD/ci"
if [[ "$GITHUB_WORKFLOW" = "Develop" ]]; then
if [[ "$GITHUB_WORKFLOW" = "Develop Branch Dockers Deploy" ]]; then
"$scripts"/custom-timeout.sh 30 docker push "ghcr.io/${GITHUB_REPOSITORY}/nano-env:base"
"$scripts"/custom-timeout.sh 30 docker push "ghcr.io/${GITHUB_REPOSITORY}/nano-env:gcc"
"$scripts"/custom-timeout.sh 30 docker push "ghcr.io/${GITHUB_REPOSITORY}/nano-env:clang"
"$scripts"/custom-timeout.sh 30 docker push "ghcr.io/${GITHUB_REPOSITORY}/nano-env:centos"
else
tags=$(docker images --format '{{.Repository}}:{{.Tag }}' | grep "ghcr.io" | grep -vE "env|none")
for a in $tags; do

View file

@ -1,5 +1,9 @@
#!/bin/bash
set -x
echo "Script ci/actions/linux/install_deps.sh starting COMPILER=\"$COMPILER\""
# This enables IPv6 support in docker, needed to run node tests inside docker container
sudo mkdir -p /etc/docker && echo '{"ipv6":true,"fixed-cidr-v6":"2001:db8:1::/64"}' | sudo tee /etc/docker/daemon.json && sudo service docker restart
@ -11,3 +15,5 @@ else
ci/build-docker-image.sh docker/ci/Dockerfile-clang nanocurrency/nano-env:clang
ci/build-docker-image.sh docker/ci/Dockerfile-centos nanocurrency/nano-env:centos
fi
echo "Script ci/actions/linux/install_deps.sh finished"

View file

@ -1,5 +1,5 @@
#!/bin/bash
set -u
set -u -x
if [ "$#" -lt 2 ]; then
echo 'Usage: build-docker-image.sh <dockerFile> <dockerImageTag> [<dockerBuildArgs>...]' >&2
@ -12,10 +12,15 @@ githubTag="ghcr.io/${GITHUB_REPOSITORY}/${dockerTag#*/}"
shift
shift
echo "ci/build-docker-image.sh dockerFile=\"$dockerFile\" dockerTag=\"$dockerTag\" githubTag=\"$githubTag\""
scripts="$(dirname "$0")"
echo "Pulling $githubTag"
"$scripts"/custom-timeout.sh 20 docker pull "${githubTag}" || true
echo "Building $githubTag"
"$scripts"/custom-timeout.sh 30 docker build "$@" --build-arg REPOSITORY=${GITHUB_REPOSITORY} -f "${dockerFile}" -t "${githubTag}" --cache-from "${githubTag}" .
echo "Tagging ${dockerTag} from ${githubTag}"
docker tag $githubTag $dockerTag