From 60ced6cf4debc14c1d23808e015027f787314458 Mon Sep 17 00:00:00 2001 From: HAOYUatHZ <37070449+HAOYUatHZ@users.noreply.github.com> Date: Thu, 20 Apr 2023 18:12:46 +0800 Subject: [PATCH] build: remove jenkins scripts (#295) * update github workflow * update github workflow * update github workflow --- .github/workflows/l2geth_ci.yml | 49 ++++++++++++++--- build/jenkins/Jenkinsfile | 65 ----------------------- build/jenkins/push-docker-tag.Jenkinsfile | 61 --------------------- 3 files changed, 41 insertions(+), 134 deletions(-) delete mode 100644 build/jenkins/Jenkinsfile delete mode 100644 build/jenkins/push-docker-tag.Jenkinsfile diff --git a/.github/workflows/l2geth_ci.yml b/.github/workflows/l2geth_ci.yml index be75afce68..127aa2a7bc 100644 --- a/.github/workflows/l2geth_ci.yml +++ b/.github/workflows/l2geth_ci.yml @@ -1,6 +1,30 @@ -on: [pull_request] -name: Continuous Integration +on: + push: + branches: + - main + - staging + - develop + - alpha + pull_request: + branches: + - main + - staging + - develop + - alpha +name: CI jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: 1.18.x + - name: Checkout code + uses: actions/checkout@v2 + - name: Build + run: | + make geth check: runs-on: ubuntu-latest steps: @@ -14,12 +38,6 @@ jobs: run: | rm -rf $HOME/.cache/golangci-lint make lint - - name: Test - run: | - go get ./... - make test - - name: Upload coverage report - run: bash <(curl -s https://codecov.io/bash) goimports-lint: runs-on: ubuntu-latest steps: @@ -39,3 +57,18 @@ jobs: if [ -n "$(git status --porcelain)" ]; then exit 1 fi + test: + runs-on: ubuntu-latest + steps: + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: 1.18.x + - name: Checkout code + uses: actions/checkout@v2 + - name: Test + run: | + go get ./... + make test + - name: Upload coverage report + run: bash <(curl -s https://codecov.io/bash) diff --git a/build/jenkins/Jenkinsfile b/build/jenkins/Jenkinsfile deleted file mode 100644 index e58ff57dc6..0000000000 --- a/build/jenkins/Jenkinsfile +++ /dev/null @@ -1,65 +0,0 @@ -pipeline { - agent any - tools { - go 'go-1.18' - } - environment { - GO111MODULE = 'on' - } - stages { - stage('Build') { - steps { - // Get some code from a GitHub repository - - // git branch: 'zkrollup', - // credentialsId: 'testgitchuhan1', - // url: 'git@github.com:scroll-tech/go-ethereum.git' - - // Build the app. - sh 'go build' - - } - - } - stage('Test') { - // Use golang. - steps { - // Remove cached test results. - sh 'go clean -cache' - // Run Unit Tests. - sh 'make test' - } - } - - stage('Docker') { - environment { - // Extract the username and password of our credentials into "DOCKER_CREDENTIALS_USR" and "DOCKER_CREDENTIALS_PSW". - // (NOTE 1: DOCKER_CREDENTIALS will be set to "your_username:your_password".) - // The new variables will always be YOUR_VARIABLE_NAME + _USR and _PSW. - // (NOTE 2: You can't print credentials in the pipeline for security reasons.) - DOCKER_CREDENTIALS = credentials('dockerhub') - } - - steps { - // Use a scripted pipeline. - script { - def app - // stage('Initialize') { - // def dockerHome = tool 'myDocker' - // env.PATH = "${dockerHome}/bin:${env.PATH}" - // } - - stage('Build image') { - app = docker.build("${env.DOCKER_CREDENTIALS_USR}/l2geth-img") - } - - } - } - } - } - post { - always { - cleanWs() - } - } -} \ No newline at end of file diff --git a/build/jenkins/push-docker-tag.Jenkinsfile b/build/jenkins/push-docker-tag.Jenkinsfile deleted file mode 100644 index 78d3abeacf..0000000000 --- a/build/jenkins/push-docker-tag.Jenkinsfile +++ /dev/null @@ -1,61 +0,0 @@ -credentialDocker = 'dockerhub' - -pipeline { - agent any - options { - timeout (20) - } - tools { - go 'go-1.18' - nodejs "nodejs" - } - environment { - GO111MODULE = 'on' - PATH="/home/ubuntu/.cargo/bin:$PATH" - // LOG_DOCKER = 'true' - } - stages { - stage('Tag') { - steps { - script { - TAGNAME = sh(returnStdout: true, script: 'git tag -l --points-at HEAD') - sh "echo ${TAGNAME}" - // ... - } - } - } - stage('Build') { - environment { - DOCKER_CREDENTIALS = credentials('dockerhub') - } - steps { - withCredentials([usernamePassword(credentialsId: "${credentialDocker}", passwordVariable: 'dockerPassword', usernameVariable: 'dockerUser')]) { - // Use a scripted pipeline. - script { - stage('Push image') { - if (TAGNAME == ""){ - return; - } - sh "docker login --username=${dockerUser} --password=${dockerPassword}" - sh "docker build -t scrolltech/l2geth:latest ." - sh "docker tag scrolltech/l2geth:latest scrolltech/l2geth:${TAGNAME}" - sh "docker push scrolltech/l2geth:${TAGNAME}" - } - } - } - } - } - } - post { - success { - slackSend(message: "l2geth tag ${TAGNAME} build dockersSuccessed") - } - // triggered when red sign - failure { - slackSend(message: "l2geth tag ${TAGNAME} build docker failed") - } - always { - cleanWs() - } - } -}