Build and Test #215
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
# This yml is used for PRs, insiders build, and release build. | |
# We use the github.event_name to determine what started the workflow to determine which | |
# situation we are in. | |
name: Build and Test | |
permissions: | |
deployments: write | |
on: | |
pull_request: | |
branches: | |
- main | |
- 'release' | |
- 'release/*' | |
- 'release-*' | |
check_run: | |
types: [rerequested, requested_action] | |
push: | |
branches: | |
- main | |
- 'release' | |
- 'release/*' | |
- 'release-*' | |
schedule: | |
- cron: '0 9 * * 1-5' # 9am UTC, Monday-Friday (2am PDT, after VS Code Insider builds which is 11pm PDT) | |
workflow_dispatch: | |
env: | |
NODE_VERSION: 12.14.1 | |
PYTHON_VERSION: 3.8 | |
JULIA_VERSION: 1.5.2 | |
MOCHA_REPORTER_JUNIT: true # Use the mocha-multi-reporters and send output to both console (spec) and JUnit (mocha-junit-reporter). Also enables a reporter which exits the process running the tests if it haven't already. | |
CACHE_NPM_DEPS: cache-npm | |
CACHE_OUT_DIRECTORY: cache-out-directory | |
CACHE_PIP_DEPS: cache-pip | |
VSC_JUPYTER_FORCE_LOGGING: 'true' | |
VSC_JUPYTER_CI_RUN_NON_PYTHON_NB_TEST: 'true' | |
# Key for the cache created at the end of the the 'Cache ./pythonFiles/lib/python' step. | |
CACHE_PYTHONFILES: cache-pvsc-pythonFiles | |
COVERAGE_REPORTS: tests-coverage-reports | |
TEST_RESULTS_DIRECTORY: . | |
TEST_RESULTS_GLOB: '**/test-results*.xml' | |
IPYWIDGET_SCREENSHOT_PATH: '*-screenshot.png' | |
DISABLE_INSIDERS_EXTENSION: 1 # Disable prompts to install Insiders in tests (else it blocks activation of extension). | |
VSC_JUPYTER_INSTRUMENT_CODE_FOR_COVERAGE: true | |
jobs: | |
pick_environment: | |
name: Pick Environment | |
runs-on: ubuntu-latest | |
outputs: | |
vsix_name: ${{ env.vsix_name }} | |
test_matrix_os: ${{ env.test_matrix_os }} | |
release_channel: ${{ env.release_channel }} | |
if: github.repository == 'microsoft/vscode-jupyter' | |
steps: | |
- name: dump_event | |
run: | | |
echo "Event_name is ${{ github.event_name }}" | |
echo "Ref is ${{ github.ref }}" | |
- name: pr | |
if: github.event_name == 'pull_request' | |
run: | | |
echo "vsix_name=ms-toolsai-jupyter-insiders.vsix" >> $GITHUB_ENV | |
echo "test_matrix_os=[\"ubuntu-latest\"]" >> $GITHUB_ENV | |
- name: insiders | |
if: (github.event_name == 'push' || github.event_name == 'schedule') && github.ref == 'refs/heads/main' | |
# We're not running CI on macOS for now because it's one less matrix entry to lower the number of runners used, | |
# macOS runners are expensive, and we assume that Ubuntu is enough to cover the UNIX case. | |
run: | | |
echo "vsix_name=ms-toolsai-jupyter-insiders.vsix" >> $GITHUB_ENV | |
echo "test_matrix_os=[\"ubuntu-latest\", \"windows-latest\"]" >> $GITHUB_ENV | |
# - name: insiders channel | |
# # Scheduled builds will publish Insider builds. | |
# if: github.event_name == 'schedule' && github.ref == 'refs/heads/main' | |
# run: | | |
# echo "release_channel=insider" >> $GITHUB_ENV | |
- name: release | |
if: github.event_name == 'push' && contains(github.ref, 'refs/heads/release') | |
run: | | |
echo "vsix_name=ms-toolsai-jupyter-release.vsix" >> $GITHUB_ENV | |
echo "test_matrix_os=[\"ubuntu-latest\"]" >> $GITHUB_ENV | |
- name: release channel | |
# All pushes to release can push to marketplace place with the words `release` `publish` in commit. | |
if: github.event_name == 'push' && contains(github.ref, 'refs/heads/release') && contains(github.event.head_commit.message, 'release') && contains(github.event.head_commit.message, 'publish') | |
run: | | |
echo "release_channel=stable" >> $GITHUB_ENV | |
build-vsix: | |
needs: pick_environment | |
name: Build VSIX | |
runs-on: ubuntu-latest | |
# if: github.repository == 'microsoft/vscode-jupyter' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Use Node ${{env.NODE_VERSION}} | |
uses: actions/setup-node@v2.1.5 | |
with: | |
node-version: ${{env.NODE_VERSION}} | |
- name: Use Python ${{env.PYTHON_VERSION}} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{env.PYTHON_VERSION}} | |
# Caching of npm packages (https://github.com/actions/cache/blob/main/examples.md#node---npm) | |
- name: Cache npm on linux/mac | |
uses: actions/cache@v2.1.4 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install Python libs | |
run: | | |
python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade -r ./requirements.txt | |
- name: Build VSIX | |
uses: ./.github/actions/build-vsix | |
id: build-vsix | |
- name: Rename VSIX for release branch | |
if: steps.build-vsix.outputs.path != needs.pick_environment.outputs.vsix_name | |
run: mv ${{ steps.build-vsix.outputs.path }} ${{ needs.pick_environment.outputs.vsix_name }} | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: ${{needs.pick_environment.outputs.vsix_name}} | |
path: ${{needs.pick_environment.outputs.vsix_name}} | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
if: github.repository == 'microsoft/vscode-jupyter' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Cache pip files | |
uses: actions/cache@v2.1.4 | |
with: | |
path: ~/.cache/pip | |
key: ${{runner.os}}-${{env.CACHE_PIP_DEPS}}-${{env.PYTHON_VERSION}} | |
- name: Cache npm files | |
uses: actions/cache@v2.1.4 | |
with: | |
path: ~/.npm | |
key: ${{runner.os}}-${{env.CACHE_NPM_DEPS}}-${{hashFiles('package-lock.json')}} | |
- name: Install dependencies (npm ci) | |
run: npm ci --prefer-offline | |
- name: Verify linting is turned on for changed files | |
uses: ./.github/actions/check-ignore-list | |
id: check-ignore-list | |
- name: Run linting on TypeScript code (eslint) | |
run: npm run lint | |
- name: Run prettier on TypeScript code | |
run: npx prettier 'src/**/*.ts*' --check | |
- name: Run prettier on JavaScript code | |
run: npx prettier 'build/**/*.js' --check | |
- name: Use Python ${{env.PYTHON_VERSION}} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{env.PYTHON_VERSION}} | |
- name: Run Black on Python code | |
run: | | |
python -m pip install -U black | |
python -m black . --check | |
working-directory: pythonFiles | |
- name: Run gulp prePublishNonBundle | |
run: npx gulp prePublishNonBundle | |
- name: Cache the out/ directory | |
uses: actions/cache@v2.1.4 | |
with: | |
path: ./out | |
key: ${{runner.os}}-${{env.CACHE_OUT_DIRECTORY}}-${{hashFiles('src/**')}} | |
- name: Check dependencies | |
run: npm run checkDependencies | |
vsc_api_check: | |
needs: pick_environment | |
name: VSC Stable & Proposed API | |
runs-on: ${{ matrix.os }} | |
if: github.repository == 'microsoft/vscode-jupyter' | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ${{fromJson(needs.pick_environment.outputs.test_matrix_os)}} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Use Node ${{env.NODE_VERSION}} | |
uses: actions/setup-node@v2.1.5 | |
with: | |
node-version: ${{env.NODE_VERSION}} | |
# Caching of npm packages (https://github.com/actions/cache/blob/main/examples.md#node---npm) | |
- name: Cache npm on linux/mac | |
uses: actions/cache@v2.1.4 | |
if: matrix.os != 'windows-latest' | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Get npm cache directory | |
if: matrix.os == 'windows-latest' | |
id: npm-cache | |
run: | | |
echo "::set-output name=dir::$(npm config get cache)" | |
- name: Cache npm on windows | |
uses: actions/cache@v2.1.4 | |
if: matrix.os == 'windows-latest' | |
with: | |
path: ${{ steps.npm-cache.outputs.dir }} | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Cache compiled TS files | |
# Use an id for this step so that its cache-hit output can be accessed and checked in the next step. | |
id: out-cache | |
uses: actions/cache@v2.1.4 | |
with: | |
path: ./out | |
key: ${{runner.os}}-${{env.CACHE_OUT_DIRECTORY}}-${{hashFiles('src/**')}} | |
- name: Install dependencies (npm ci) | |
run: npm ci --prefer-offline | |
- name: Install Stable + Proposed API | |
run: npm run download-api | |
- name: Compile if not cached | |
run: npx gulp prePublishNonBundle | |
env: | |
CI_JUPYTER_FAST_COMPILATION: 'true' | |
ts_tests: | |
needs: pick_environment | |
name: Type Script Tests | |
runs-on: ${{ matrix.os }} | |
if: github.repository == 'microsoft/vscode-jupyter' | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ${{fromJson(needs.pick_environment.outputs.test_matrix_os)}} | |
test-suite: [ts-unit] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Use Node ${{env.NODE_VERSION}} | |
uses: actions/setup-node@v2.1.5 | |
with: | |
node-version: ${{env.NODE_VERSION}} | |
# Caching of npm packages (https://github.com/actions/cache/blob/main/examples.md#node---npm) | |
- name: Cache npm on linux/mac | |
uses: actions/cache@v2.1.4 | |
if: matrix.os != 'windows-latest' | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Get npm cache directory | |
if: matrix.os == 'windows-latest' | |
id: npm-cache | |
run: | | |
echo "::set-output name=dir::$(npm config get cache)" | |
- name: Cache npm on windows | |
uses: actions/cache@v2.1.4 | |
if: matrix.os == 'windows-latest' | |
with: | |
path: ${{ steps.npm-cache.outputs.dir }} | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Cache compiled TS files | |
# Use an id for this step so that its cache-hit output can be accessed and checked in the next step. | |
id: out-cache | |
uses: actions/cache@v2.1.4 | |
with: | |
path: ./out | |
key: ${{runner.os}}-${{env.CACHE_OUT_DIRECTORY}}-${{hashFiles('src/**')}} | |
- name: Install dependencies (npm ci) | |
run: npm ci --prefer-offline | |
- name: Compile if not cached | |
run: npx gulp prePublishNonBundle | |
env: | |
CI_JUPYTER_FAST_COMPILATION: 'true' | |
# if: steps.out-cache.outputs.cache-hit == false | |
- name: Run TypeScript unit tests | |
id: test_unittests | |
run: npm run test:unittests | |
- name: Publish Test Report | |
uses: scacap/action-surefire-report@v1 | |
if: steps.test_unittests.outcome == 'failure' && failure() | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
report_paths: ${{ env.TEST_RESULTS_GLOB }} | |
check_name: Ts-Unit Test Report | |
# Upload unit test coverage reports for later use in the "reports" job. | |
- name: Upload unit test coverage reports | |
uses: actions/upload-artifact@v2 | |
if: "(success() || failure()) && !contains(github.ref, 'refs/heads/release')" | |
with: | |
name: ${{runner.os}}-${{env.COVERAGE_REPORTS}} | |
path: .nyc_output | |
retention-days: 1 | |
tests: | |
needs: pick_environment | |
name: Functional Jupyter Tests | |
runs-on: ${{ matrix.os }} | |
if: github.repository == 'microsoft/vscode-jupyter' | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ${{fromJson(needs.pick_environment.outputs.test_matrix_os)}} | |
python: [3.8] | |
test-suite: [group1, group2, group3, group4] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Use conda for group1 and group3 | |
if: matrix.test-suite == 'group1' || matrix.test-suite == 'group3' | |
run: | | |
echo "conda_python=true" >> $GITHUB_ENV | |
- name: Use Python ${{matrix.python}} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{matrix.python}} | |
- name: Use Conda Python ${{matrix.python}} | |
uses: conda-incubator/setup-miniconda@v2 | |
if: env.conda_python | |
with: | |
auto-update-conda: true | |
activate-environment: functional_test_env | |
python-version: ${{matrix.python}} | |
- name: Set CI Path | |
uses: ./.github/actions/set-python | |
id: set-python | |
if: env.conda_python == '' | |
with: | |
PYTHON_VERSION: ${{matrix.python}} | |
- name: Set CI Path for Conda | |
uses: ./.github/actions/set-python-conda | |
id: set-python-conda | |
if: env.conda_python | |
with: | |
PYTHON_VERSION: ${{matrix.python}} | |
- name: Upgrade pip | |
run: python -m pip install -U pip | |
- name: Show python version | |
run: python --version | |
- name: Use Node ${{env.NODE_VERSION}} | |
uses: actions/setup-node@v2.1.5 | |
with: | |
node-version: ${{env.NODE_VERSION}} | |
# Start caching | |
# Cache Python Dependencies. | |
# Caching (https://github.com/actions/cache/blob/main/examples.md#python---pip | |
- name: Cache pip on linux | |
uses: actions/cache@v2.1.4 | |
if: matrix.os == 'ubuntu-latest' | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{env.PYTHON_VERSION}}-${{ hashFiles('requirements.txt') }}-${{hashFiles('build/debugger-install-requirements.txt')}}-${{hashFiles('test-requirements.txt')}}-${{hashFiles('ipython-test-requirements.txt')}}-${{hashFiles('functional-test-requirements.txt')}}-${{hashFiles('conda-functional-requirements.txt')}} | |
restore-keys: | | |
${{ runner.os }}-pip-${{env.PYTHON_VERSION}}- | |
- name: Cache pip on mac | |
uses: actions/cache@v2.1.4 | |
if: matrix.os == 'macos-latest' | |
with: | |
path: ~/Library/Caches/pip | |
key: ${{ runner.os }}-pip-${{env.PYTHON_VERSION}}-${{ hashFiles('requirements.txt') }}-${{hashFiles('build/debugger-install-requirements.txt')}}-${{hashFiles('test-requirements.txt')}}-${{hashFiles('ipython-test-requirements.txt')}}-${{hashFiles('functional-test-requirements.txt')}}-${{hashFiles('conda-functional-requirements.txt')}} | |
restore-keys: | | |
${{ runner.os }}-pip-${{env.PYTHON_VERSION}}- | |
- name: Cache pip on windows | |
uses: actions/cache@v2.1.4 | |
if: matrix.os == 'windows-latest' | |
with: | |
path: ~\AppData\Local\pip\Cache | |
key: ${{ runner.os }}-pip-${{env.PYTHON_VERSION}}-${{ hashFiles('requirements.txt') }}-${{hashFiles('build/debugger-install-requirements.txt')}}-${{hashFiles('test-requirements.txt')}}-${{hashFiles('ipython-test-requirements.txt')}}-${{hashFiles('functional-test-requirements.txt')}}-${{hashFiles('conda-functional-requirements.txt')}} | |
restore-keys: | | |
${{ runner.os }}-pip-${{env.PYTHON_VERSION}}- | |
# Caching of npm packages (https://github.com/actions/cache/blob/main/examples.md#node---npm) | |
- name: Cache npm on linux/mac | |
uses: actions/cache@v2.1.4 | |
if: matrix.os != 'windows-latest' | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Get npm cache directory | |
if: matrix.os == 'windows-latest' | |
id: npm-cache | |
run: | | |
echo "::set-output name=dir::$(npm config get cache)" | |
- name: Cache npm on windows | |
uses: actions/cache@v2.1.4 | |
if: matrix.os == 'windows-latest' | |
with: | |
path: ${{ steps.npm-cache.outputs.dir }} | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Cache compiled TS files | |
id: out-cache | |
uses: actions/cache@v2.1.4 | |
with: | |
path: ./out | |
key: ${{runner.os}}-${{env.CACHE_OUT_DIRECTORY}}-${{hashFiles('src/**')}} | |
# For faster/better builds of sdists. | |
- run: python -m pip install wheel | |
shell: bash | |
# debugpy is not shipped, only installed for local tests. | |
# In production, we get debugpy from python extension. | |
# Use specific version of Jedi https://github.com/ipython/ipython/issues/12740 | |
- name: Install Python Libs | |
if: env.conda_python == '' | |
run: | | |
python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade -r ./requirements.txt | |
python -m pip --disable-pip-version-check install -r build/debugger-install-requirements.txt | |
python ./pythonFiles/install_debugpy.py | |
python -m pip install numpy | |
python -m pip install --upgrade jupyter | |
python -m pip install --upgrade -r build/test-requirements.txt | |
python -m pip install --upgrade -r ./build/ipython-test-requirements.txt | |
python -m pip install --upgrade -r ./build/conda-functional-requirements.txt | |
python -m ipykernel install --user | |
python -m pip install tensorflow | |
python -m pip uninstall jedi --yes | |
python -m pip install jedi==0.17.2 | |
# Use specific version of Jedi https://github.com/ipython/ipython/issues/12740 | |
- name: Install Python Libs for conda | |
shell: bash -l {0} | |
if: env.conda_python | |
run: | | |
conda activate functional_test_env | |
python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade -r ./requirements.txt | |
python -m pip --disable-pip-version-check install -r build/debugger-install-requirements.txt | |
python ./pythonFiles/install_debugpy.py | |
conda env update --file ./build/conda-functional-requirements.yml | |
python -m pip install --upgrade -r ./build/conda-functional-requirements.txt | |
python -m pip uninstall jedi --yes | |
python -m pip install jedi==0.17.2 | |
conda install pytorch cpuonly -c pytorch | |
# Install PyTorch with pip | |
- name: Install PyTorch on Windows and Linux | |
if: matrix.python != 'conda' && matrix.python != 'noPython' && (matrix.os == 'windows-latest' || matrix.os == 'ubuntu-latest') | |
run: pip install torch==1.7.1+cpu torchvision==0.8.2+cpu torchaudio===0.7.2 -f https://download.pytorch.org/whl/torch_stable.html | |
- name: Install PyTorch on Mac | |
if: matrix.python != 'conda' && matrix.python != 'noPython' && matrix.os == 'macos-latest' | |
run: pip install torch torchvision torchaudio | |
- name: Use Conda Python ${{matrix.python}} | |
uses: conda-incubator/setup-miniconda@v2 | |
if: env.conda_python | |
with: | |
auto-update-conda: true | |
activate-environment: functional_test_env_2 | |
python-version: ${{matrix.python}} | |
- name: Install secondary conda environment | |
shell: bash -l {0} | |
if: env.conda_python | |
run: | | |
conda activate functional_test_env_2 | |
python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade -r ./requirements.txt | |
python -m pip --disable-pip-version-check install -r build/debugger-install-requirements.txt | |
python ./pythonFiles/install_debugpy.py | |
conda env update --file ./build/conda-functional-requirements.yml | |
python -m pip install --upgrade -r ./build/conda-functional-requirements.txt | |
conda install pytorch cpuonly -c pytorch | |
# This step is slow. | |
- name: Install dependencies (npm ci) | |
run: npm ci --prefer-offline | |
# This step is slow. | |
- name: Compile if not cached | |
run: npx gulp prePublishNonBundle | |
- name: Run functional tests | |
shell: bash -l {0} | |
run: npm run test:functional:parallel -- --${{matrix.test-suite}} | |
env: | |
VSC_FORCE_REAL_JUPYTER: 1 | |
VSC_JUPYTER_FORCE_LOGGING: 1 | |
id: test_functional_group | |
- name: Upload screenshots | |
uses: actions/upload-artifact@v2 | |
if: steps.test_functional_group.outcome == 'failure' && failure() | |
with: | |
path: './${{env.IPYWIDGET_SCREENSHOT_PATH}}' | |
- name: Publish Test Report | |
uses: scacap/action-surefire-report@v1 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
report_paths: ${{ env.TEST_RESULTS_GLOB }} | |
check_name: Functional Test Report ${{matrix.test-suite}} ${{matrix.os}} | |
if: steps.test_functional_group.outcome == 'failure' && failure() | |
# Upload unit test coverage reports for later use in the "reports" job. | |
- name: Upload unit test coverage reports | |
uses: actions/upload-artifact@v2 | |
if: "(success() || failure()) && !contains(github.ref, 'refs/heads/release')" | |
with: | |
name: ${{runner.os}}-${{env.COVERAGE_REPORTS}} | |
path: .nyc_output | |
retention-days: 1 | |
vscodeTests: | |
name: VS Code Tests # These tests run with Python extension & real Jupyter | |
runs-on: ${{ matrix.os }} | |
if: github.repository == 'microsoft/vscode-jupyter' | |
env: | |
VSC_FORCE_REAL_JUPYTER: 1 | |
VSC_JUPYTER_CI_RUN_NON_PYTHON_NB_TEST: 1 | |
strategy: | |
fail-fast: false | |
matrix: | |
# We're not running CI on macOS for now because it's one less matrix entry to lower the number of runners used, | |
# macOS runners are expensive, and we assume that Ubuntu is enough to cover the UNIX case. | |
os: [ubuntu-latest] | |
pythonVersion: [3.8] | |
python: [nonConda, conda] | |
jupyter: [raw, local, remote] | |
# integration: Tests with VS Code, Python extension & real Jupyter | |
# notebook: Notebook Tests with VS Code, Python extension & real Jupyter | |
# notebookAndWebview: Tests with VS Code (possible Notebooks), WebViews, Python extension & real Jupyter | |
test-suite: [integration, notebook] | |
# More details on includes/excludes can be found here https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-including-additional-values-into-combinations | |
# Basically with exclude, you can exclude any of the combinations from the result matrix. | |
# & with include, you can include additional items to the result matrix. | |
exclude: | |
- os: ubuntu-latest # We don't care how users start Remote Jupyter as long as it works. | |
# With this, we're saying from the result matrix, remove the combination that has python 3.8, remote, integration on ubuntu. | |
pythonVersion: '3.8' | |
jupyter: remote | |
test-suite: integration | |
- os: ubuntu-latest # We don't care how users start Remote Jupyter as long as it works. | |
pythonVersion: '3.8' | |
python: conda | |
jupyter: remote | |
test-suite: notebook | |
include: | |
- os: ubuntu-latest | |
pythonVersion: '3.8' | |
python: nonConda | |
jupyter: raw | |
test-suite: notebookAndWebview # Test webview only with raw & non-conda. | |
- os: ubuntu-latest | |
jupyter: raw | |
python: noPython | |
test-suite: notebook # Non-Python kernel tests without Python extension only when using Raw & notebook tests | |
# - test-suite: integration | |
# jupyter: raw | |
# pythonVersion: '3.8' | |
# python: nonConda | |
# os: windows-latest | |
# - test-suite: notebook | |
# pythonVersion: '3.8' | |
# python: nonConda | |
# jupyter: raw | |
# os: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Use Python ${{matrix.pythonVersion}} | |
uses: actions/setup-python@v2 | |
if: matrix.python != 'conda' && matrix.python != 'noPython' | |
with: | |
python-version: ${{matrix.pythonVersion}} | |
- name: Use Conda Python ${{matrix.pythonVersion}} | |
uses: conda-incubator/setup-miniconda@v2 | |
if: matrix.python == 'conda' | |
with: | |
auto-update-conda: true | |
activate-environment: functional_test_env | |
python-version: ${{matrix.pythonVersion}} | |
- name: Set CI Path | |
uses: ./.github/actions/set-python | |
id: set-python | |
if: matrix.python != 'conda' && matrix.python != 'noPython' | |
with: | |
PYTHON_VERSION: ${{matrix.pythonVersion}} | |
- name: Set CI Path for Conda | |
uses: ./.github/actions/set-python-conda | |
id: set-python-conda | |
if: matrix.python == 'conda' | |
with: | |
PYTHON_VERSION: ${{matrix.pythonVersion}} | |
- name: Upgrade pip | |
run: python -m pip install -U pip | |
if: matrix.python != 'conda' && matrix.python != 'noPython' | |
- name: Use Node ${{env.NODE_VERSION}} | |
uses: actions/setup-node@v2.1.5 | |
with: | |
node-version: ${{env.NODE_VERSION}} | |
# Start caching | |
# Cache Python Dependencies. | |
# Caching (https://github.com/actions/cache/blob/main/examples.md#python---pip | |
- name: Cache pip on linux | |
uses: actions/cache@v2.1.4 | |
if: matrix.os == 'ubuntu-latest' && matrix.python != 'conda' && matrix.python != 'noPython' | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{env.PYTHON_VERSION}}-${{ hashFiles('requirements.txt') }}-${{hashFiles('build/debugger-install-requirements.txt')}}-${{hashFiles('test-requirements.txt')}}-${{hashFiles('ipython-test-requirements.txt')}}-${{hashFiles('functional-test-requirements.txt')}}-${{hashFiles('conda-functional-requirements.txt')}} | |
restore-keys: | | |
${{ runner.os }}-pip-${{env.PYTHON_VERSION}}- | |
- name: Cache pip on mac | |
uses: actions/cache@v2.1.4 | |
if: matrix.os == 'macos-latest' && matrix.python != 'conda' && matrix.python != 'noPython' | |
with: | |
path: ~/Library/Caches/pip | |
key: ${{ runner.os }}-pip-${{env.PYTHON_VERSION}}-${{ hashFiles('requirements.txt') }}-${{hashFiles('build/debugger-install-requirements.txt')}}-${{hashFiles('test-requirements.txt')}}-${{hashFiles('ipython-test-requirements.txt')}}-${{hashFiles('functional-test-requirements.txt')}}-${{hashFiles('conda-functional-requirements.txt')}} | |
restore-keys: | | |
${{ runner.os }}-pip-${{env.PYTHON_VERSION}}- | |
- name: Cache pip on windows | |
uses: actions/cache@v2.1.4 | |
if: matrix.os == 'windows-latest' && matrix.python != 'conda' && matrix.python != 'noPython' | |
with: | |
path: ~\AppData\Local\pip\Cache | |
key: ${{ runner.os }}-pip-${{env.PYTHON_VERSION}}-${{ hashFiles('requirements.txt') }}-${{hashFiles('build/debugger-install-requirements.txt')}}-${{hashFiles('test-requirements.txt')}}-${{hashFiles('ipython-test-requirements.txt')}}-${{hashFiles('functional-test-requirements.txt')}}-${{hashFiles('conda-functional-requirements.txt')}} | |
restore-keys: | | |
${{ runner.os }}-pip-${{env.PYTHON_VERSION}}- | |
# Caching of npm packages (https://github.com/actions/cache/blob/main/examples.md#node---npm) | |
- name: Cache npm on linux/mac | |
uses: actions/cache@v2.1.4 | |
if: matrix.os != 'windows-latest' | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Get npm cache directory | |
if: matrix.os == 'windows-latest' | |
id: npm-cache | |
run: | | |
echo "::set-output name=dir::$(npm config get cache)" | |
- name: Cache npm on windows | |
uses: actions/cache@v2.1.4 | |
if: matrix.os == 'windows-latest' | |
with: | |
path: ${{ steps.npm-cache.outputs.dir }} | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Cache compiled TS files | |
id: out-cache | |
uses: actions/cache@v2.1.4 | |
with: | |
path: ./out | |
key: ${{runner.os}}-${{env.CACHE_OUT_DIRECTORY}}-${{hashFiles('src/**')}} | |
# For faster/better builds of sdists. | |
- run: python -m pip install wheel | |
shell: bash | |
if: matrix.python != 'conda' && matrix.python != 'noPython' | |
# debugpy is not shipped, only installed for local tests. | |
# In production, we get debugpy from python extension. | |
# Use specific version of Jedi https://github.com/ipython/ipython/issues/12740 | |
- name: Install Python Libs | |
if: matrix.python != 'conda' && matrix.python != 'noPython' | |
run: | | |
python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade -r ./requirements.txt | |
python -m pip --disable-pip-version-check install -r build/debugger-install-requirements.txt | |
python ./pythonFiles/install_debugpy.py | |
python -m pip install numpy | |
python -m pip install nbformat==5.0.8 | |
python -m pip install --upgrade jupyter | |
python -m pip install --upgrade -r build/test-requirements.txt | |
python -m pip install --upgrade -r ./build/ipython-test-requirements.txt | |
python -m pip install --upgrade -r ./build/conda-functional-requirements.txt | |
python -m ipykernel install --user | |
python -m pip uninstall jedi --yes | |
python -m pip install jedi==0.17.2 | |
# Use specific version of Jedi https://github.com/ipython/ipython/issues/12740 | |
- name: Install Python Libs for conda | |
shell: bash -l {0} | |
if: matrix.python == 'conda' | |
run: | | |
conda activate functional_test_env | |
python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade -r ./requirements.txt | |
python -m pip --disable-pip-version-check install -r build/debugger-install-requirements.txt | |
python ./pythonFiles/install_debugpy.py | |
conda env update --file ./build/conda-functional-requirements.yml | |
python -m pip install --upgrade -r ./build/conda-functional-requirements.txt | |
python -m pip uninstall jedi --yes | |
python -m pip install jedi==0.17.2 | |
beakerx_kernel_java install | |
conda install pytorch cpuonly -c pytorch | |
# Install PyTorch with pip | |
- name: Install PyTorch on Windows and Linux | |
if: matrix.python != 'conda' && matrix.python != 'noPython' && (matrix.os == 'windows-latest' || matrix.os == 'ubuntu-latest') | |
run: pip install torch==1.7.1+cpu torchvision==0.8.2+cpu torchaudio===0.7.2 -f https://download.pytorch.org/whl/torch_stable.html | |
- name: Install PyTorch on Mac | |
if: matrix.python == 'conda' && matrix.os == 'macos-latest' | |
run: pip install torch torchvision torchaudio | |
# This step is slow. | |
- name: Install dependencies (npm ci) | |
run: npm ci --prefer-offline | |
- name: Install screen capture dependencies | |
if: matrix.os == 'ubuntu-latest' | |
run: sudo apt-get install imagemagick | |
- name: Install screen capture | |
run: npm i -D screenshot-desktop | |
# Check to see if we should build webviews or not | |
- name: Check if we need to build webviews | |
if: matrix.test-suite != 'integration' && matrix.test-suite != 'notebookAndWebview' | |
run: echo "VSC_JUPYTER_SKIP_WEBVIEW_BUILD=true" >> $GITHUB_ENV | |
# This step is slow. | |
- name: Compile if not cached | |
run: npx gulp prePublishNonBundle | |
env: | |
VSC_CI_MATRIX_TEST_SUITE: ${{matrix.test-suite}} | |
CI_JUPYTER_FAST_COMPILATION: 'true' | |
# Used by tests for non-python kernels. | |
# Test are enabled via env variable `VSC_JUPYTER_CI_RUN_NON_PYTHON_NB_TEST` | |
- name: Install Julia | |
uses: julia-actions/setup-julia@v1 | |
with: | |
version: ${{env.JULIA_VERSION}} | |
- name: Install Julia Kernel | |
shell: bash | |
run: | | |
julia -e ' | |
using Pkg | |
Pkg.add("IJulia")' | |
- name: Install Dot.net | |
uses: actions/setup-dotnet@v1.8.0 | |
with: | |
dotnet-version: ${{env.DOTNET_VERSION}} | |
if: (matrix.test-suite == 'integration' || matrix.test-suite == 'notebook') | |
- name: Install .NET Interactive | |
shell: bash -l {0} | |
run: dotnet tool install -g --add-source "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" Microsoft.dotnet-interactive | |
if: (matrix.test-suite == 'integration' || matrix.test-suite == 'notebook') | |
- name: Install .NET Kernel | |
shell: bash -l {0} | |
run: dotnet interactive jupyter install | |
if: (matrix.test-suite == 'integration' || matrix.test-suite == 'notebook') | |
- name: Create Virtual Env for Tests | |
uses: ./.github/actions/create-venv-for-tests | |
if: matrix.python != 'conda' && matrix.python != 'noPython' && matrix.os != 'windows-latest' && matrix.jupyter != 'remote' | |
# Set the correct xvfb commands to run vscode tests | |
# https://code.visualstudio.com/api/working-with-extensions/continuous-integration | |
# Note that xvfb github action only runs through xvfb on linux, so only set the commands there | |
# as on windows / mac they would get directly passed to run, not xvfb-run | |
- name: Set xvfb parameters linux | |
if: matrix.os == 'ubuntu-latest' | |
run: echo "xvfbCommand=--server-args=\"-screen 0 1024x768x24\"" >> $GITHUB_ENV | |
- name: Run tests with VSCode & Jupyter | |
uses: GabrielBB/xvfb-action@v1.4 | |
with: | |
run: ${{ env.xvfbCommand }} npm run testVSCode | |
env: | |
VSC_FORCE_REAL_JUPYTER: 1 | |
VSC_JUPYTER_FORCE_LOGGING: 1 | |
VSC_JUPYTER_CI_RUN_NON_PYTHON_NB_TEST: 1 | |
id: test_vscode | |
if: matrix.test-suite == 'integration' && matrix.python != 'noPython' | |
- name: Publish VSCode Test Report | |
uses: scacap/action-surefire-report@v1 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
report_paths: ${{ env.TEST_RESULTS_GLOB }} | |
check_name: VSCode Test Report | |
if: (steps.test_vscode.outcome == 'failure' || steps.test_vscode.outcome == 'failure') && failure() | |
- name: Run Native Notebook with VSCode & Jupyter | |
uses: GabrielBB/xvfb-action@v1.4 | |
with: | |
run: ${{ env.xvfbCommand }} npm run testNativeNotebooksInVSCode | |
env: | |
VSC_FORCE_REAL_JUPYTER: 1 | |
VSC_JUPYTER_FORCE_LOGGING: 1 | |
VSC_PYTHON_FORCE_LOGGING: 1 | |
VSC_JUPYTER_CI_RUN_NON_PYTHON_NB_TEST: 1 | |
VSC_JUPYTER_REMOTE_NATIVE_TEST: ${{ matrix.jupyter == 'remote' }} | |
VSC_JUPYTER_NON_RAW_NATIVE_TEST: ${{ matrix.jupyter == 'local' }} | |
VSC_JUPYTER_CI_RUN_JAVA_NB_TEST: ${{ matrix.python == 'conda' }} | |
VSC_JUPYTER_CI_IS_CONDA: ${{ matrix.python == 'conda' }} | |
VSC_JUPYTER_CI_TEST_VSC_CHANNEL: 'insiders' | |
id: test_notebook_vscode | |
if: matrix.test-suite == 'notebook' && matrix.python != 'noPython' | |
- name: Publish Notebook Test Report | |
uses: scacap/action-surefire-report@v1 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
report_paths: ${{ env.TEST_RESULTS_GLOB }} | |
check_name: Notebook Test Report ${{matrix.os}} ${{matrix.pythonVersion}} ${{matrix.python}} ${{matrix.jupyter}} ${{matrix.test-suite}} | |
if: steps.test_notebook_vscode.outcome == 'failure' && failure() | |
- name: Run Native Notebook with VSCode & Jupyter (without Python) | |
uses: GabrielBB/xvfb-action@v1.4 | |
with: | |
run: ${{ env.xvfbCommand }} npm run testNativeNotebooksWithoutPythonInVSCode | |
env: | |
VSC_FORCE_REAL_JUPYTER: 1 | |
VSC_JUPYTER_FORCE_LOGGING: 1 | |
VSC_JUPYTER_CI_RUN_NON_PYTHON_NB_TEST: 1 | |
VSC_JUPYTER_CI_TEST_VSC_CHANNEL: 'insiders' | |
id: test_notebookWithoutPythonExt_vscode | |
if: matrix.python == 'noPython' && matrix.os != 'windows-latest' | |
- name: Publish Notebook Test Report | |
uses: scacap/action-surefire-report@v1 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
report_paths: ${{ env.TEST_RESULTS_GLOB }} | |
check_name: Notebook without Python Test Report ${{matrix.os}} ${{matrix.pythonVersion}} ${{matrix.python}} ${{matrix.jupyter}} ${{matrix.test-suite}} | |
if: steps.test_notebookWithoutPythonExt_vscode.outcome == 'failure' && failure() | |
# Run native notebook tests that also require webviews | |
# note, Webview test middleware on, and webview build not skipped | |
- name: Run Native Notebook and Webview tests with VSCode & Jupyter | |
uses: GabrielBB/xvfb-action@v1.4 | |
with: | |
run: ${{ env.xvfbCommand }} npm run testNativeNotebooksAndWebviews | |
env: | |
VSC_FORCE_REAL_JUPYTER: 1 | |
VSC_JUPYTER_FORCE_LOGGING: 1 | |
VSC_PYTHON_FORCE_LOGGING: 1 | |
VSC_JUPYTER_WEBVIEW_TEST_MIDDLEWARE: 'true' | |
VSC_JUPYTER_REMOTE_NATIVE_TEST: 'false' | |
VSC_JUPYTER_NON_RAW_NATIVE_TEST: 'false' | |
VSC_JUPYTER_CI_RUN_JAVA_NB_TEST: 'false' | |
VSC_JUPYTER_CI_TEST_VSC_CHANNEL: 'insiders' | |
id: test_notebook_webview_vscode | |
if: matrix.test-suite == 'notebookAndWebview' && matrix.python != 'noPython' | |
- name: Publish Notebook Test Report | |
uses: scacap/action-surefire-report@v1 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
report_paths: ${{ env.TEST_RESULTS_GLOB }} | |
check_name: Notebook Test Report ${{matrix.os}} ${{matrix.pythonVersion}} ${{matrix.python}} ${{matrix.jupyter}} ${{matrix.test-suite}} | |
if: steps.test_notebook_webview_vscode.outcome == 'failure' && failure() | |
# Upload unit test coverage reports for later use in the "reports" job. | |
- name: Upload unit test coverage reports | |
uses: actions/upload-artifact@v2 | |
if: "(success() || failure()) && !contains(github.ref, 'refs/heads/release')" | |
with: | |
name: ${{runner.os}}-${{env.COVERAGE_REPORTS}} | |
path: .nyc_output | |
retention-days: 1 | |
- name: Upload screenshots | |
uses: actions/upload-artifact@v2 | |
if: always() | |
with: | |
name: Screenshots-${{matrix.os}}-${{matrix.pythonVersion}}-${{matrix.python}}-${{matrix.jupyter}}-${{matrix.test-suite}} | |
path: './${{env.IPYWIDGET_SCREENSHOT_PATH}}' | |
retention-days: 1 | |
smoke-tests: | |
timeout-minutes: 30 | |
name: Smoke tests | |
# The value of runs-on is the OS of the current job (specified in the strategy matrix below) instead of being hardcoded. | |
runs-on: ${{ matrix.os }} | |
if: github.repository == 'microsoft/vscode-jupyter' | |
needs: [build-vsix, pick_environment] | |
env: | |
VSIX_NAME: ${{ needs.pick_environment.outputs.vsix_name }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
python: [3.8] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Use Python ${{matrix.python}} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{matrix.python}} | |
- name: Set CI Path | |
uses: ./.github/actions/set-python | |
id: set-python | |
with: | |
PYTHON_VERSION: ${{matrix.python}} | |
- name: Upgrade pip | |
run: python -m pip install -U pip | |
- name: Use Node ${{env.NODE_VERSION}} | |
uses: actions/setup-node@v2.1.5 | |
with: | |
node-version: ${{env.NODE_VERSION}} | |
- name: Download VSIX | |
uses: actions/download-artifact@v2 | |
with: | |
name: ${{needs.pick_environment.outputs.vsix_name}} | |
- name: Install dependencies (npm ci) | |
run: npm ci --prefer-offline | |
- name: pip install system test requirements | |
run: | | |
python -m pip install --upgrade -r build/test-requirements.txt | |
python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade -r requirements.txt | |
shell: bash | |
- name: pip install smoke test requirements | |
run: | | |
python -m pip install --upgrade -r build/smoke-test-requirements.txt | |
shell: bash | |
# Compile the test files. | |
- name: Prepare for smoke tests | |
run: npx tsc -p ./ | |
shell: bash | |
- name: Run smoke tests | |
env: | |
DISPLAY: 10 | |
uses: GabrielBB/xvfb-action@v1.4 | |
with: | |
run: npm run testSmokeLogged | |
- name: Upload smoke-test log | |
uses: actions/upload-artifact@v2 | |
if: failure() | |
with: | |
name: smoke-test-${{matrix.os}}.log | |
path: './smoke-test.log' | |
# Upload unit test coverage reports for later use in the "reports" job. | |
- name: Upload unit test coverage reports | |
uses: actions/upload-artifact@v2 | |
if: always() | |
with: | |
name: ${{runner.os}}-${{env.COVERAGE_REPORTS}} | |
path: .nyc_output | |
retention-days: 1 | |
coverage: | |
name: Coverage reports upload | |
runs-on: ubuntu-latest | |
if: "(success() || failure()) && !contains(github.ref, 'refs/heads/release')" | |
needs: [ts_tests, vscodeTests, smoke-tests, tests] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Install Node | |
uses: actions/setup-node@v2.1.5 | |
with: | |
node-version: ${{env.NODE_VERSION}} | |
- name: Install dependencies (npm ci) | |
run: npm ci --prefer-offline | |
- name: Cache compiled TS files | |
id: out-cache | |
uses: actions/cache@v2.1.4 | |
with: | |
path: ./out | |
key: ${{runner.os}}-${{env.CACHE_OUT_DIRECTORY}}-${{hashFiles('src/**')}} | |
- name: Compile if not cached | |
run: npx gulp prePublishNonBundle | |
env: | |
CI_JUPYTER_FAST_COMPILATION: 'true' | |
# It isn't possible to specify a regex for artifact names, so we have to download each artifact manually. | |
# The name pattern is ${{runner.os}}-${{env.COVERAGE_REPORTS}}, and possible values for runner.os are `Linux`, `Windows`, or `macOS`. | |
# See https://help.github.com/en/actions/reference/contexts-and-expression-syntax-for-github-actions#runner-context | |
- name: Download Ubuntu test coverage artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: ${{runner.os}}-${{ env.COVERAGE_REPORTS }} | |
path: ${{runner.os}}-${{ env.COVERAGE_REPORTS }} | |
- name: Extract Ubuntu coverage artifacts to ./nyc_output | |
run: | | |
pwd | |
mkdir .nyc_output | |
mv ${{runner.os}}-${{ env.COVERAGE_REPORTS }}/* .nyc_output | |
rm -r ${{runner.os}}-${{ env.COVERAGE_REPORTS }} | |
- name: Merge coverage reports | |
run: | | |
pwd | |
npx nyc merge ./.nyc_output | |
rm -r .nyc_output | |
mkdir .nyc_output | |
mv coverage.json ./.nyc_output | |
continue-on-error: true | |
- name: Generate coverage reports | |
run: npm run test:cover:report | |
continue-on-error: true | |
- name: Upload coverage to codecov | |
uses: codecov/codecov-action@v1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./coverage/cobertura-coverage.xml | |
path_to_write_report: ./coverage/codecov_report.txt | |
# Alternative method for uploading | |
# - name: Upload coverage to codecov | |
# run: bash <(curl -s https://codecov.io/bash) -f ./coverage/cobertura-coverage.xml -v | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
# This should happen in the release and insiders branch | |
if: github.repository == 'microsoft/vscode-jupyter' && (needs.pick_environment.outputs.release_channel == 'insider' || needs.pick_environment.outputs.release_channel == 'stable') | |
needs: [pick_environment, build-vsix, lint, ts_tests, smoke-tests] | |
environment: | |
name: ${{needs.pick_environment.outputs.release_channel}} | |
steps: | |
- name: dump_event | |
run: | | |
echo "Event_name is ${{ github.event_name }}" | |
echo "Ref is ${{ github.ref }}" | |
echo "Release Channel (Environment) is is ${{needs.pick_environment.outputs.release_channel}}" | |
echo "VSIX Name is ${{ needs.pick_environment.outputs.vsix_name }}" | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Use Python ${{env.PYTHON_VERSION}} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{env.PYTHON_VERSION}} | |
- name: Use Node ${{env.NODE_VERSION}} | |
uses: actions/setup-node@v2.1.5 | |
with: | |
node-version: ${{env.NODE_VERSION}} | |
- run: npm i -g vsce | |
- name: Download VSIX | |
uses: actions/download-artifact@v2 | |
with: | |
name: ${{needs.pick_environment.outputs.vsix_name}} | |
- name: Publish | |
run: vsce publish --packagePath ${{needs.pick_environment.outputs.vsix_name}} --pat ${{secrets.VSCE_TOKEN}} --noVerify | |
- name: Extract Extension | |
if: needs.pick_environment.outputs.release_channel == 'stable' | |
shell: bash | |
run: | | |
python -c "import zipfile;zip=zipfile.ZipFile('${{needs.pick_environment.outputs.vsix_name}}', 'r');zip.extractall('tmp')" | |
- name: Get Version | |
if: needs.pick_environment.outputs.release_channel == 'stable' | |
id: version | |
run: | | |
echo ::set-output name=version::$(node -p -e "require('./package.json').version") | |
shell: bash | |
- name: Generate Changelog | |
if: needs.pick_environment.outputs.release_channel == 'stable' | |
# Just extract change log, anything between `\n## 20` (for each release we have a section with year and month..) | |
run: | | |
echo ::set-output name=changelog::$(node -p -e "let fs = require('fs');let changelog = fs.readFileSync('./CHANGELOG.md').toString();changelog = changelog.split('\n## 20')[1].split('\n').filter((_, index) => index > 0).join('\n');fs.writeFileSync('./RELEASE_CHANGELOG.md', changelog)") | |
shell: bash | |
- name: Print version | |
run: | | |
echo ${{steps.version.outputs.version}} | |
shell: bash | |
- name: Create GH Release | |
id: create_release | |
if: needs.pick_environment.outputs.release_channel == 'stable' | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{steps.version.outputs.version}} | |
release_name: Release ${{steps.version.outputs.version}} | |
body_path: RELEASE_CHANGELOG.md | |
draft: true | |
prerelease: false |