Skip to content

Automated the normal pre-release tests #741

Automated the normal pre-release tests

Automated the normal pre-release tests #741

Workflow file for this run

name: Build and Deploy
on:
push:
branches:
- main
tags:
- 'v[0-9]+.*'
pull_request:
branches:
- main
permissions:
actions: read
jobs:
ui-test:
strategy:
matrix:
os: [buildjet-4vcpu-ubuntu-2204, windows-latest, macos-latest]
fail-fast: true
env:
CODE_VERSION: "1.75.1"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'temurin'
cache: 'maven'
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'
cache-dependency-path: rascal-vscode-extension/package-lock.json
registry-url: 'https://registry.npmjs.org'
- name: Package & compile rascal-lsp
working-directory: ./rascal-lsp
run: mvn -B '-Drascal.compile.skip' '-Drascal.tutor.skip' clean package
- name: Package & compile extension
working-directory: ./rascal-vscode-extension
run: |
npm ci
npm run compile-tests
- name: Cache vscode downloads
id: cache-vscode
uses: actions/cache@v3
with:
path: /tmp/uitest
key: "vscode-${{matrix.os}}"
- name: "UI test (windows & mac)"
shell: bash
if: matrix.os != 'buildjet-4vcpu-ubuntu-2204'
working-directory: ./rascal-vscode-extension
env:
DELAY_FACTOR: ${{ matrix.os == 'windows' && '7' || '5' }}
_JAVA_OPTIONS: ${{ matrix.os == 'windows' && '-Xmx2G' || '-Xmx4G' }}
run: npx extest setup-and-run out/test/vscode-suite/*.test.js --storage /tmp/uitests
- name: "UI test (ubuntu)"
shell: bash
if: matrix.os == 'buildjet-4vcpu-ubuntu-2204'
working-directory: ./rascal-vscode-extension
env:
DELAY_FACTOR: 5
_JAVA_OPTIONS: '-Xmx5G' # we have 16gb of memory, make sure LSP, REPL & DSL-LSP can start
run: xvfb-run --auto-servernum --server-args='-screen 0 1920x1080x24' npx extest setup-and-run out/test/vscode-suite/*.test.js --storage /tmp/uitests
- name: Upload Screenshots
uses: actions/upload-artifact@v3
if: failure()
with:
name: screenshots-${{ matrix.runner }}
path: /tmp/uitests/**/screenshots/*.png
- name: "cleanup before cache"
if: always()
continue-on-error: true
run: |
npm install -g rifraf
rifraf /tm/uitest/screenshots
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'temurin'
cache: 'maven'
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'
cache-dependency-path: rascal-vscode-extension/package-lock.json
registry-url: 'https://registry.npmjs.org'
- name: Package & compile rascal-lsp
working-directory: ./rascal-lsp
run: mvn -B clean verify
env:
MAVEN_OPTS: "-Xmx6G"
- name: Append build id if pre-release
working-directory: ./rascal-vscode-extension
run: sed -i "s/\\(\"version\":.*\\)\\-head/\\1-head$GITHUB_RUN_NUMBER/" package.json
- name: Package & compile extension
working-directory: ./rascal-vscode-extension
run: |
npm ci
npm run license-check
npm run compile
npm run lint
npm run compile-tests
npm run normalTest
# disable vs-code test npm run test
- name: package extension
working-directory: rascal-vscode-extension
run: |
npm run lsp4j:package
npx vsce package
- uses: yogeshlonkar/wait-for-jobs@v0
with:
jobs: |
ui-test (windows-latest)
ui-test (macos-latest)
ui-test (buildjet-4vcpu-ubuntu-2204)
ttl: 15 # if it doesn' succeed in 15min, consider it a failure
- name: upload final vsix
uses: actions/upload-artifact@v3
with:
path: rascal-vscode-extension/*.vsix
retention-days: 20
- name: Publish release to Open VSX Registry
if: startsWith(github.ref, 'refs/tags/v')
uses: HaaLeo/publish-vscode-extension@v1
id: publishToOpenVSX
with:
packagePath: ./rascal-vscode-extension
pat: ${{ secrets.OPEN_VSX_ACCESS }}
registryUrl: https://open-vsx.org
- name: Publish release to Visual Studio Marketplace
if: startsWith(github.ref, 'refs/tags/v')
uses: HaaLeo/publish-vscode-extension@v1
with:
packagePath: ./rascal-vscode-extension
pat: ${{ secrets.AZURE_USETHESOURCE_PAT }}
registryUrl: https://marketplace.visualstudio.com
extensionFile: ${{ steps.publishToOpenVSX.outputs.vsixPath }} # copy exact same vsix from the previous step
- name: Prepare Draft Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
draft: true
files: ${{ steps.publishToOpenVSX.outputs.vsixPath }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: rewrite package.json & readme for NPM package
working-directory: rascal-vscode-extension
run: |
node src/rewritePackageForNPMPublish.js
rm -rf assets/images/ # remove non open source assets
# remove non-used jars
rm assets/jars/rascal-core.jar
rm assets/jars/typepal.jar
mv README-lib.md README.md
- name: Test compile for NPM
if: startsWith(github.ref, 'refs/tags/v') != true
working-directory: rascal-vscode-extension
run: npm run compile
- name: publish to NPM
if: startsWith(github.ref, 'refs/tags/v')
working-directory: rascal-vscode-extension
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish --access=public