Merge pull request #251 from puremourning/gh-actions

Migrate CI to GitHub actions
This commit is contained in:
Ben Jackson 2020-09-11 15:29:29 +01:00 committed by GitHub
commit 522d8fbc99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 170 additions and 157 deletions

157
.github/workflows/build.yaml vendored Normal file
View file

@ -0,0 +1,157 @@
name: Build
on:
push:
branches:
- master
pull_request:
branches:
- master
defaults:
run:
shell: bash
jobs:
PythonLint:
runs-on: ubuntu-16.04
container: 'puremourning/vimspector:test'
steps:
- uses: actions/checkout@v2
- name: 'Insatll requirements'
run: pip3 install --user -r dev_requirements.txt
- name: 'Run flake8'
run: '$HOME/.local/bin/flake8 python3/ *.py'
VimscriptLint:
runs-on: 'ubuntu-16.04'
container: 'puremourning/vimspector:test'
steps:
- uses: actions/checkout@v2
- name: 'Install requirements'
run: pip3 install --user -r dev_requirements.txt
- name: 'Run vint'
run: $HOME/.local/bin/vint autoload/ compiler/ plugin/ tests/ syntax/
Linux:
runs-on: 'ubuntu-16.04'
container:
image: 'puremourning/vimspector:test'
options: --cap-add=SYS_PTRACE --security-opt seccomp=unconfined
steps:
- uses: actions/checkout@v2
- run: |
eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
go get -u github.com/go-delve/delve/cmd/dlv
name: 'Install Delve for Go'
- uses: actions/cache@v2
with:
key: v1-gadgets-${{ runner.os }}-${{ hashFiles( 'python3/vimspector/gadgets.py' ) }}
path: gadgets/linux/download
name: Cache gadgets
- run: vim --version
name: 'Print vim version information'
- run: |
eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
export GOPATH=$HOME/go
./run_tests --install --update --report messages --quiet
name: 'Run the tests'
env:
VIMSPECTOR_MIMODE: gdb
- run: ./make_package linux ${{ github.run_id }}
name: 'Package'
# TODO: test the tarball
- name: "Upload package"
uses: actions/upload-artifact@v2
with:
name: 'package-linux'
path: 'package/linux-${{ github.run_id }}.tar.gz'
MacOS:
runs-on: 'macos-10.15'
steps:
- uses: actions/checkout@v2
- run: |
brew update
brew doctor || true
for p in macvim tcl-tk llvm; do
brew install $p
brew outdated $p || brew upgrade $p
done
name: 'Install vim and deps'
- run: go get -u github.com/go-delve/delve/cmd/dlv
name: 'Install Delve for Go'
- uses: actions/cache@v2
with:
key: v1-gadgets-${{ runner.os }}-${{ hashFiles( 'python3/vimspector/gadgets.py' ) }}
path: gadgets/macos/download
name: Cache gadgets
- run: vim --version
name: 'Print vim version information'
- run: ./run_tests --install --update --report messages --quiet
name: 'Run the tests'
env:
VIMSPECTOR_MIMODE: lldb
- run: ./make_package macos ${{ github.run_id }}
name: 'Package'
# TODO: test the tarball
- name: "Upload package"
uses: actions/upload-artifact@v2
with:
name: 'package-macos'
path: 'package/macos-${{ github.run_id }}.tar.gz'
PublishRelease:
runs-on: 'ubuntu-16.04'
needs:
- Linux
- MacOS
if: github.ref == 'refs/heads/master'
steps:
- name: 'Download artifacts'
id: download_artifacts
uses: actions/download-artifact@v2
- name: 'Create Release'
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Build ${{ github.run_id }}
draft: false
prerelease: true
- name: 'Upload Linux Package'
id: upload-release-asset-linux
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.download_artifacts.outputs.download-path }}/package-linux
asset_name: linux-${{ github.run_id }}.tar.gz
asset_content_type: application/gzip
- name: 'Upload MacOS Package'
id: upload-release-asset-macos
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.download_artifacts.outputs.download-path }}/package-macos
asset_name: macos-${{ github.run_id }}.tar.gz
asset_content_type: application/gzip

View file

@ -3,10 +3,14 @@ pull_request_rules:
conditions:
- author=puremourning
- base=master
# Review
- status-success=code-review/reviewable
- status-success=puremourning.vimspector # Azure pipeline
- "#changes-requested-reviews-by=0"
# CI https://doc.mergify.io/conditions.html#github-actions
- status-success=PythonLint
- status-success=VimscriptLint
- status-success=MacOS
actions: &merge-actions
merge:
@ -18,12 +22,16 @@ pull_request_rules:
conditions:
- author!=puremourning
- base=master
# Review
- status-success=code-review/reviewable
- status-success=puremourning.vimspector # Azure pipeline
- approved-reviews-by=puremourning
- "#approved-reviews-by>=1"
- "#changes-requested-reviews-by=0"
- approved-reviews-by=puremourning
# CI https://doc.mergify.io/conditions.html#github-actions
- status-success=PythonLint
- status-success=VimscriptLint
- status-success=Linux
- status-success=MacOS
actions:
<<: *merge-actions
comment:

