From 8231ac9ee6f388f2d2638e60b80c8ae0b8e830f0 Mon Sep 17 00:00:00 2001 From: Carlos Matos Date: Tue, 19 Nov 2024 13:24:30 -0500 Subject: [PATCH] ci: consolidate test/build This a better approach than trying to break it out. --- .github/workflows/build.yml | 31 ++++++++++++------------ .github/workflows/test.yml | 47 ------------------------------------- 2 files changed, 16 insertions(+), 62 deletions(-) delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 25a52963..51b19e0d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,18 +2,21 @@ name: Build on: push: - branches: [ main ] - pull_request: - branches: [ main ] + branches: [main] + pull_request_target: + types: [labeled] jobs: build: name: Build and Install Gem + if: | + github.event_name == 'push' || + (github.event_name == 'pull_request_target' && + github.event.label.name == 'ok-to-test') runs-on: ubuntu-latest - strategy: matrix: - ruby-version: ['3.0', '3.1', '3.2'] + ruby-version: ["3.0", "3.1", "3.2"] fail-fast: false steps: @@ -23,19 +26,17 @@ jobs: uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby-version }} - - - name: Install dependencies - run: bundle install + bundler-cache: true - name: Build gem run: make build - - name: Upload gem - uses: actions/upload-artifact@v4 - with: - name: crimson-gem-${{ matrix.ruby-version }} - path: crimson-falcon*.gem - if-no-files-found: error - - name: Install gem run: make install + + - name: Run tests + env: + FALCON_CLIENT_ID: ${{ secrets.FALCON_CLIENT_ID }} + FALCON_CLIENT_SECRET: ${{ secrets.FALCON_CLIENT_SECRET }} + FALCON_CLOUD: ${{ secrets.FALCON_CLOUD }} + run: bundle exec rspec diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 663fd9d1..00000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,47 +0,0 @@ -# .github/workflows/test.yml -name: Test - -on: - workflow_run: - workflows: ["Build"] - types: - - completed - pull_request_target: - types: [labeled] - -jobs: - test: - name: Test on Ruby ${{ matrix.ruby-version }} - if: | - (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') || - (github.event_name == 'pull_request_target' && github.event.label.name == 'ok-to-test') - runs-on: ubuntu-latest - strategy: - matrix: - ruby-version: ["3.0", "3.1", "3.2"] - fail-fast: false - - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha || github.ref }} - - - name: Set up Ruby ${{ matrix.ruby-version }} - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby-version }} - - - name: Download gem artifact - uses: actions/download-artifact@v4 - with: - name: crimson-gem-${{ matrix.ruby-version }} - - - name: Install dependencies - run: make install - - - name: Run tests - env: - FALCON_CLIENT_ID: ${{ secrets.FALCON_CLIENT_ID }} - FALCON_CLIENT_SECRET: ${{ secrets.FALCON_CLIENT_SECRET }} - FALCON_CLOUD: ${{ secrets.FALCON_CLOUD }} - run: bundle exec rspec