Skip to content

Commit

Permalink
Merge pull request #4756 from pwojcikdev/github-actions-update
Browse files Browse the repository at this point in the history
GitHub workflow updates
  • Loading branch information
pwojcikdev authored Oct 17, 2024
2 parents 9ff68c1 + c440cc1 commit 55e9065
Show file tree
Hide file tree
Showing 17 changed files with 74 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .github/actions/restore-git-mtimes/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: "Restore file modification timestamps from git commit timestamps"
runs:
using: "composite"
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
repository: "MestreLion/git-tools"
ref: a42a069bc755f0fa81316965335cb33dbf22a968 # pin latest commit
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/analyzers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0
uses: actions/checkout@v4

- name: Installing clang-format
env:
Expand All @@ -28,7 +28,7 @@ jobs:
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@13ae5bb136fac2878aff31522b9efb785519f984 #v4.3.0
Expand All @@ -50,6 +50,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@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0
- uses: actions/checkout@v4
- name: Run code-inspector
run: ci/code-inspector-check.sh
42 changes: 30 additions & 12 deletions .github/workflows/build_deploy.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Build & Deploy
on:
schedule:
- cron: "0 0 * * 3,6"
- cron: "0 0 * * 3,6" # Every Wednesday and Saturday at 00:00
workflow_dispatch:
inputs:
is_release_build:
Expand All @@ -14,27 +14,31 @@ env:

jobs:
prepare_build:
name: Prepare Build
runs-on: ubuntu-22.04
outputs:
ci_tag: ${{ steps.set_vars.outputs.ci_tag }}
tag_created: ${{ steps.set_vars.outputs.tag_created }}
steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0
- name: Checkout
uses: actions/checkout@v4

- name: Set the tag and version
id: tag_set
run: |
ci/actions/generate_next_git_tag.sh -c
env:
GITHUB_ACTOR: ${{ github.actor }}
IS_RELEASE_BUILD: ${{ github.event.inputs.is_release_build || 'false' }}

- name: Set output
id: set_vars
run: |
echo "ci_tag=$CI_TAG" >> $GITHUB_OUTPUT
echo "tag_created=$TAG_CREATED" >> $GITHUB_OUTPUT
osx_job:
name: macOS [${{ matrix.network }}]
needs: prepare_build
if: ${{ needs.prepare_build.outputs.tag_created == 'true' }}
runs-on: macOS-14
Expand All @@ -43,19 +47,22 @@ jobs:
matrix:
network: ["TEST", "BETA", "LIVE"]
steps:

- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0
- name: Checkout
uses: actions/checkout@v4
with:
submodules: "recursive"
ref: ${{ needs.prepare_build.outputs.ci_tag }}
repository: ${{ github.repository }}

- name: Prepare
run: ci/prepare/macos/prepare.sh

- name: Build Artifact
run: ci/build-deploy.sh "/tmp/qt/lib/cmake/Qt5";
env:
NETWORK: ${{ matrix.network }}
CI_TAG: ${{ needs.prepare_build.outputs.ci_tag }}

- name: Deploy Artifact
run: ci/actions/deploy.sh
env:
Expand All @@ -66,9 +73,9 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-2


linux_job:
name: Linux [${{ matrix.network }}]
needs: prepare_build
if: ${{ needs.prepare_build.outputs.tag_created == 'true' }}
runs-on: ubuntu-22.04
Expand All @@ -77,13 +84,16 @@ jobs:
matrix:
network: ["TEST", "BETA", "LIVE"]
steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0
- name: Checkout
uses: actions/checkout@v4
with:
submodules: "recursive"
ref: ${{ needs.prepare_build.outputs.ci_tag }}
repository: ${{ github.repository }}

- name: Prepare
run: sudo -E ci/prepare/linux/prepare.sh

- name: Build Artifact
run: ci/build-deploy.sh "/usr/lib/x86_64-linux-gnu/cmake/Qt5"
env:
Expand All @@ -101,8 +111,8 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-2


