Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: split workflow #15

Merged
merged 1 commit into from
Aug 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
200 changes: 18 additions & 182 deletions .github/workflows/build_upload.yml
Original file line number Diff line number Diff line change
@@ -1,187 +1,23 @@
name: build for test/release
name: build and upload

on:
create:
tags:
- '**'
pull_request:
branches:
- master
push:
branches:
- master
- test*
workflow_dispatch:
branches: ['prep/**', 'release/**', 'test/**', master]
tags: ['**']

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: 'true'
fetch-depth: '0'

- name: vars
id: vars
run: |
export bin=bin
export commit=$(git rev-parse HEAD)
export short=$(git rev-parse --short HEAD)
export github_tag=${{github.ref_name}}
export tag=$github_tag
export branch=$github_tag
export git_message=$(git rev-list --format=%s --max-count=1 HEAD | tail +2)
export repo_name=chain-ro
export artifact_name=${repo_name}_$(git rev-parse --short HEAD).tar.gz
export pub_method=pushTest
export job_url=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID
export oss_exists=0
export ftp_exists=0
export rx='^v([0-9]+\.){0,2}(\*|[0-9]+)(-rc[0-9]*){0,1}$'
if [[ "${{github.ref_type}}" == "tag" ]] && [[ "${{github.event_name}}" == "create" ]] && [[ "$github_tag" =~ $rx ]]; then
export pub_method=pushRelease
fi

if [[ "${{secrets.OSS_KEY_ID}}" != "" && \
"${{secrets.OSS_KEY_SECRET}}" != "" && \
"${{secrets.OSS_ENDPOINT}}" != "" && \
"${{secrets.OSS_BUCKET}}" != "" ]]; then
export oss_exists=1
fi
if [[ "${{secrets.FTP_HOST}}" != "" ]]; then
export ftp_exists=1
fi
echo "::set-output name=bin::$bin"
echo "::set-output name=commit::$commit"
echo "::set-output name=short::$short"
echo "::set-output name=github_tag::$github_tag"
echo "::set-output name=git_message::$git_message"
echo "::set-output name=repo_name::$repo_name"
echo "::set-output name=branch::$branch"
echo "::set-output name=tag::$tag"
echo "::set-output name=artifact_name::$artifact_name"
echo "::set-output name=job_url::$job_url"
echo "::set-output name=pub_method::$pub_method"
echo "::set-output name=oss_exists::$oss_exists"
echo "::set-output name=ftp_exists::$ftp_exists"

- name: show environment
run: |
echo bin = ${{steps.vars.outputs.bin}}
echo event = ${{github.event_name}}
echo github_repository: $GITHUB_REPOSITORY
echo vars.commit = ${{steps.vars.outputs.commit}}
echo vars.short_commit = ${{steps.vars.outputs.short}}
echo vars.github_tag = ${{steps.vars.outputs.github_tag}}
echo vars.git_message = "${{steps.vars.outputs.git_message}}"
echo vars.repo_name = ${{steps.vars.outputs.repo_name}}
echo vars.branch = ${{steps.vars.outputs.branch}}
echo vars.tag = ${{steps.vars.outputs.tag}}
echo vars.artifact_name = ${{steps.vars.outputs.artifact_name}}
echo vars.pub_method = ${{steps.vars.outputs.pub_method}}
echo secrets.godeye_url = ${{ secrets.GODEYE_URL }}
echo vars.oss_exists = ${{steps.vars.outputs.oss_exists}}
echo vars.ftp_exists = ${{steps.vars.outputs.ftp_exists}}
echo github.ref = ${{github.ref}}
echo github.ref_name = ${{github.ref_name}}
echo vars.job_url = ${{steps.vars.outputs.job_url}}
echo ftp_url = ftp://${{secrets.FTP_HOST}}/${{steps.vars.outputs.repo_name}}/${{steps.vars.outputs.artifact_name}}

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17

- name: Install GCC
uses: egor-tensin/setup-gcc@v1
with:
version: latest
platform: x64

