From 803cc55053d54f5d2d913b463b7c46fad1a01e53 Mon Sep 17 00:00:00 2001 From: Miguel Angel Mulero Martinez Date: Wed, 16 Feb 2022 11:03:20 +0100 Subject: [PATCH] Move Azure pipelines to Github Actions --- .github/workflows/ci.yml | 58 +++++++++++++ .github/workflows/nightly.yml | 71 ++++++++++++++++ .github/workflows/pr.yml | 12 +++ README.md | 2 +- azure-pipelines.yml | 156 ---------------------------------- 5 files changed, 142 insertions(+), 157 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/nightly.yml create mode 100644 .github/workflows/pr.yml delete mode 100644 azure-pipelines.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..0bd279b0 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,58 @@ +# Builds Betaflight Blackbox Explorer on Windows, Linux and macOS platforms. +# +# After building, artifacts are released to a separate repository. + +env: + debugBuild: true + +name: CI + +on: workflow_call + +jobs: + build: + name: Build (${{ matrix.name }}) + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - name: Linux + os: ubuntu-20.04 + releaseArgs: --linux64 + + - name: macOS + os: macos-11 + releaseArgs: --osx64 + + - name: Windows + os: windows-2022 + releaseArgs: --win64 + steps: + - uses: actions/checkout@v2 + + - name: Cache NW.js + uses: actions/cache@v2 + with: + path: cache/ + key: ${{ runner.os }}-${{ hashFiles('gulpfile.js') }} + + - name: Install Node.js + uses: actions/setup-node@v2 + with: + node-version-file: '.nvmrc' + cache: yarn + + - run: yarn install --immutable --immutable-cache --check-cache + + - run: yarn gulp release ${{ matrix.releaseArgs }} + if: ${{ !env.debugBuild }} + + - run: yarn gulp debug-release ${{ matrix.releaseArgs }} + if: ${{ env.debugBuild }} + + - name: Publish build artifacts + uses: actions/upload-artifact@v2 + with: + name: Betaflight-Blackbox-Explorer${{ env.debugBuild == 'true' && '-Debug' || '' }}-${{ matrix.name }} + path: release/ + retention-days: 90 diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 00000000..a890e01e --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,71 @@ +# You'll need to setup the follwing environment variables: +# env.repoNightly - The repository to release nightly builds to e.g. betaflight-configurator-nightly +# env.releaseNotes - The release notes to be published as part of the github release +# env.debugReleaseNotes - The release notes to be published as part of the github debug release +# secrets.REPO_TOKEN - A GitHub token with permissions to push and publish releases to the nightly repo + +env: + repoNightly: betaflight/blackbox-log-viewer-nightlies + debugReleaseNotes: > + This is an automated development build. + It may be unstable and result in corrupted configurations or data loss. + **Use only for testing.** + releaseNotes: This is a release build. It does not contain the debug console. + +name: Nightly + +on: + push: + branches: + - master + - '*-maintenance' + +jobs: + ci: + name: CI + uses: ./.github/workflows/ci.yml + + release: + name: Release + needs: ci + runs-on: ubuntu-20.04 + steps: + - name: Fetch build artifacts + uses: actions/download-artifact@v2 + with: + path: release-assets/ + + - name: Select release notes + id: notes + run: | + set -- release-assets/Betaflight-Blackbox-Explorer-Debug-* + echo "::set-output name=notes::$(test -e "$1" && echo '${{ env.debugReleaseNotes }}' || echo '${{ env.releaseNotes }}')" + + - name: Get current date + id: date + run: echo "::set-output name=today::$(date '+%Y%m%d')" + + - name: Release + uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5 # v0.1.14 + with: + token: ${{ secrets.REPO_TOKEN }} + repository: ${{ env.repoNightly }} + tag_name: v${{ steps.date.outputs.today }}.${{ github.run_number }} + files: release-assets/Betaflight-Blackbox-Explorer-*/** + draft: false + prerelease: false + fail_on_unmatched_files: true + body: | + ${{ steps.notes.outputs.notes }} + + ### Repository: + ${{ github.repository }} ([link](${{ github.event.repository.html_url }})) + + ### Branch: + ${{ github.ref_name }} ([link](${{ github.event.repository.html_url }}/tree/${{ github.ref_name }})) + + ### Latest changeset: + ${{ github.event.head_commit.id }} ([link](${{ github.event.head_commit.url }})) + + ### Changes: + ${{ github.event.head_commit.message }} diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 00000000..b298655b --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,12 @@ +name: PR + +on: + pull_request: + branches: + - master + - '*-maintenance' + +jobs: + ci: + name: CI + uses: ./.github/workflows/ci.yml \ No newline at end of file diff --git a/README.md b/README.md index 2a5215d5..dcf7f129 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Betaflight Blackbox Explorer -[![Latest version](https://img.shields.io/github/v/release/betaflight/blackbox-log-viewer)](https://github.com/betaflight/blackbox-log-viewer/releases) [![Build Status](https://travis-ci.com/betaflight/blackbox-log-viewer.svg?branch=master)](https://travis-ci.com/betaflight/blackbox-log-viewer) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=betaflight_blackbox-log-viewer&metric=alert_status)](https://sonarcloud.io/dashboard?id=betaflight_blackbox-log-viewer) [![Build Status](https://dev.azure.com/Betaflight/Betaflight%20Nightlies/_apis/build/status/betaflight.blackbox-log-viewer?branchName=master)](https://dev.azure.com/Betaflight/Betaflight%20Nightlies/_build/latest?definitionId=2&branchName=master) [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) +[![Latest version](https://img.shields.io/github/v/release/betaflight/blackbox-log-viewer)](https://github.com/betaflight/blackbox-log-viewer/releases) [![Build](https://img.shields.io/github/workflow/status/betaflight/blackbox-log-viewer/Nightly)](https://github.com/betaflight/blackbox-log-viewer/actions/workflows/nightly.yml) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=betaflight_blackbox-log-viewer&metric=alert_status)](https://sonarcloud.io/dashboard?id=betaflight_blackbox-log-viewer) [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) ![Main explorer interface](screenshots/main-interface.jpg) diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 82ff1374..00000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,156 +0,0 @@ -# Builds Blackbox Explorer on Windows, Linux and OSX platforms. -# -# After building, artifacts are released to a seperate repository. -# -# Azure Pipelines requires the following extensions to be installed: -# - GitHub Tool: https://marketplace.visualstudio.com/items?itemName=marcelo-formentao.github-tools -# -# You'll also need to setup the follwing pipeline variables: -# "releaseNotes" - This is used to add the release notes in the windows job in the build stage so they can be published as part of the github release in the release stage -# "endpoint" - The name of the github endpoint link setup in AzDo - setup when linking AzDo and GitHub -# "owner" - The owner of the repository to release to e.g. betaflight -# "repoName" - The name of the repository to release to e.g. blackbox-log-viewer-nightlies - -variables: - owner: betaflight - repoName: blackbox-log-viewer-nightlies - debugReleaseNotes: This is a nightly build off the tip of 'master'. It may be unstable and result in corrupted configurations or data loss. **Use only for testing.** - releaseNotes: This is a release build. It does not contain the debug console. - linuxVmImage: 'ubuntu-20.04' - -parameters: - - name: releaseBuild - type: boolean - default: false - -name: $(Date:yyyyMMdd).$(BuildID) - -trigger: - batch: true - branches: - include: - - master - - "*-maintenance" - -pr: - drafts: false - branches: - include: - - master - - "*-maintenance" - -stages: -- stage: Build - jobs: - - - job: 'Windows' - pool: - vmImage: 'windows-2022' - - steps: - - task: NodeTool@0 - inputs: - versionSpec: '16.15.0' - displayName: 'Install Node.js 16.15.0' - - script: yarn install --ignore-optional - displayName: 'Run yarn install' - - script: yarn gulp release --win64 - displayName: 'Run yarn release for win64' - condition: and(succeeded(), eq('${{ parameters.releaseBuild }}', true)) - - script: yarn gulp debug-release --win64 - displayName: 'Run yarn debug release for win64' - condition: and(succeeded(), eq('${{ parameters.releaseBuild }}', false)) - - task: PublishPipelineArtifact@1 - displayName: 'Publish Windows release' - inputs: - targetPath: '$(System.DefaultWorkingDirectory)/release' - artifact: 'blackbox-log-viewer-windows' - - - job: 'MacOS' - pool: - vmImage: 'macos-10.15' - - steps: - - task: NodeTool@0 - inputs: - versionSpec: '16.15.0' - displayName: 'Install Node.js 16.15.0' - - script: npm install -g gulp - displayName: 'Install Gulp' - - script: yarn install - displayName: 'Run yarn install' - - script: yarn gulp release --osx64 - displayName: 'Run yarn release for OSX' - condition: and(succeeded(), eq('${{ parameters.releaseBuild }}', true)) - - script: yarn gulp debug-release --osx64 - displayName: 'Run yarn debug release for OSX' - condition: and(succeeded(), eq('${{ parameters.releaseBuild }}', false)) - - task: PublishPipelineArtifact@1 - displayName: 'Publish MacOS release' - inputs: - artifactName: blackbox-log-viewer-macos - targetPath: '$(System.DefaultWorkingDirectory)/release' - - - job: 'Linux' - pool: - vmImage: '$(linuxVmImage)' - - steps: - - task: NodeTool@0 - inputs: - versionSpec: '16.15.0' - displayName: 'Install Node.js 16.15.0' - - script: yarn install --ignore-optional - displayName: 'Run yarn install' - - script: yarn gulp release --linux64 - displayName: 'Run yarn release for linux' - condition: and(succeeded(), eq('${{ parameters.releaseBuild }}', true)) - - script: yarn gulp debug-release --linux64 - displayName: 'Run yarn debug-release for linux' - condition: and(succeeded(), eq('${{ parameters.releaseBuild }}', false)) - - script: cd $(System.DefaultWorkingDirectory)/release; find -mindepth 1 -maxdepth 1 -type d -exec rm -r {} \; - displayName: 'Clean release folders' - - - task: PublishPipelineArtifact@1 - displayName: 'Publish Linux release' - inputs: - artifactName: blackbox-log-viewer-linux - targetPath: '$(System.DefaultWorkingDirectory)/release' - - -- stage: Release - jobs: - - job: Release - pool: - vmImage: '$(linuxVmImage)' - - steps: - - task: DownloadPipelineArtifact@2 - inputs: - buildType: 'current' - targetPath: '$(Pipeline.Workspace)' - - powershell: Write-Output ("##vso[task.setvariable variable=releaseNotes;]$(debugReleaseNotes)") - condition: and(succeeded(), eq('${{ parameters.releaseBuild }}', false)) - - task: GitHubReleasePublish@1 - inputs: - githubEndpoint: '$(endpoint)' - manuallySetRepository: true - githubOwner: '$(owner)' - githubRepositoryName: '$(repoName)' - githubReleaseNotes: |+ - $(releaseNotes) - - ### Changes: - $(Build.SourceVersionMessage) - githubReleaseDraft: false - githubReleasePrerelease: false - githubIgnoreAssets: false - githubReleaseAsset: | - $(Pipeline.Workspace)/blackbox-log-viewer-windows/** - $(Pipeline.Workspace)/blackbox-log-viewer-macos/** - $(Pipeline.Workspace)/blackbox-log-viewer-linux/** - githubReuseRelease: true - githubReuseDraftOnly: true - githubSkipDuplicatedAssets: false - githubEditRelease: false - githubDeleteEmptyTag: false