linux_docker_job:
name: Docker [${{ matrix.network }}]
needs: prepare_build
if: ${{ needs.prepare_build.outputs.tag_created == 'true' }}
runs-on: ubuntu-22.04
Expand All @@ -117,21 +127,25 @@ jobs:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
IS_RELEASE_BUILD: ${{ github.event.inputs.is_release_build || 'false' }}
steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0
- name: Checkout
uses: actions/checkout@v4
with:
submodules: "recursive"
ref: ${{ needs.prepare_build.outputs.ci_tag }}
repository: ${{ github.repository }}

- name: Build Docker
run: ci/actions/linux/docker-build.sh
env:
NETWORK: ${{ matrix.network }}
- name: Deploy Docker Hub

- name: Deploy Docker (Docker Hub)
if: env.DOCKER_PASSWORD != ''
run: ci/actions/linux/docker-deploy.sh
env:
NETWORK: ${{ matrix.network }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}

- name: Deploy Docker (ghcr.io)
run: ci/actions/linux/ghcr-deploy.sh
env:
Expand All @@ -140,8 +154,8 @@ jobs:
DOCKER_USER: ${{ github.repository_owner }}
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}


windows_job:
name: Windows [${{ matrix.network }}]
needs: prepare_build
if: ${{ needs.prepare_build.outputs.tag_created == 'true' }}
runs-on: windows-latest
Expand All @@ -150,18 +164,22 @@ jobs:
matrix:
network: ["TEST", "BETA", "LIVE"]
steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0
- name: Checkout
uses: actions/checkout@v4
with:
submodules: "recursive"
ref: ${{ needs.prepare_build.outputs.ci_tag }}
repository: ${{ github.repository }}

- name: Prepare
run: ci/prepare/windows/prepare.ps1

- name: Build Artifact
run: ci/actions/windows/build.ps1
env:
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}