- name: Setup Rust
run: (sudo apt-get update && sudo apt-get install -y clang libssl-dev && which cargo && which rustc) || (curl https://sh.rustup.rs -sSf | sh -s -- -y)

- name: install deps
run: sudo apt-get install make ncftp mesa-opencl-icd ocl-icd-opencl-dev gcc git bzr jq pkg-config curl clang build-essential hwloc libhwloc-dev wget -y && sudo apt upgrade -y

- name: Build
run: |
make build
mkdir ./${{steps.vars.outputs.bin}} && mv ./${{steps.vars.outputs.repo_name}} ./${{steps.vars.outputs.bin}}

- name: Zip Release
uses: TheDoctor0/zip-release@0.6.0
with:
filename: ${{steps.vars.outputs.artifact_name}}
path: ./${{steps.vars.outputs.bin}}
type: tar

- name: release
id: release
uses: ncipollo/release-action@v1
if: ${{ steps.vars.outputs.pub_method=='pushRelease' }}
continue-on-error: true
with:
artifacts: ${{steps.vars.outputs.artifact_name}}
tag: ${{ steps.vars.outputs.github_tag }}
commit: ${{ steps.vars.outputs.commit }}
token: ${{ secrets.GITHUB_TOKEN }}

- name: upload ftp
id: uploadftp
if: ${{ steps.vars.outputs.ftp_exists == '1' }}
continue-on-error: true
run: |
ncftpput -m -R -v -u ${{secrets.FTP_USER}} -p ${{secrets.FTP_PWD}} ${{secrets.FTP_HOST}} ./${{steps.vars.outputs.repo_name}} ./${{steps.vars.outputs.artifact_name}}
echo "upload file: ${{steps.vars.outputs.artifact_name}} successfully!"

- name: setup oss
id: setuposs
if: ${{ steps.vars.outputs.oss_exists == '1' && steps.uploadftp.outcome != 'success' && steps.vars.outputs.pub_method == 'pushTest' }}
continue-on-error: true
uses: manyuanrong/setup-ossutil@master
with:
endpoint: ${{secrets.OSS_ENDPOINT}}
access-key-id: ${{ secrets.OSS_KEY_ID }}
access-key-secret: ${{ secrets.OSS_KEY_SECRET }}

- name: cp files to aliyun
id: cposs
if: ${{ steps.setuposs.outcome == 'success' }}
continue-on-error: true
run: |
ossutil cp ./${{steps.vars.outputs.artifact_name}} ${{secrets.OSS_BUCKET}}
export signed_url=`ossutil sign ${{secrets.OSS_BUCKET}}/${{steps.vars.outputs.artifact_name}} --timeout 31104000 | sed -n 1p`
echo '::set-output name=oss_signed_url::$(signed_url)'

- name: upload artifacts
if: ${{ steps.vars.outputs.pub_method == 'pushRelease' }}
continue-on-error: true
uses: actions/upload-artifact@v2
with:
name: ${{steps.vars.outputs.artifact_name}}
path: ./${{steps.vars.outputs.bin}}
if-no-files-found: error

- name: push god-eye
run: |
export link=${{steps.vars.outputs.job_url}}
if [[ "${{ steps.release.outcome }}" == "success" ]]; then
export link=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/download/${{steps.vars.outputs.github_tag}}/${{steps.vars.outputs.artifact_name}}
elif [[ "${{ steps.uploadftp.outcome }}" == "success" ]]; then
export link=ftp://${{secrets.FTP_HOST}}/${{steps.vars.outputs.repo_name}}/${{steps.vars.outputs.artifact_name}}
elif [[ "${{ steps.cposs.outcome }}" == "success" ]]; then
export link=${{steps.cposs.outputs.oss_signed_url}}
fi
echo download target file : $link
set +e
curl --max-time 20 -X PUT ${{secrets.GODEYE_URL}}/${{steps.vars.outputs.pub_method}} \
--data-urlencode "type=1" \
--data-urlencode "commitId=${{steps.vars.outputs.commit}}" \
--data-urlencode "branch=${{steps.vars.outputs.branch}}" \
--data-urlencode "programName=${{steps.vars.outputs.repo_name}}" \
--data-urlencode "link=$link" \
--data-urlencode "description=message:${{steps.vars.outputs.git_message}}, branch:${{steps.vars.outputs.branch}}, commit:${{steps.vars.outputs.short}}, tag:${{steps.vars.outputs.github_tag}}" \
--data-urlencode "version=${{steps.vars.outputs.short}}"
set -e
build_upload:
uses: filecoin-project/venus/.github/workflows/common_build_upload.yml@master
with:
bin_name: 'chain-ro'
has_ffi: true
secrets:
OSS_KEY_ID: ${{secrets.OSS_KEY_ID}}
OSS_KEY_SECRET: ${{secrets.OSS_KEY_SECRET}}
OSS_ENDPOINT: ${{secrets.OSS_ENDPOINT}}
OSS_BUCKET: ${{secrets.OSS_BUCKET}}
FTP_HOST: ${{secrets.FTP_HOST}}
FTP_USER: ${{secrets.FTP_USER}}
FTP_PWD: ${{secrets.FTP_PWD}}
GODEYE_URL: ${{secrets.GODEYE_URL}}
token: ${{github.token}}
13 changes: 13 additions & 0 deletions .github/workflows/docker_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Docker Image CI

on:
push:
branches: ['prep/**', 'release/**', 'test/**', master]
tags: ['**']

jobs:

build_docker_image:
uses: filecoin-project/venus/.github/workflows/common_docker_image.yml@master
secrets:
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
38 changes: 4 additions & 34 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,7 @@ on:
- master

jobs:

build:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17

- name: Install GCC
uses: egor-tensin/setup-gcc@v1
with:
version: latest
platform: x64

- name: Setup Rust
run: (sudo apt-get update && sudo apt-get install -y clang libssl-dev && which cargo && which rustc) || (curl https://sh.rustup.rs -sSf | sh -s -- -y)

- name: install deps
run: sudo apt-get install make ftp mesa-opencl-icd ocl-icd-opencl-dev gcc git bzr jq pkg-config curl clang build-essential hwloc libhwloc-dev wget -y && sudo apt upgrade -y

- name: Build
env:
GOPROXY: "https://proxy.golang.org,direct"
GO111MODULE: "on"
run: |
git submodule update --init --recursive
cd extern/filecoin-ffi && ./install-filcrypto && cd ../../
go build ./...

- name: Test
run: go test -v ./...
check:
uses: filecoin-project/venus/.github/workflows/common_go.yml@master
with:
has_ffi: true
40 changes: 0 additions & 40 deletions .github/workflows/golangci-lint.yml

This file was deleted.