Remove Azure Pipelines and add Github Actions (#3765)

* Remove Azure Pipelines and add Github Actions

* Trigger CI on push and pull request
This commit is contained in:
Quentin Le Sceller 2024-01-26 07:58:52 -05:00 committed by GitHub
parent c48ba3e365
commit a9f45dee2b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 106 additions and 241 deletions

View file

@ -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

View file

@ -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

View file

@ -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' )

View file

@ -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

73
.github/workflows/cd.yaml vendored Normal file
View file

@ -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

33
.github/workflows/ci.yaml vendored Normal file
View file

@ -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

View file

@ -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'