From a9f45dee2b052f2cd29a563e828834c444c1f84e Mon Sep 17 00:00:00 2001 From: Quentin Le Sceller Date: Fri, 26 Jan 2024 07:58:52 -0500 Subject: [PATCH] Remove Azure Pipelines and add Github Actions (#3765) * Remove Azure Pipelines and add Github Actions * Trigger CI on push and pull request --- .ci/general-jobs | 28 ------------- .ci/release.yml | 54 ------------------------ .ci/test.yml | 14 ------- .ci/windows-release.yml | 58 -------------------------- .github/workflows/cd.yaml | 73 ++++++++++++++++++++++++++++++++ .github/workflows/ci.yaml | 33 +++++++++++++++ azure-pipelines.yml | 87 --------------------------------------- 7 files changed, 106 insertions(+), 241 deletions(-) delete mode 100755 .ci/general-jobs delete mode 100644 .ci/release.yml delete mode 100644 .ci/test.yml delete mode 100644 .ci/windows-release.yml create mode 100644 .github/workflows/cd.yaml create mode 100644 .github/workflows/ci.yaml delete mode 100644 azure-pipelines.yml diff --git a/.ci/general-jobs b/.ci/general-jobs deleted file mode 100755 index 4945ed3829..0000000000 --- a/.ci/general-jobs +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash - -# Copyright 2021 The Grin Developers -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# This script contains general jobs. - -case "${CI_JOB}" in - "test") - for dir in ${CI_JOB_ARGS}; do - printf "executing tests in directory \`%s\`...\n" "${dir}" - cd "${dir}" && \ - cargo test --release && \ - cd - > /dev/null || exit 1 - done - ;; -esac diff --git a/.ci/release.yml b/.ci/release.yml deleted file mode 100644 index 23fd71c4cf..0000000000 --- a/.ci/release.yml +++ /dev/null @@ -1,54 +0,0 @@ -steps: - - script: 'cargo test --all' - displayName: Cargo Test All - condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' )) - - script: | - cargo clean - cargo build --release - env: - ROARING_ARCH: x86-64-v2 - displayName: Build Release - condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' )) - - script: | - MY_TAG="$(Build.SourceBranch)" - MY_TAG=${MY_TAG#refs/tags/} - echo $MY_TAG - echo "##vso[task.setvariable variable=build.my_tag]$MY_TAG" - echo "##vso[task.setvariable variable=build.platform]$PLATFORM" - displayName: "Create my tag variable" - condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' )) - - task: CopyFiles@2 - displayName: Copy assets - condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' )) - inputs: - sourceFolder: '$(Build.SourcesDirectory)/target/release' - contents: 'grin' - targetFolder: '$(Build.BinariesDirectory)/grin' - - task: ArchiveFiles@2 - displayName: Gather assets - condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' )) - inputs: - rootFolderOrFile: '$(Build.BinariesDirectory)/grin' - archiveType: 'tar' - tarCompression: 'gz' - archiveFile: '$(Build.ArtifactStagingDirectory)/grin-$(build.my_tag)-$(build.platform).tar.gz' - - script: | - cd $(Build.ArtifactStagingDirectory) && openssl sha256 grin-$(build.my_tag)-$(build.platform).tar.gz > grin-$(build.my_tag)-$(build.platform)-sha256sum.txt - displayName: Create Checksum - condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' )) - - task: GithubRelease@0 - displayName: Github release - condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' )) - inputs: - gitHubConnection: 'quentinlesceller' - repositoryName: 'mimblewimble/grin' - action: 'edit' - target: '$(build.sourceVersion)' - tagSource: 'manual' - tag: '$(build.my_tag)' - assets: | - $(Build.ArtifactStagingDirectory)/grin-$(build.my_tag)-$(build.platform).tar.gz - $(Build.ArtifactStagingDirectory)/grin-$(build.my_tag)-$(build.platform)-sha256sum.txt - title: '$(build.my_tag)' - assetUploadMode: 'replace' - addChangeLog: true \ No newline at end of file diff --git a/.ci/test.yml b/.ci/test.yml deleted file mode 100644 index fbab8cb4d5..0000000000 --- a/.ci/test.yml +++ /dev/null @@ -1,14 +0,0 @@ -steps: - - script: 'refreshenv && cargo test --all' - env: - LIBCLANG_PATH: C:\Program Files\LLVM\lib - LLVM_CONFIG_PATH: C:\Program Files\LLVM\bin\llvm-config - ROARING_ARCH: x86-64-v2 - displayName: Windows Cargo Test - condition: and(eq( variables['Agent.OS'], 'Windows_NT' ), eq( variables['CI_JOB'], 'test-all' )) - - script: 'ROARING_ARCH=x86-64-v2 cargo test --all' - displayName: macOS Cargo Test - condition: and(eq( variables['Agent.OS'], 'Darwin' ), eq( variables['CI_JOB'], 'test-all' )) - - script: 'ROARING_ARCH=x86-64-v2 .ci/general-jobs' - displayName: Linux Cargo Test - condition: eq( variables['Agent.OS'], 'Linux' ) \ No newline at end of file diff --git a/.ci/windows-release.yml b/.ci/windows-release.yml deleted file mode 100644 index 387e5891a6..0000000000 --- a/.ci/windows-release.yml +++ /dev/null @@ -1,58 +0,0 @@ -steps: - - script: 'refreshenv && cargo test --all' - env: - LIBCLANG_PATH: C:\Program Files\LLVM\lib - LLVM_CONFIG_PATH: C:\Program Files\LLVM\bin\llvm-config - ROARING_ARCH: x86-64-v2 - displayName: Cargo Test All - condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' )) - - script: 'refreshenv && cargo clean && cargo build --release' - env: - LIBCLANG_PATH: C:\Program Files\LLVM\lib - LLVM_CONFIG_PATH: C:\Program Files\LLVM\bin\llvm-config - ROARING_ARCH: x86-64-v2 - displayName: Build Release - condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' )) - - script: | - SET MY_TAG=$(Build.SourceBranch) - SET MY_TAG=%MY_TAG:~10% - echo %MY_TAG% - echo %PLATFORM% - echo ##vso[task.setvariable variable=build.my_tag]%MY_TAG% - echo ##vso[task.setvariable variable=build.platform]%PLATFORM% - displayName: "Create my tag variable" - condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' )) - - task: CopyFiles@2 - displayName: Copy assets - condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' )) - inputs: - sourceFolder: '$(Build.SourcesDirectory)\target\release' - contents: 'grin.exe' - targetFolder: '$(Build.BinariesDirectory)\grin' - - task: ArchiveFiles@2 - displayName: Gather assets - condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' )) - inputs: - rootFolderOrFile: '$(Build.BinariesDirectory)\grin' - archiveType: 'zip' - archiveFile: '$(Build.ArtifactStagingDirectory)\grin-$(build.my_tag)-$(build.platform).zip' - - script: | - powershell -Command "cd $(Build.ArtifactStagingDirectory); get-filehash -algorithm sha256 grin-$(build.my_tag)-$(build.platform).zip | Format-List | Out-String | ForEach-Object { $_.Trim() } > grin-$(build.my_tag)-$(build.platform)-sha256sum.txt" - displayName: Create Checksum - condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' )) - - task: GithubRelease@0 - displayName: Github release - condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' )) - inputs: - gitHubConnection: 'quentinlesceller' - repositoryName: 'mimblewimble/grin' - action: 'edit' - target: '$(build.sourceVersion)' - tagSource: 'manual' - tag: '$(build.my_tag)' - assets: | - $(Build.ArtifactStagingDirectory)\grin-$(build.my_tag)-$(build.platform).zip - $(Build.ArtifactStagingDirectory)\grin-$(build.my_tag)-$(build.platform)-sha256sum.txt - title: '$(build.my_tag)' - assetUploadMode: 'replace' - addChangeLog: true diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml new file mode 100644 index 0000000000..d753c9ad95 --- /dev/null +++ b/.github/workflows/cd.yaml @@ -0,0 +1,73 @@ +name: Continuous Deployment + +on: + push: + tags: + - "v*.*.*" + +jobs: + linux-release: + name: Linux Release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Build + run: cargo build --release + - name: Archive + working-directory: target/release + run: tar -czvf grin-${{ github.ref_name }}-linux-x86_64.tar.gz grin + - name: Create Checksum + working-directory: target/release + run: openssl sha256 grin-${{ github.ref_name }}-linux-x86_64.tar.gz > grin-${{ github.ref_name }}-linux-x86_64-sha256sum.txt + - name: Release + uses: softprops/action-gh-release@v1 + with: + generate_release_notes: true + files: | + target/release/grin-${{ github.ref_name }}-linux-x86_64.tar.gz + target/release/grin-${{ github.ref_name }}-linux-x86_64-sha256sum.txt + + macos-release: + name: macOS Release + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Build + run: cargo build --release + - name: Archive + working-directory: target/release + run: tar -czvf grin-${{ github.ref_name }}-macos-x86_64.tar.gz grin + - name: Create Checksum + working-directory: target/release + run: openssl sha256 grin-${{ github.ref_name }}-macos-x86_64.tar.gz > grin-${{ github.ref_name }}-macos-x86_64-sha256sum.txt + - name: Release + uses: softprops/action-gh-release@v1 + with: + files: | + target/release/grin-${{ github.ref_name }}-macos-x86_64.tar.gz + target/release/grin-${{ github.ref_name }}-macos-x86_64-sha256sum.txt + + windows-release: + name: Windows Release + runs-on: windows-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Build + run: cargo build --release + - name: Archive + uses: vimtor/action-zip@v1 + with: + files: target/release/grin.exe + dest: target/release/grin-${{ github.ref_name }}-win-x86_64.zip + - name: Create Checksum + working-directory: target/release + shell: pwsh + run: get-filehash -algorithm sha256 grin-${{ github.ref_name }}-win-x86_64.zip | Format-List |  Out-String | ForEach-Object { $_.Trim() } > grin-${{ github.ref_name }}-win-x86_64-sha256sum.txt + - name: Release + uses: softprops/action-gh-release@v1 + with: + files: | + target/release/grin-${{ github.ref_name }}-win-x86_64.zip + target/release/grin-${{ github.ref_name }}-win-x86_64-sha256sum.txt \ No newline at end of file diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000000..d1ebb62c44 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,33 @@ +name: Continuous Integration +on: [push, pull_request] + +jobs: + linux-tests: + name: Linux Tests + runs-on: ubuntu-latest + strategy: + matrix: + job_args: [servers, chain, core, keychain, pool, p2p, src, api, util, store] + steps: + - uses: actions/checkout@v3 + - name: Test ${{ matrix.job_args }} + working-directory: ${{ matrix.job_args }} + run: cargo test --release + + macos-tests: + name: macOS Tests + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Tests + run: cargo test --release --all + + windows-tests: + name: Windows Tests + runs-on: windows-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Tests + run: cargo test --release --all \ No newline at end of file diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 488b6d0fb6..0000000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,87 +0,0 @@ -# Copyright 2021 The Grin Developers -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -trigger: - branches: - include: - - master - - milestone/* - tags: - include: ['*'] - -pr: - branches: - include: ['*'] - -variables: - RUST_BACKTRACE: '1' - RUSTFLAGS: '-C debug-assertions' - -jobs: -- job: linux - pool: - vmImage: ubuntu-22.04 - strategy: - matrix: - servers: - CI_JOB: test - CI_JOB_ARGS: servers - chain/core/keychain: - CI_JOB: test - CI_JOB_ARGS: chain core keychain - pool/p2p/src: - CI_JOB: test - CI_JOB_ARGS: pool p2p src - api/util/store: - CI_JOB: test - CI_JOB_ARGS: api util store - release: - CI_JOB: release - PLATFORM: linux-amd64 - steps: - - script: | - sudo apt-get update -yqq - sudo apt-get install -yqq --no-install-recommends libncursesw5-dev - displayName: Linux Install Dependencies - - template: '.ci/test.yml' - - template: '.ci/release.yml' -- job: macos - pool: - vmImage: macos-latest - strategy: - matrix: - test: - CI_JOB: test-all - release: - CI_JOB: release - PLATFORM: macos - steps: - - template: '.ci/test.yml' - - template: '.ci/release.yml' -- job: windows - pool: - vmImage: windows-latest - strategy: - matrix: - test: - CI_JOB: test-all - release: - CI_JOB: release - PLATFORM: win-x64 - steps: - - script: | - choco install -y llvm - displayName: Windows Install Dependencies - - template: '.ci/test.yml' - - template: '.ci/windows-release.yml'