From e76600b1bb768311df38d8fd9af834cf536b93db Mon Sep 17 00:00:00 2001 From: Maksim Levental Date: Sat, 31 Aug 2024 01:58:53 -0700 Subject: [PATCH] SSH into runners (#730) This PR adds the ability to SSH into runners using https://github.com/mxschmitt/action-tmate. --- .github/workflows/ci-linux.yml | 17 ++++++----------- .github/workflows/ci-macos.yml | 26 ++++++++++++++++++++------ .github/workflows/ci-windows.yml | 29 +++++++++++++++++++++-------- 3 files changed, 47 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index 968cf4630..6f688c9d4 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -9,11 +9,6 @@ on: branches: - main - schedule: - # At minute 0 past every 6th hour. (see https://crontab.guru) - # this job is to keep the ccache cache warm - - cron: '0 */6 * * *' - concurrency: # A PR number if a pull request and otherwise the commit hash. This cancels # queued and in-progress runs for the same PR (presubmit) or commit @@ -30,7 +25,7 @@ jobs: env: CACHE_DIR: ${{ github.workspace }}/.container-cache # either the PR number or `branch-N` where N always increments - CACHE_KEY: linux-build-test-cpp-asserts-manylinux-v2-${{ github.event.number || format('{0}-{1}', github.ref_name, github.run_number) }} + CACHE_KEY: linux-build-test-cpp-asserts-manylinux-v2-${{ format('{0}-{1}', github.ref_name, github.run_number) }} steps: - name: Set unified TZ uses: szenius/set-timezone@v2.0 @@ -51,8 +46,9 @@ jobs: - name: Install deps run: | + dnf install -y almalinux-release-devel epel-release yum remove -y openssl-devel zlib-devel || true - yum install -y protobuf-devel protobuf-compiler + yum install -y protobuf-devel protobuf-compiler tmate - name: Sync source deps run: | @@ -78,7 +74,7 @@ jobs: - name: Create artifacts if: ${{ !cancelled() }} run: | - tar cf iree-dist-linux.tar -C iree-install . + tar cf iree-dist-linux.tar iree-install - name: Upload artifacts uses: actions/upload-artifact@v4 @@ -90,7 +86,7 @@ jobs: - name: Save cache uses: actions/cache/save@v3 - if: ${{ !cancelled() && github.event_name != 'pull_request' }} + if: ${{ !cancelled() && github.event_name == 'push' && github.ref_name == 'main' }} with: path: ${{ env.CACHE_DIR }} key: ${{ env.CACHE_KEY }} @@ -118,8 +114,7 @@ jobs: - name: Extract artifact run: | - mkdir iree-install - tar -xf iree-dist-linux.tar -C iree-install + tar -xvf iree-dist-linux.tar bash build_tools/download_peano.sh - name: Create venv and install dependencies diff --git a/.github/workflows/ci-macos.yml b/.github/workflows/ci-macos.yml index cf05c9376..a727778b8 100644 --- a/.github/workflows/ci-macos.yml +++ b/.github/workflows/ci-macos.yml @@ -3,15 +3,23 @@ name: CI MacOS on: workflow_call: workflow_dispatch: + inputs: + force_debug_with_tmate: + type: boolean + description: 'Run the build with tmate session' + required: false + default: false + debug_with_tmate: + type: boolean + description: 'Run the build with a tmate session ONLY in case of failure' + required: false + default: false pull_request: merge_group: push: branches: - main - schedule: - - cron: '0 */6 * * *' - concurrency: group: ci-build-test-cpp-macos-${{ github.event.number || github.sha }} cancel-in-progress: true @@ -26,7 +34,7 @@ jobs: runs-on: [macos-12, macos-14] env: CACHE_DIR: ${{ github.workspace }}/.container-cache - CACHE_KEY: ${{ matrix.runs-on }}-build-test-cpp-asserts-v1-${{ github.event.number || format('{0}-{1}', github.ref_name, github.run_number) }} + CACHE_KEY: ${{ matrix.runs-on }}-build-test-cpp-asserts-v1-${{ format('{0}-{1}', github.ref_name, github.run_number) }} steps: - name: Set unified TZ uses: szenius/set-timezone@v2.0 @@ -73,7 +81,7 @@ jobs: - name: Create artifacts if: ${{ !cancelled() }} run: | - tar cf iree-dist-${{ matrix.runs-on }}.tar -C iree-install . + tar cf iree-dist-${{ matrix.runs-on }}.tar iree-install - name: Upload artifacts uses: actions/upload-artifact@v4 @@ -85,7 +93,13 @@ jobs: - name: Save cache uses: actions/cache/save@v3 - if: ${{ !cancelled() && github.event_name != 'pull_request' }} + if: ${{ !cancelled() && github.event_name == 'push' && github.ref_name == 'main' }} with: path: ${{ env.CACHE_DIR }} key: ${{ env.CACHE_KEY }} + + - name: Start tmate session + if: ${{ (failure() && inputs.debug_with_tmate) || inputs.force_debug_with_tmate }} + uses: mxschmitt/action-tmate@v3.18 + with: + limit-access-to-actor: true diff --git a/.github/workflows/ci-windows.yml b/.github/workflows/ci-windows.yml index de71a4f9a..080ff1c51 100644 --- a/.github/workflows/ci-windows.yml +++ b/.github/workflows/ci-windows.yml @@ -3,15 +3,23 @@ name: CI Windows on: workflow_call: workflow_dispatch: + inputs: + force_debug_with_tmate: + type: boolean + description: 'Run the build with tmate session' + required: false + default: false + debug_with_tmate: + type: boolean + description: 'Run the build with a tmate session ONLY in case of failure' + required: false + default: false pull_request: merge_group: push: branches: - main - schedule: - - cron: '0 */6 * * *' - concurrency: group: ci-build-test-cpp-windows-${{ github.event.number || github.sha }} cancel-in-progress: true @@ -29,7 +37,7 @@ jobs: fail-fast: true env: CACHE_DIR: ${{ github.workspace }}/.container-cache - CACHE_KEY: windows-build-test-cpp-asserts-v1-${{ github.event.number || format('{0}-{1}', github.ref_name, github.run_number) }} + CACHE_KEY: windows-build-test-cpp-asserts-v1-${{ format('{0}-{1}', github.ref_name, github.run_number) }} steps: - name: Set unified TZ uses: szenius/set-timezone@v2.0 @@ -81,7 +89,7 @@ jobs: - name: Create artifacts if: ${{ !cancelled() }} run: | - tar cf iree-dist-windows.tar -C iree-install . + tar cf iree-dist-windows.tar iree-install - name: Upload artifacts uses: actions/upload-artifact@v4 @@ -93,11 +101,17 @@ jobs: - name: Save cache uses: actions/cache/save@v3 - if: ${{ !cancelled() && github.event_name != 'pull_request' }} + if: ${{ !cancelled() && github.event_name == 'push' && github.ref_name == 'main' }} with: path: ${{ env.CACHE_DIR }} key: ${{ env.CACHE_KEY }} + - name: Start tmate session + if: ${{ (failure() && inputs.debug_with_tmate) || inputs.force_debug_with_tmate }} + uses: mxschmitt/action-tmate@v3.18 + with: + limit-access-to-actor: true + test_windows: name: E2E Test windows runs-on: windows-phoenix @@ -117,8 +131,7 @@ jobs: - name: Extract artifact run: | - mkdir iree-install - tar -xf iree-dist-windows.tar -C iree-install + tar -xf iree-dist-windows.tar bash build_tools/download_peano.sh - name: Create venv and install dependencies