diff --git a/.ci/general-jobs b/.ci/general-jobs deleted file mode 100755 index e9612d1c83..0000000000 --- a/.ci/general-jobs +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash - -# Copyright 2019 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/install.yml b/.ci/install.yml deleted file mode 100644 index e3da8653f6..0000000000 --- a/.ci/install.yml +++ /dev/null @@ -1,16 +0,0 @@ -steps: - - script: | - git apply .ci/win.patch - choco install -y llvm - displayName: Windows Install LLVM - condition: eq( variables['Agent.OS'], 'Windows_NT' ) - - script: | - curl https://sh.rustup.rs -sSf | sh -s -- -y - echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin" - displayName: macOS Install Rust - condition: eq( variables['Agent.OS'], 'Darwin' ) - - script: | - sudo apt-get update -yqq - sudo apt-get install -yqq --no-install-recommends libncursesw5-dev - displayName: Linux Install Dependencies - condition: eq( variables['Agent.OS'], 'Linux' ) \ No newline at end of file diff --git a/.ci/release.yml b/.ci/release.yml deleted file mode 100644 index 6033f7b426..0000000000 --- a/.ci/release.yml +++ /dev/null @@ -1,50 +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 build --release' - 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: | - openssl sha256 $(Build.ArtifactStagingDirectory)/grin-$(build.my_tag)-$(build.platform).tar.gz > $(Build.ArtifactStagingDirectory)/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: 'ignopeverell' - 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 65c9bee2f1..0000000000 --- a/.ci/test.yml +++ /dev/null @@ -1,10 +0,0 @@ -steps: - - script: 'cargo test --all' - displayName: Windows Cargo Test - condition: and(eq( variables['Agent.OS'], 'Windows_NT' ), eq( variables['CI_JOB'], 'test-all' )) - - script: 'cargo test --all' - displayName: macOS Cargo Test - condition: and(eq( variables['Agent.OS'], 'Darwin' ), eq( variables['CI_JOB'], 'test-all' )) - - script: '.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 070c5a7245..0000000000 --- a/.ci/windows-release.yml +++ /dev/null @@ -1,50 +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 build --release' - 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 "get-filehash -algorithm sha256 $(Build.ArtifactStagingDirectory)\grin-$(build.my_tag)-$(build.platform).zip | Format-List |  Out-String | ForEach-Object { $_.Trim() } > $(Build.ArtifactStagingDirectory)\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: 'ignopeverell' - 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/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..e945f6636c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,60 @@ +name: Continuous Integration + +on: [pull_request] + +env: + RUST_BACKTRACE: '1' + RUSTFLAGS: '-C debug-assertions' + +jobs: + + ubuntu: + name: Ubuntu CI + runs-on: ubuntu-latest + strategy: + matrix: + job_args: [ 'servers', 'chain core keychain', 'pool p2p src', 'api util store' ] + steps: + - name: Echo + run: echo ${GITHUB_REF} + - name: Checkout + uses: actions/checkout@v2 + - name: Install dependencies + run: sudo apt-get update -yqq && sudo apt-get install -yqq --no-install-recommends libncursesw5-dev + - name: Test ${{ matrix.job_args }} + env: + CI_JOB_ARGS: ${{ matrix.job_args }} + run: | + 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 + + macos: + name: macOS CI + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + - name: Tests + run: cargo test --release --all + + windows: + name: Windows CI + runs-on: windows-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Patch Grin ncurses + run: git apply .github/workflows/win.patch + - name: Install LLVM + run: choco install -y llvm + - name: Tests + run: cargo test --release --all \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000..737ef5d242 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,179 @@ +name: Release + +on: + push: + tags: + - 'v*' + +env: + RUST_BACKTRACE: '1' + RUSTFLAGS: '-C debug-assertions' + +jobs: + + ubuntu-build: + name: Ubuntu Build Release + runs-on: ubuntu-latest + env: + PLATFORM: linux-amd64 + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Install dependencies + run: sudo apt-get update -yqq && sudo apt-get install -yqq --no-install-recommends libncursesw5-dev + - name: Tests + run: cargo test --release --all + - name: Build + run: cargo build --release + - name: Set release version + run: echo ::set-env name=RELEASE_VERSION::$(echo ${GITHUB_REF:10}) + - name: Create archive + run: tar -czvf grin-$RELEASE_VERSION-$PLATFORM.tar.gz target/release/grin + - name: Debug + run: ls -a -l + - name: Upload artifact + uses: actions/upload-artifact@v1 + with: + name: grin-${{ env.RELEASE_VERSION }}-${{ env.PLATFORM }} + path: grin-${{ env.RELEASE_VERSION }}-${{ env.PLATFORM }}.tar.gz + + macos-build: + name: macOS Build Release + runs-on: macos-latest + env: + PLATFORM: macos + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + - name: Tests + run: cargo test --release --all + - name: Build + run: cargo build --release + - name: Set release version + run: echo ::set-env name=RELEASE_VERSION::$(echo ${GITHUB_REF:10}) + - name: Create archive + run: tar -czvf grin-$RELEASE_VERSION-$PLATFORM.tar.gz target/release/grin + - name: Upload artifact + uses: actions/upload-artifact@v1 + with: + name: grin-${{ env.RELEASE_VERSION }}-${{ env.PLATFORM }} + path: grin-${{ env.RELEASE_VERSION }}-${{ env.PLATFORM }}.tar.gz + + windows-build: + name: Windows Build Release + runs-on: windows-latest + env: + PLATFORM: win-x64 + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Patch Grin ncurses + run: git apply .github/workflows/win.patch + - name: Install LLVM + run: choco install -y llvm + - name: Tests + run: cargo test --release --all + - name: Build + run: cargo build --release + - name: Set release version + run: | + echo ::set-env name=RELEASE_VERSION::$(echo ${GITHUB_REF:10}) + shell: bash + - name: Create archive + run: | + /c/Program\ Files/7-Zip/7z.exe a grin-$RELEASE_VERSION-$PLATFORM.zip target/release/grin.exe + shell: bash + - name: Upload artifact + uses: actions/upload-artifact@v1 + with: + name: grin-${{ env.RELEASE_VERSION }}-${{ env.PLATFORM }} + path: grin-${{ env.RELEASE_VERSION }}-${{ env.PLATFORM }}.zip + + release: + name: Release + runs-on: ubuntu-latest + needs: [ubuntu-build, macos-build, windows-build] + env: + PLATFORM: linux-amd64 + steps: + - name: Set release version + run: echo ::set-env name=RELEASE_VERSION::$(echo ${GITHUB_REF:10}) + - name: Download Ubuntu artificact + uses: actions/download-artifact@v1 + with: + name: grin-${{ env.RELEASE_VERSION }}-linux-amd64 + - name: Download macOS artificact + uses: actions/download-artifact@v1 + with: + name: grin-${{ env.RELEASE_VERSION }}-macos + - name: Download Windows artificact + uses: actions/download-artifact@v1 + with: + name: grin-${{ env.RELEASE_VERSION }}-win-x64 + - name: Create checksums + run: | + openssl sha256 grin-$RELEASE_VERSION-linux-amd64/grin-$RELEASE_VERSION-linux-amd64.tar.gz > grin-$RELEASE_VERSION-linux-amd64-sha256sum.txt + openssl sha256 grin-$RELEASE_VERSION-macos/grin-$RELEASE_VERSION-macos.tar.gz > grin-$RELEASE_VERSION-macos-sha256sum.txt + openssl sha256 grin-$RELEASE_VERSION-win-x64/grin-$RELEASE_VERSION-win-x64.zip > grin-$RELEASE_VERSION-win-x64-sha256sum.txt + - name: Create Release + uses: softprops/action-gh-release@v1 + with: + files: | + grin-$RELEASE_VERSION-linux-amd64/grin-${{ env.RELEASE_VERSION }}-linux-amd64.tar.gz + grin-${{ env.RELEASE_VERSION }}-linux-amd64-sha256sum.txt + grin-${{ env.RELEASE_VERSION }}-macos/grin-${{ env.RELEASE_VERSION }}-macos.tar.gz + grin-${{ env.RELEASE_VERSION }}-macos-sha256sum.txt + grin-${{ env.RELEASE_VERSION }}-win-x64/grin-${{ env.RELEASE_VERSION }}-win-x64.zip + grin-${{ env.RELEASE_VERSION }}-win-x64-sha256sum.txt + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Checkout + uses: actions/checkout@v2 + - name: Set up Ruby 2.6 + uses: actions/setup-ruby@v1 + with: + ruby-version: 2.6.x + - name: Update Changelog + run: | + readonly REPO_TAG="$(git describe --tags --exact-match 2> /dev/null || git symbolic-ref -q --short HEAD)" + readonly REPO_SLUG="quentinlesceller/grin" + readonly REPO_BRANCH="$(git symbolic-ref -q --short HEAD)" + readonly REPO_PREV_RELEASE_TAG="$(git describe --abbrev=0 --tags "$(git rev-list --tags --skip=0 --max-count=1)")" + + gem install github_changelog_generator + + github_changelog_generator \ + --user "$(cut -d "/" -f1 <<< ${REPO_SLUG})" \ + --project "$(cut -d "/" -f2 <<< ${REPO_SLUG})" \ + --since-tag "${REPO_PREV_RELEASE_TAG}" + + readonly CHANGELOG_CONTENT="$( CHANGELOG.md + + readonly HEADERS="Authorization: token $GITHUB_TOKEN" + readonly RELEASE_URL="https://api.github.com/repos/${REPO_SLUG}/releases" + readonly RELEASE_ID="$(curl -0 --request GET -H "${HEADERS}" "${RELEASE_URL}/tags/${REPO_TAG}" 2> /dev/null | grep id | head -n 1 | sed 's/ *"id": *\(.*\),/\1/')" + + printf "updating release changelog %s for repo: %s, branch: %s, release id: %s\n" "${REPO_TAG}" "${REPO_SLUG}" "${REPO_BRANCH}" "${RELEASE_ID}" + curl -H "${HEADERS}" --request PATCH --data @CHANGELOG.md "${RELEASE_URL}/${RELEASE_ID}" + printf "changelog uploaded.\n" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.ci/win.patch b/.github/workflows/win.patch similarity index 100% rename from .ci/win.patch rename to .github/workflows/win.patch diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 49b3a7cbae..0000000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,83 +0,0 @@ -# Copyright 2019 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-16.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: - - template: '.ci/install.yml' - - template: '.ci/test.yml' - - template: '.ci/release.yml' -- job: macos - pool: - vmImage: macos-10.14 - strategy: - matrix: - test: - CI_JOB: test-all - release: - CI_JOB: release - PLATFORM: macos - steps: - - template: '.ci/install.yml' - - template: '.ci/test.yml' - - template: '.ci/release.yml' -- job: windows - pool: - vmImage: windows-2019 - strategy: - matrix: - test: - CI_JOB: test-all - release: - CI_JOB: release - PLATFORM: win-x64 - steps: - - template: '.ci/install.yml' - - template: '.ci/test.yml' - - template: '.ci/windows-release.yml'