⬆️ nightly #311
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
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: 2024.1.5 | |
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@v4 | |
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@v4 | |
- 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-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: [ IU ] | |
platform-version: [ 241, 242 ] | |
# 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: IU | |
platform-version: 241 | |
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.18.0 | |
CARGO_GENERATE_VERSION: 0.21.3 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
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@v4 | |
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.18 requires at least stable-1.80 | |
if: matrix.os != 'windows-latest' && matrix.rust-version >= '1.80.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.21.3 requires Rust 1.74.0 or newer | |
if: matrix.rust-version >= '1.74.0' | |
uses: actions-rs/cargo@v1 | |
with: | |
command: install | |
args: cargo-generate --locked --version ${{ env.CARGO_GENERATE_VERSION }} | |
- 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 | |
- 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: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
with: | |
gradle-home-cache-excludes: | | |
caches/modules-2/files-2.1/com.jetbrains.intellij.idea | |
caches/modules-2/files-2.1/idea | |
caches/transforms-* | |
caches/*/transforms | |
- name: Download | |
run: ./gradlew :resolveDependencies "-Pkotlin.incremental=false" --no-daemon | |
- name: Build | |
run: ./gradlew assemble testClasses "-Pkotlin.incremental=false" --no-daemon | |
- name: Check | |
run: ./gradlew check "-PexcludeTests=org/rustPerformanceTests/**" --continue "-Pkotlin.incremental=false" --no-daemon | |
- name: Collect fail reports | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
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 | |
run: ./gradlew :plugin:verifyPlugin | |
check: | |
needs: [ check-license, check-plugin ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Finish check | |
run: echo "Check finished successfully!" |