Replace Azure Pipelines with Github Actions (#688)

This commit is contained in:
Quentin Le Sceller 2023-08-01 11:28:35 -04:00 committed by GitHub
parent 60d1eb0daa
commit 586db6fe91
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 106 additions and 232 deletions

View file

@ -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 test-related 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,53 +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
ROARING_ARCH=x86-64-v2
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-wallet'
targetFolder: '$(Build.BinariesDirectory)/grin-wallet'
- 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-wallet'
archiveType: 'tar'
tarCompression: 'gz'
archiveFile: '$(Build.ArtifactStagingDirectory)/grin-wallet-$(build.my_tag)-$(build.platform).tar.gz'
- script: |
cd $(Build.ArtifactStagingDirectory) && openssl sha256 grin-wallet-$(build.my_tag)-$(build.platform).tar.gz > grin-wallet-$(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-wallet'
action: 'edit'
target: '$(build.sourceVersion)'
tagSource: 'manual'
tag: '$(build.my_tag)'
assets: |
$(Build.ArtifactStagingDirectory)/grin-wallet-$(build.my_tag)-$(build.platform).tar.gz
$(Build.ArtifactStagingDirectory)/grin-wallet-$(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-wallet.exe'
targetFolder: '$(Build.BinariesDirectory)\grin-wallet'
- 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-wallet'
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)\grin-wallet-$(build.my_tag)-$(build.platform).zip'
- script: |
powershell -Command "cd $(Build.ArtifactStagingDirectory); get-filehash -algorithm sha256 grin-wallet-$(build.my_tag)-$(build.platform).zip | Format-List |  Out-String | ForEach-Object { $_.Trim() } > grin-wallet-$(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-wallet'
action: 'edit'
target: '$(build.sourceVersion)'
tagSource: 'manual'
tag: '$(build.my_tag)'
assets: |
$(Build.ArtifactStagingDirectory)\grin-wallet-$(build.my_tag)-$(build.platform).zip
$(Build.ArtifactStagingDirectory)\grin-wallet-$(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-wallet-${{ github.ref_name }}-linux-x86_64.tar.gz grin-wallet
- name: Create Checksum
working-directory: target/release
run: openssl sha256 grin-wallet-${{ github.ref_name }}-linux-x86_64.tar.gz > grin-wallet-${{ 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-wallet-${{ github.ref_name }}-linux-x86_64.tar.gz
target/release/grin-wallet-${{ 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-wallet-${{ github.ref_name }}-macos-x86_64.tar.gz grin-wallet
- name: Create Checksum
working-directory: target/release
run: openssl sha256 grin-wallet-${{ github.ref_name }}-macos-x86_64.tar.gz > grin-wallet-${{ github.ref_name }}-macos-x86_64-sha256sum.txt
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
target/release/grin-wallet-${{ github.ref_name }}-macos-x86_64.tar.gz
target/release/grin-wallet-${{ 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-wallet.exe
dest: target/release/grin-wallet-${{ github.ref_name }}-win-x86_64.zip
- name: Create Checksum
working-directory: target/release
shell: pwsh
run: get-filehash -algorithm sha256 grin-wallet-${{ github.ref_name }}-win-x86_64.zip | Format-List |  Out-String | ForEach-Object { $_.Trim() } > grin-wallet-${{ github.ref_name }}-win-x86_64-sha256sum.txt
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
target/release/grin-wallet-${{ github.ref_name }}-win-x86_64.zip
target/release/grin-wallet-${{ 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]
jobs:
linux-tests:
name: Linux Tests
runs-on: ubuntu-latest
strategy:
matrix:
job_args: [api, config, controller, impls, libwallet, .]
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,79 +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
tags:
include: ['*']
pr:
branches:
include: ['*']
variables:
RUST_BACKTRACE: '1'
RUSTFLAGS: '-C debug-assertions'
jobs:
- job: linux
pool:
vmImage: ubuntu-22.04
strategy:
matrix:
config/libwallet/api:
CI_JOB: test
CI_JOB_ARGS: config libwallet api
impls:
CI_JOB: test
CI_JOB_ARGS: impls
controller/all:
CI_JOB: test
CI_JOB_ARGS: controller .
release:
CI_JOB: release
PLATFORM: linux-amd64
steps:
- 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 LLVM
- template: '.ci/test.yml'
- template: '.ci/windows-release.yml'