Skip to content

Commit

Permalink
GitHub Actions: Build workflow refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
sadv1r committed Sep 25, 2023
1 parent b1e9f74 commit 461f355
Showing 1 changed file with 81 additions and 34 deletions.
115 changes: 81 additions & 34 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,21 @@ name: Build

on:
push:
branches:
- master
branches: [ master ]
pull_request:

pull_request_target:
types: [labeled]
types: [ labeled ]

jobs:
build:
name: Build
runs-on: ubuntu-latest
outputs:
version: ${{ steps.properties.outputs.version }}
changelog: ${{ steps.properties.outputs.changelog }}
pluginVerifierHomeDir: ${{ steps.properties.outputs.pluginVerifierHomeDir }}
steps:
- name: Maximize Build Space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
- name: Fetch Sources
uses: actions/checkout@v3

Expand All @@ -34,6 +29,11 @@ jobs:
distribution: zulu
java-version: 11

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true

- name: Export Properties
id: properties
run: |
Expand All @@ -49,6 +49,51 @@ jobs:
./gradlew listProductsReleases
- name: Build plugin
run: ./gradlew buildPlugin

- name: Prepare Plugin Artifact
id: artifact
shell: bash
run: |
cd ${{ github.workspace }}/build/distributions
FILENAME=`ls *.zip`
unzip "$FILENAME" -d content
echo "::set-output name=filename::${FILENAME:0:-4}"
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ steps.artifact.outputs.filename }}
path: ./build/distributions/content/*/*

- name: Notify to Telegram
uses: yanzay/[email protected]
if: always()
with:
chat: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
status: ${{ job.status }}

test:
name: Test
needs: [ build ]
runs-on: ubuntu-latest
steps:
- name: Fetch Sources
uses: actions/checkout@v3

- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 11

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true

- name: Run Tests
run: ./gradlew test

Expand All @@ -62,14 +107,39 @@ jobs:
- name: Test generated vaults with official CLI tool
run: ./gradlew integrationTest

verify:
name: Verify plugin
needs: [ build ]
runs-on: ubuntu-latest
steps:
- name: Maximize Build Space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
large-packages: false

- name: Fetch Sources
uses: actions/checkout@v3

- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 11

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true

- name: Setup Plugin Verifier IDEs Cache
uses: actions/cache@v3
with:
path: ${{ steps.properties.outputs.pluginVerifierHomeDir }}/ides
key: plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }}

- name: Run Plugin Verification tasks
run: ./gradlew runPluginVerifier -Pplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }}
run: ./gradlew runPluginVerifier -Pplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }}

- name: Collect Plugin Verifier Result
if: always()
Expand All @@ -78,35 +148,12 @@ jobs:
name: pluginVerifier-result
path: ${{ github.workspace }}/build/reports/pluginVerifier

- name: Prepare Plugin Artifact
id: artifact
shell: bash
run: |
cd ${{ github.workspace }}/build/distributions
FILENAME=`ls *.zip`
unzip "$FILENAME" -d content
echo "::set-output name=filename::${FILENAME:0:-4}"
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ steps.artifact.outputs.filename }}
path: ./build/distributions/content/*/*

- name: Notify to Telegram
uses: yanzay/[email protected]
if: always()
with:
chat: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
status: ${{ job.status }}

# Prepare a draft release for GitHub Releases page for the manual verification
# If accepted and published, release workflow would be triggered
releaseDraft:
name: Release Draft
if: github.event_name != 'pull_request'
needs: build
needs: [ build, test, verify ]
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down

0 comments on commit 461f355

Please sign in to comment.