Skip to content

check

check #14157

Workflow file for this run

name: check
on:
push:
branches:
- master
- staging
- trying
pull_request:
# Trigger workflow every day to create/update caches for other builds
# See https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache
# to get more details about cache access
schedule:
- cron: '0 3 * * *'
# Allow cancelling all previous runs for the same branch
# See https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
OLD_IDEA_VERSION: IU-2023.2
OLD_CLION_VERSION: CL-2023.2
OLD_NATIVE_DEBUG_PLUGIN: "com.intellij.nativeDebug:232.8660.142"
jobs:
get-rust-versions:
uses: ./.github/workflows/get-rust-versions.yml
calculate-git-info:
runs-on: ubuntu-latest
outputs:
is_bors_branch: ${{ steps.calculate-git-info.outputs.is_bors_branch }}
is_master_branch: ${{ steps.calculate-git-info.outputs.is_master_branch }}
checked: ${{ steps.calculate-git-info.outputs.checked }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Calculate git info
id: calculate-git-info
run: |
echo "is_bors_branch=${{ github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/trying' }}" >> $GITHUB_OUTPUT
echo "is_master_branch=${{ github.ref == 'refs/heads/master'}}" >> $GITHUB_OUTPUT
echo "checked=$(python scripts/has_successful_status.py --token ${{ github.token }} --ref ${{ github.sha }} --check_name check)" >> $GITHUB_OUTPUT
- name: Check git info
run: |
echo "is_bors_branch: ${{ steps.calculate-git-info.outputs.is_bors_branch }}"
echo "is_master_branch: ${{ steps.calculate-git-info.outputs.is_master_branch }}"
echo "checked: ${{ steps.calculate-git-info.outputs.checked }}"
check-license:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check license
run: python scripts/check_license.py
build-native-code:
needs: [ calculate-git-info, get-rust-versions ]
# `fromJSON` is used here to convert string output to boolean
# We always want to trigger all workflow jobs on `schedule` event because it creates/updates caches for other builds.
# See https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache
# to get more details about cache access
if: ${{ github.event_name == 'schedule' || !fromJSON(needs.calculate-git-info.outputs.is_master_branch) || !fromJSON(needs.calculate-git-info.outputs.checked) }}
uses: ./.github/workflows/build-native-code.yml
with:
rust-version: ${{ needs.get-rust-versions.outputs.stable }}
cache: true
check-pretty-printers:
needs: [ calculate-git-info, get-rust-versions ]
strategy:
# `fromJSON` is used here to convert string output to boolean
fail-fast: ${{ fromJSON(needs.calculate-git-info.outputs.is_bors_branch) }}
matrix:
# TODO: check on macos as well
os: [ ubuntu-latest, windows-latest ]
# `fromJSON` is used here to convert string output to sequence.
# `matrix` is a string with list of stable and nightly versions.
# Make sequence from two outputs with version is not possible here.
# TODO: check on more rustc versions
rust-version: ${{ fromJSON(needs.get-rust-versions.outputs.matrix) }}
platform-version: [ 232, 233 ]
include:
- os: ubuntu-latest
rust-version: ${{ needs.get-rust-versions.outputs.old }}
platform-version: 232
- os: windows-latest
rust-version: ${{ needs.get-rust-versions.outputs.old }}
platform-version: 232
runs-on: ${{ matrix.os }}
env:
ORG_GRADLE_PROJECT_platformVersion: ${{ matrix.platform-version }}
ORG_GRADLE_PROJECT_compileNativeCode: false
RUST_BACKTRACE: 1
steps:
- uses: actions/checkout@v3
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust-version }}
default: true
- name: Set up additional env variables
if: matrix.rust-version == needs.get-rust-versions.outputs.old
# see https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
run: |
echo "ORG_GRADLE_PROJECT_ideaVersion=${{ env.OLD_IDEA_VERSION }}" >> $GITHUB_ENV
echo "ORG_GRADLE_PROJECT_clionVersion=${{ env.OLD_CLION_VERSION }}" >> $GITHUB_ENV
echo "ORG_GRADLE_PROJECT_nativeDebugPlugin=${{ env.OLD_NATIVE_DEBUG_PLUGIN }}" >> $GITHUB_ENV
- name: Retrieve CLion version
id: clion-version
shell: bash
run: echo "version=$(python scripts/retrieve_clion_version.py --path gradle-${{ matrix.platform-version }}.properties)" >> $GITHUB_OUTPUT
- name: Cache debuggers
id: cache-debuggers
uses: actions/cache@v3
with:
# Cache only GDB for Linux because we run gdb pretty-printer tests only on Linux for now
path: |
deps/clion-${{ steps.clion-version.outputs.version }}/bin/lldb
deps/clion-${{ steps.clion-version.outputs.version }}/bin/gdb/linux
key: debuggers-${{ steps.clion-version.outputs.version }}
enableCrossOsArchive: true
- name: Set up JDK 17
if: ${{ !steps.cache-debuggers.outputs.cache-hit }}
uses: actions/setup-java@v3
with:
distribution: corretto
java-version: 17
- name: Download debuggers
if: ${{ !steps.cache-debuggers.outputs.cache-hit }}
uses: gradle/gradle-build-action@v2
with:
arguments: ":resolveDependencies -Pkotlin.incremental=false --no-daemon"
gradle-home-cache-excludes: |
caches/modules-2/files-2.1/com.jetbrains.intellij.idea
caches/modules-2/files-2.1/com.jetbrains.intellij.clion
- name: Cache pretty printer test binaries
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
pretty_printers_tests/target
key: pretty_printers_tests-${{ runner.os }}-${{ matrix.rust-version }}-${{ hashFiles('pretty_printers_tests/src/**', 'pretty_printers_tests/examples/**', 'pretty_printers_tests/Cargo.toml', 'pretty_printers_tests/Cargo.lock') }}
- name: Check bundled Rust formatters
run: python3 scripts/run_pretty_printer_tests.py --clion_version ${{ steps.clion-version.outputs.version }}
check-plugin:
needs: [ calculate-git-info, build-native-code, get-rust-versions ]
strategy:
# `fromJSON` is used here to convert string output to boolean
fail-fast: ${{ fromJSON(needs.calculate-git-info.outputs.is_bors_branch) }}
matrix:
os: [ ubuntu-latest, windows-latest ]
# `fromJSON` is used here to convert string output to sequence.
# `matrix` is a string with list of stable and nightly versions.
# Make sequence from two outputs with version is not possible here.
rust-version: ${{ fromJSON(needs.get-rust-versions.outputs.matrix) }}
base-ide: [ idea, clion ]
platform-version: [ 232, 233 ]
# it's enough to verify plugin structure only once per platform version
verify-plugin: [ false ]
default-edition-for-tests: [ 2021 ]
include:
- os: ubuntu-latest
rust-version: ${{ needs.get-rust-versions.outputs.old }}
base-ide: idea
platform-version: 232
verify-plugin: true
default-edition-for-tests: 2021
runs-on: ${{ matrix.os }}
timeout-minutes: 120
env:
ORG_GRADLE_PROJECT_baseIDE: ${{ matrix.base-ide }}
ORG_GRADLE_PROJECT_platformVersion: ${{ matrix.platform-version }}
ORG_GRADLE_PROJECT_compileNativeCode: false
DEFAULT_EDITION_FOR_TESTS: ${{ matrix.default-edition-for-tests }}
EVCXR_REPL_VERSION: 0.14.2
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: corretto
java-version: 17
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust-version }}
components: rust-src, rustfmt, clippy
default: true
# Requires for tests with overridden toolchain
- name: Set up nightly Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
components: rust-src, rustfmt
default: false
- name: Cache cargo binaries
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/evcxr
~/.cargo/bin/evcxr.exe
~/.cargo/bin/cargo-generate
~/.cargo/bin/cargo-generate.exe
~/.cargo/.crates.toml
~/.cargo/.crates2.json
key: ${{ runner.os }}-cache-cargo-binaries-${{ matrix.rust-version }}-${{ github.run_id }} # https://github.com/actions/cache/issues/342#issuecomment-673371329
restore-keys: |
${{ runner.os }}-cache-cargo-binaries-${{ matrix.rust-version }}-
- name: Install evcxr
# BACKCOMPAT: Evcxr 0.13 requires at least stable-1.59
if: matrix.os != 'windows-latest' && matrix.rust-version >= '1.59.0'
uses: actions-rs/cargo@v1
with:
command: install
# https://github.com/intellij-rust/intellij-rust/issues/9406
args: evcxr_repl --locked --version ${{ env.EVCXR_REPL_VERSION }}
- name: Install cargo-generate
# BACKCOMPAT: cargo-generate 0.15.2 requires Rust 1.61.0 or newer
if: matrix.rust-version >= '1.61.0'
uses: actions-rs/cargo@v1
with:
command: install
args: cargo-generate --locked
- name: Check environment
run: |
rustc --version
rustup component list --installed
cargo install --list
- name: Set up additional env variables
if: matrix.rust-version == needs.get-rust-versions.outputs.old
# see https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
run: |
echo "ORG_GRADLE_PROJECT_ideaVersion=${{ env.OLD_IDEA_VERSION }}" >> $GITHUB_ENV
echo "ORG_GRADLE_PROJECT_clionVersion=${{ env.OLD_CLION_VERSION }}" >> $GITHUB_ENV
echo "ORG_GRADLE_PROJECT_nativeDebugPlugin=${{ env.OLD_NATIVE_DEBUG_PLUGIN }}" >> $GITHUB_ENV
- name: Set up test env variables
run: echo "RUST_SRC_WITH_SYMLINK=$HOME/.rust-src" >> $GITHUB_ENV
- name: Create symlink for Rust stdlib Unix
if: matrix.os != 'windows-latest'
run: ln -s $(rustc --print sysroot)/lib/rustlib/src/rust $RUST_SRC_WITH_SYMLINK
# FIXME: find out why it doesn't work on CI
# - name: Create symlink for Rust stdlib Windows
# if: matrix.os == 'windows-latest'
# run: New-Item -ItemType Junction -Path "$env:RUST_SRC_WITH_SYMLINK" -Target "$(rustc --print sysroot)/lib/rustlib/src/rust"
- name: Load native binaries
uses: ./.github/actions/load-native-binaries
- name: Download
uses: gradle/gradle-build-action@v2
with:
arguments: ":resolveDependencies -Pkotlin.incremental=false --no-daemon"
gradle-home-cache-excludes: |
caches/modules-2/files-2.1/com.jetbrains.intellij.idea
caches/modules-2/files-2.1/com.jetbrains.intellij.clion
- name: Build
uses: gradle/gradle-build-action@v2
with:
arguments: "assemble testClasses -Pkotlin.incremental=false --no-daemon"
gradle-home-cache-excludes: |
caches/modules-2/files-2.1/com.jetbrains.intellij.idea
caches/modules-2/files-2.1/com.jetbrains.intellij.clion
- name: Check
uses: gradle/gradle-build-action@v2
with:
arguments: "check -PexcludeTests=org/rustPerformanceTests/** --continue -Pkotlin.incremental=false --no-daemon"
gradle-home-cache-excludes: |
caches/modules-2/files-2.1/com.jetbrains.intellij.idea
caches/modules-2/files-2.1/com.jetbrains.intellij.clion
- name: Collect fail reports
if: failure()
uses: actions/upload-artifact@v3
with:
name: tests-report-${{ matrix.os }}-${{ matrix.rust-version }}-${{ matrix.base-ide }}-${{ matrix.platform-version }}
path: |
build/reports/tests
*/build/reports/tests
build/*sandbox*/system-test/testlog/idea.log
*/build/*sandbox*/system-test/testlog/idea.log
- name: Verify plugin
if: matrix.verify-plugin
uses: gradle/gradle-build-action@v2
with:
arguments: ":plugin:verifyPlugin"
gradle-home-cache-excludes: |
caches/modules-2/files-2.1/com.jetbrains.intellij.idea
caches/modules-2/files-2.1/com.jetbrains.intellij.clion
check:
needs: [ check-license, check-plugin, check-pretty-printers ]
runs-on: ubuntu-latest
steps:
- name: Finish check
run: echo "Check finished successfully!"