- name: Deploy Artifact
run: ci/actions/windows/deploy.ps1
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
echo "REPO_TO_RUN=${{ github.event.inputs.repo }}" >> $GITHUB_ENV
echo "MODE=${{ github.event.inputs.mode }}" >> $GITHUB_ENV
- name: Checks out the required workflow files (workflow repo)
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
repository: ${{ github.repository }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/code_sanitizers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: "recursive"

Expand Down Expand Up @@ -91,7 +91,7 @@ jobs:
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: "recursive"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
continue-on-error: true
timeout-minutes: 60
steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0
- uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Fetch Deps
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/develop_branch_dockers_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
linux_job:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0
- uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Fetch Deps
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/flamegraphs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: "recursive"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prepare_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v3.1.0
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
fetch-depth: 0
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: "recursive"

Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: "recursive"

Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: "recursive"

Expand Down
12 changes: 5 additions & 7 deletions ci/actions/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ case "${NETWORK}" in
esac

if [[ -n "${S3_BUILD_DIRECTORY}" ]]; then


DIRECTORY="${S3_BUILD_DIRECTORY}/${BUILD}"
else
DIRECTORY=$BUILD
Expand All @@ -33,7 +31,7 @@ if [[ "$OS" == 'Linux' && "$IS_RPM_DEPLOY" -eq "1" ]]; then

for rpm in $RPMS; do
SHA=$(sha256sum ${rpm})
echo "Hash: $SHA"
echo "::notice::Hash: $SHA"
echo $SHA > ${GITHUB_WORKSPACE}/$(basename "${rpm}.sha256")

aws s3 cp ${rpm} s3://${S3_BUCKET_NAME}/$DIRECTORY/binaries/$(basename "${rpm}") --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers
Expand All @@ -42,19 +40,19 @@ if [[ "$OS" == 'Linux' && "$IS_RPM_DEPLOY" -eq "1" ]]; then

for srpm in $SRPMS; do
SHA=$(sha256sum ${srpm})
echo "Hash: $SHA"
echo "::notice::Hash: $SHA"
echo $SHA > ${GITHUB_WORKSPACE}/$(basename "${srpm}).sha256")

aws s3 cp ${srpm} s3://${S3_BUCKET_NAME}/$DIRECTORY/source/$(basename "${srpm}") --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers
aws s3 cp ${GITHUB_WORKSPACE}/$(basename "${srpm}).sha256") s3://${S3_BUCKET_NAME}/$DIRECTORY/source/$(basename "${srpm}.sha256") --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers
done
elif [[ "$OS" == 'Linux' ]]; then
SHA=$(sha256sum $GITHUB_WORKSPACE/build/nano-node-*-Linux.tar.bz2)
echo "Hash: $SHA"
echo "::notice::Hash: $SHA"
echo $SHA >$GITHUB_WORKSPACE/nano-node-$TAG-Linux.tar.bz2.sha256

SHA=$(sha256sum $GITHUB_WORKSPACE/build/nano-node-*-Linux.deb)
echo "Hash: $SHA"
echo "::notice::Hash: $SHA"
echo $SHA >$GITHUB_WORKSPACE/nano-node-$TAG-Linux.deb.sha256

aws s3 cp $GITHUB_WORKSPACE/build/nano-node-*-Linux.tar.bz2 s3://${S3_BUCKET_NAME}/$DIRECTORY/binaries/nano-node-$TAG-Linux.tar.bz2 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers
Expand All @@ -63,7 +61,7 @@ elif [[ "$OS" == 'Linux' ]]; then
aws s3 cp $GITHUB_WORKSPACE/nano-node-$TAG-Linux.deb.sha256 s3://${S3_BUCKET_NAME}/$DIRECTORY/binaries/nano-node-$TAG-Linux.deb.sha256 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers
else
SHA=$(sha256sum $GITHUB_WORKSPACE/build/nano-node-*-Darwin.dmg)
echo "Hash: $SHA"
echo "::notice::Hash: $SHA"
echo $SHA >$GITHUB_WORKSPACE/build/nano-node-$TAG-Darwin.dmg.sha256

aws s3 cp $GITHUB_WORKSPACE/build/nano-node-*-Darwin.dmg s3://${S3_BUCKET_NAME}/$DIRECTORY/binaries/nano-node-$TAG-Darwin.dmg --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers
Expand Down
17 changes: 16 additions & 1 deletion ci/actions/linux/docker-impl/docker-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,22 @@ docker_login()
push_docker_image()
{
local image_name=$1

# Log the image name before pushing
echo "Pushing image: $image_name"

# Push the image
"$scripts"/custom-timeout.sh 30 docker push "$image_name"

# After pushing, get the digest from the local image manifest
local digest
digest=$(docker image inspect --format='{{index .RepoDigests 0}}' "$image_name")

if [ -n "$digest" ]; then
echo "::notice::Hash: $digest $image_name"
else
echo "::error::Could not retrieve digest for image $image_name"
fi
}

deploy_env_images()
Expand All @@ -154,7 +169,7 @@ deploy_tags()
local exclude_pattern=$2
local tags=$(docker images --format '{{.Repository}}:{{.Tag }}' | grep "$repo" | grep -vE "$exclude_pattern")

#Debug list all tags
# Debug list all tags
docker images --format '{{.Repository}}:{{.Tag }}'

for tag in $tags; do
Expand Down
4 changes: 2 additions & 2 deletions ci/actions/windows/deploy.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ $zip_hash = ((Get-FileHash $zip).hash)+" "+(split-path -Path $zip -Resolve -leaf
$exe_hash | Out-file -FilePath "$exe.sha256"
$zip_hash | Out-file -FilePath "$zip.sha256"

Write-Output "Hash: $exe_hash"
Write-Output "Hash: $zip_hash"
Write-Output "::notice::Hash: $exe_hash"
Write-Output "::notice::Hash: $zip_hash"

aws s3 cp "$exe" s3://$env:S3_BUCKET_NAME/$directory/binaries/nano-node-$env:TAG-win64.exe --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers
aws s3 cp "$exe.sha256" s3://$env:S3_BUCKET_NAME/$directory/binaries/nano-node-$env:TAG-win64.exe.sha256 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers
Expand Down
Loading

0 comments on commit 55e9065

Please sign in to comment.