Skip to content

Commit

Permalink
chore(ci): check the success of macos CI (#3353)
Browse files Browse the repository at this point in the history
  • Loading branch information
millotp authored Jul 12, 2024
1 parent 74e1e2a commit 5c412b0
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 24 deletions.
54 changes: 33 additions & 21 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,8 @@ jobs:
needs.setup.outputs.RUN_MACOS_KOTLIN_BUILD == 'true' &&
!contains(needs.*.result, 'cancelled') &&
!contains(needs.*.result, 'failure')
outputs:
success: ${{ steps.setoutput.outputs.success }}
steps:
- uses: actions/checkout@v4

Expand All @@ -391,6 +393,10 @@ jobs:

- run: yarn cli build clients kotlin

- name: Set output
id: setoutput
run: echo "success=true" >> "$GITHUB_OUTPUT"

swift_cts_macos:
timeout-minutes: 20
runs-on: macos-latest
Expand All @@ -408,6 +414,8 @@ jobs:
ALGOLIA_APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }}
ALGOLIA_ADMIN_KEY: ${{ secrets.ALGOLIA_ADMIN_KEY }}
MONITORING_API_KEY: ${{ secrets.MONITORING_API_KEY }}
outputs:
success: ${{ steps.setoutput.outputs.success }}
steps:
- uses: actions/checkout@v4

Expand All @@ -426,6 +434,10 @@ jobs:

- run: yarn cli cts run swift ${{ fromJSON(needs.setup.outputs.SWIFT_DATA).toRun }}

- name: Set output
id: setoutput
run: echo "success=true" >> "$GITHUB_OUTPUT"

codegen:
runs-on: ubuntu-22.04
timeout-minutes: 15
Expand Down Expand Up @@ -463,27 +475,6 @@ jobs:
- name: Generate documentation specs with code snippets
run: yarn cli build specs ${{ fromJSON(needs.setup.outputs.SPECS_MATRIX).toRun }} --docs

- name: Build website
if: ${{ github.ref == 'refs/heads/main' || github.base_ref == 'main' }}
run: yarn website:build

- name: Deploy documentation
if: ${{ github.ref == 'refs/heads/main' || github.base_ref == 'main' }}
uses: nwtgck/actions-netlify@v3.0
with:
publish-dir: 'website/build'
production-branch: main
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: 'Deploy from GitHub Actions'
enable-pull-request-comment: true
enable-commit-comment: true
overwrites-pull-request-comment: true
netlify-config-path: ./netlify.toml
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
timeout-minutes: 5

- name: Push generated code
id: pushGeneratedCode
run: yarn workspace scripts pushGeneratedCode
Expand Down Expand Up @@ -514,6 +505,27 @@ jobs:
| 🪓 Triggered by | [`${{ github.sha }}`](${{ github.event.pull_request.base.repo.html_url }}/commit/${{ github.sha }}) |
| 🍃 Generated commit | [`${{ steps.pushGeneratedCode.outputs.GENERATED_COMMIT }}`](${{ github.event.pull_request.base.repo.html_url }}/commit/${{ steps.pushGeneratedCode.outputs.GENERATED_COMMIT }}) |
| 🌲 Generated branch | [`generated/${{ github.head_ref }}`](${{ github.event.pull_request.base.repo.html_url }}/tree/generated/${{ github.head_ref }}) |
- name: Build website
if: ${{ github.ref == 'refs/heads/main' || github.base_ref == 'main' }}
run: yarn website:build

- name: Deploy documentation
if: ${{ github.ref == 'refs/heads/main' || github.base_ref == 'main' }}
uses: nwtgck/actions-netlify@v3.0
with:
publish-dir: 'website/build'
production-branch: main
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: 'Deploy from GitHub Actions'
enable-pull-request-comment: true
enable-commit-comment: true
overwrites-pull-request-comment: true
netlify-config-path: ./netlify.toml
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
timeout-minutes: 5

- name: Set output
id: setoutput
Expand Down
13 changes: 10 additions & 3 deletions scripts/cts/runCts.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { isVerbose, run, runComposerInstall } from '../common.js';
import fsp from 'fs/promises';

import { exists, isVerbose, run, runComposerInstall, toAbsolutePath } from '../common.js';
import { getTestOutputFolder } from '../config.js';
import { createSpinner } from '../spinners.js';
import type { Language } from '../types.js';

Expand All @@ -15,8 +18,12 @@ async function runCtsOne(
const cwd = `tests/output/${language}`;

const folders: string[] = [];
if (language !== 'dart' && language !== 'kotlin' && !excludeE2E) {
folders.push('e2e');
if (!excludeE2E) {
// check if the folder has files
const e2eFolder = toAbsolutePath(
`tests/output/${language}/${getTestOutputFolder(language)}/e2e`,
);
if ((await exists(e2eFolder)) && (await fsp.readdir(e2eFolder)).length > 0) folders.push('e2e');
}
if (!excludeUnit) {
folders.push('client', 'requests');
Expand Down

0 comments on commit 5c412b0

Please sign in to comment.