View file

@ -1,152 +0,0 @@
trigger:
- master
pr:
- master
stages:
- stage: Build
jobs:
- job: 'PythonLint'
displayName: "Python Lint"
pool:
vmImage: 'ubuntu-16.04'
container: 'puremourning/vimspector:test'
steps:
- bash: pip3 install -r dev_requirements.txt
displayName: "Install requirements"
- bash: '$HOME/.local/bin/flake8 python3/ *.py'
displayName: "Run flake8"
- job: 'Vimscript'
displayName: "Vimscript Lint"
pool:
vmImage: 'ubuntu-16.04'
container: 'puremourning/vimspector:test'
steps:
- bash: pip3 install -r dev_requirements.txt
displayName: "Install requirements"
- bash: $HOME/.local/bin/vint autoload/ compiler/ plugin/ tests/ syntax/
displayName: "Run vint"
- job: 'linux'
pool:
vmImage: 'ubuntu-16.04'
container:
image: 'puremourning/vimspector:test'
options: --cap-add=SYS_PTRACE --security-opt seccomp=unconfined
steps:
- bash: |
eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
go get -u github.com/go-delve/delve/cmd/dlv
displayName: 'Install Delve for Go'
- task: CacheBeta@0
inputs:
key: v2 | gadgets | $(Agent.OS) | python3/vimspector/gadgets.py
path: gadgets/linux/download
displayName: Cache gadgets
- bash: vim --version
displayName: 'Print vim version information'
- bash: |
eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
export GOPATH=$HOME/go
./run_tests --install --update --report messages --quiet
displayName: 'Run the tests'
env:
VIMSPECTOR_MIMODE: gdb
- bash: ./make_package linux $(Build.SourceVersion)
displayName: 'Package'
# TODO: test the tarball
- task: PublishPipelineArtifact@0
inputs:
artifactName: 'package-linux'
targetPath: 'package/linux-$(Build.SourceVersion).tar.gz'
- job: 'macos'
pool:
vmImage: 'macOS-10.14'
steps:
# Node.js tool installer
# Finds or downloads and caches the specified version spec of Node.js and adds it to the PATH
- task: NodeTool@0
inputs:
versionSpec: '>=12.0.0'
- bash: |
brew update
brew doctor
for p in macvim tcl-tk llvm; do
brew install $p
brew outdated $p || brew upgrade $p
done
displayName: 'Install vim and deps'
- bash: go get -u github.com/go-delve/delve/cmd/dlv
displayName: 'Install Delve for Go'
- task: CacheBeta@0
inputs:
key: v2 | gadgets | $(Agent.OS) | python3/vimspector/gadgets.py
path: gadgets/macos/download
displayName: Cache gadgets
- bash: vim --version
displayName: 'Print vim version information'
- bash: ./run_tests --install --update --report messages --quiet
displayName: 'Run the tests'
env:
VIMSPECTOR_MIMODE: lldb
- bash: ./make_package macos $(Build.SourceVersion)
displayName: 'Package'
# TODO: test the tarball
- task: PublishPipelineArtifact@0
inputs:
artifactName: 'package-macos'
targetPath: 'package/macos-$(Build.SourceVersion).tar.gz'
- stage: "Publish"
dependsOn:
- "Build"
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
jobs:
- job: 'Publish'
pool:
vmImage: 'ubuntu-16.04'
steps:
- task: DownloadPipelineArtifact@0
inputs:
artifactName: 'package-linux'
targetPath: $(Build.ArtifactStagingDirectory)
- task: DownloadPipelineArtifact@0
inputs:
artifactName: 'package-macos'
targetPath: $(Build.ArtifactStagingDirectory)
- task: GitHubRelease@0
inputs:
gitHubConnection: puremourning
repositoryName: '$(Build.Repository.Name)'
action: 'create' # Options: create, edit, delete
target: '$(Build.SourceVersion)' # Required when action == Create || Action == Edit
tagSource: 'manual' # Required when action == Create# Options: auto, manual
tag: "$(Build.BuildId)"
#title: # Optional
#releaseNotesSource: 'file' # Optional. Options: file, input
#releaseNotesFile: # Optional
#releaseNotes: # Optional
#assets: '$(Build.ArtifactStagingDirectory)/*' # Optional
#assetUploadMode: 'delete' # Optional. Options: delete, replace
#isDraft: false # Optional
isPreRelease: true # Optional
#addChangeLog: true # Optional