QSharpBuild #397
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# GitHub Actions Workflow is created for testing and preparing the plugin release in the following steps: | |
# - validate Gradle Wrapper, | |
# - run 'test' and 'verifyPlugin' tasks, | |
# - run Qodana inspections, | |
# - run 'buildPlugin' task and prepare artifact for the further tests, | |
# - run 'runPluginVerifier' task, | |
# - create a draft release. | |
# | |
# Workflow is triggered on push and pull_request events. | |
# | |
# GitHub Actions reference: https://help.github.com/en/actions | |
# | |
## JBIJPPTPL | |
name: QSharpBuild | |
on: | |
# Trigger the workflow on pushes to only the 'main' branch (this avoids duplicate checks being run e.g. for dependabot pull requests) | |
#push: | |
# branches: [develop] | |
# Trigger the workflow on any pull request | |
workflow_dispatch: | |
schedule: | |
- cron: "30 22 * * *" | |
jobs: | |
# Run Gradle Wrapper Validation Action to verify the wrapper's checksum | |
# Run verifyPlugin, IntelliJ Plugin Verifier, and test Gradle tasks | |
# Build plugin and provide the artifact for the next workflow jobs | |
build: | |
name: Build | |
runs-on: macos-latest | |
outputs: | |
version: ${{ steps.properties.outputs.version }} | |
changelog: ${{ steps.properties.outputs.changelog }} | |
steps: | |
# Check out current repository | |
- name: Fetch Sources | |
uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
if: always() | |
with: | |
path: | | |
~/.m2/ | |
~/.gradle/ | |
key: ${{ runner.os }}-maven-cache | |
restore-keys: | | |
${{ runner.os }}-maven-cache | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
cache: 'gradle' | |
# Check out current repository | |
- name: Fetch qsharp Sources | |
uses: actions/checkout@v3 | |
with: | |
repository: chengpohi/intellij-qsharp | |
ref: qsharp | |
token: ${{ secrets.GH_PAT }} | |
path: 'intellij-qsharp' | |
# Check out current repository | |
- name: Fetch edql idea Sources | |
uses: actions/checkout@v3 | |
with: | |
repository: chengpohi/edql-idea-plugin | |
ref: develop | |
token: ${{ secrets.GH_PAT }} | |
path: 'intellij-qsharp/qsharp/edql-idea-plugin' | |
# build edql repository | |
- name: Build library | |
id: edql-lib | |
run: | | |
./gradlew --info --no-daemon publishToMavenLocal | |
- name: Build qsharp | |
id: intellij-qsharp | |
continue-on-error: true | |
run: | | |
cd intellij-qsharp | |
qsharp/installers.cmd -Dintellij.build.use.compiled.classes=false | |
ls -lh out/qsharp-ce/artifacts/ | |
cd .. | |
# Remove old release drafts by using the curl request for the available releases with a draft flag | |
- name: Remove Old Release Drafts | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh api repos/{owner}/{repo}/releases \ | |
--jq '.[] | select(.tag_name|startswith("QSharp")) | select(.draft == true) | .id' \ | |
| xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{} | |
# Create a new release draft which is not publicly visible and requires manual acceptance | |
- name: Create Release Draft | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_PAT }} | |
run: | | |
cd ${{ github.workspace }}/intellij-qsharp/qsharp/edql-idea-plugin | |
PROPERTIES="$(./gradlew properties --console=plain -q)" | |
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')" | |
CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)" | |
TAG="$(echo "QSharp$VERSION")" | |
cd ${{ github.workspace }} | |
gh release create $TAG \ | |
--draft \ | |
--title $TAG \ | |
--notes "$CHANGELOG" | |
gh release upload --clobber $TAG ${{ github.workspace }}/intellij-qsharp/out/qsharp-ce/artifacts/*{.tar.gz,zip,dmg} |