Skip to content

chore: spread release revert #3918

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ jobs:
notification:
runs-on: ubuntu-22.04
timeout-minutes: 1
if: ${{ github.event.number }}
if: ${{ !github.event.pull_request.head.repo.fork && github.event.number }}
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4

- uses: marocchino/sticky-pull-request-comment@v2
with:
GITHUB_TOKEN: ${{ secrets.ALGOLIA_BOT_TOKEN != '' && secrets.ALGOLIA_BOT_TOKEN || secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.ALGOLIA_BOT_TOKEN }}
message: |
### 🪓 The generated code will be pushed at the end of the CI.

Expand Down Expand Up @@ -265,7 +265,7 @@ jobs:
- name: Run e2e CTS
id: cts-e2e
continue-on-error: true
if: ${{ env.ALGOLIA_APPLICATION_ID != '' && !contains(format('{0} {1}', github.event.pull_request.title, github.event.head_commit.message), '[skip-e2e]') }}
if: ${{ !github.event.pull_request.head.repo.fork && !contains(format('{0} {1}', github.event.pull_request.title, github.event.head_commit.message), '[skip-e2e]') }}
run: yarn cli cts run javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun }} --no-client --no-requests

- name: Retry e2e CTS
Expand Down Expand Up @@ -379,7 +379,7 @@ jobs:
- name: Run e2e CTS
id: cts-e2e
continue-on-error: true
if: ${{ env.ALGOLIA_APPLICATION_ID != '' && !contains(format('{0} {1}', github.event.pull_request.title, github.event.head_commit.message), '[skip-e2e]') }}
if: ${{ !github.event.pull_request.head.repo.fork && !contains(format('{0} {1}', github.event.pull_request.title, github.event.head_commit.message), '[skip-e2e]') }}
run: yarn cli cts run ${{ matrix.client.language }} ${{ matrix.client.toRun }} --no-client --no-requests

- name: Retry e2e CTS
Expand Down Expand Up @@ -482,24 +482,24 @@ jobs:
if: ${{ env.ALGOLIA_APPLICATION_ID != '' }}

- name: Download artifacts
if: ${{ env.ALGOLIA_APPLICATION_ID != '' }}
uses: ./scripts/ci/actions/restore-artifacts
if: ${{ env.ALGOLIA_APPLICATION_ID != '' }}
with:
type: languages
languages: |
swift

- name: Setup
if: ${{ env.ALGOLIA_APPLICATION_ID != '' }}
uses: ./.github/actions/setup
if: ${{ env.ALGOLIA_APPLICATION_ID != '' }}
with:
type: minimal
language: swift
version: ${{ fromJSON(needs.setup.outputs.SWIFT_DATA).version }}

- name: Run tests on macOS
if: ${{ env.ALGOLIA_APPLICATION_ID != '' }}
id: run-test
if: ${{ env.ALGOLIA_APPLICATION_ID != '' }}
continue-on-error: true
run: yarn cli cts run swift ${{ fromJSON(needs.setup.outputs.SWIFT_DATA).toRun }} -v ${{ !contains(format('{0} {1}', github.event.pull_request.title, github.event.head_commit.message), '[skip-e2e]') && '--no-e2e' || '' }}

Expand Down Expand Up @@ -533,6 +533,7 @@ jobs:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ secrets.ALGOLIA_BOT_TOKEN != '' && secrets.ALGOLIA_BOT_TOKEN || secrets.GITHUB_TOKEN }}
repository: ${{ github.event.pull_request.head.repo.full_name }}

- name: Download all artifacts
uses: ./scripts/ci/actions/restore-artifacts
Expand Down Expand Up @@ -571,17 +572,12 @@ jobs:
} >> "$GITHUB_OUTPUT"
rm -rf tests/output/**/benchmarkResult.json

- name: Extract branch name
id: extract_branch
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT

- name: Push generated code
id: pushGeneratedCode
run: yarn workspace scripts pushGeneratedCode
env:
GITHUB_TOKEN: ${{ secrets.ALGOLIA_BOT_TOKEN != '' && secrets.ALGOLIA_BOT_TOKEN || secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.number }}
BRANCH_NAME: ${{ steps.extract_branch.outputs.branch }}

- name: update generation comment
uses: marocchino/sticky-pull-request-comment@v2
Expand Down
14 changes: 7 additions & 7 deletions scripts/ci/codegen/pushGeneratedCode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import text, { commitStartPrepareRelease } from './text.js';

async function isUpToDate(baseBranch: string): Promise<boolean> {
await run('git fetch origin');
return (await run(`git pull origin "${baseBranch}"`)).includes('Already up to date.');
return (await run(`git pull origin ${baseBranch}`)).includes('Already up to date.');
}

/**
Expand All @@ -19,7 +19,7 @@ export async function pushGeneratedCode(): Promise<void> {

await configureGitHubAuthor();

const baseBranch = process.env.BRANCH_NAME || (await run('git branch --show-current'));
const baseBranch = await run('git branch --show-current');
const isMainBranch = baseBranch === MAIN_BRANCH;
const IS_RELEASE_COMMIT = (await run('git log -1 --format="%s"')).startsWith(commitStartPrepareRelease);
console.log(`Checking codegen status on '${baseBranch}'.`);
Expand All @@ -41,10 +41,10 @@ export async function pushGeneratedCode(): Promise<void> {
const branchToPush = isMainBranch ? baseBranch : `generated/${baseBranch}`;

if (!isMainBranch) {
await run(`git push -d origin "generated/${baseBranch}" || true`);
await run(`git push -d origin generated/${baseBranch} || true`);

console.log(`Creating branch for generated code: '${branchToPush}'`);
await run(`git checkout -b "${branchToPush}"`);
await run(`git checkout -b ${branchToPush}`);
}

if (!(await isUpToDate(baseBranch))) {
Expand All @@ -55,9 +55,9 @@ export async function pushGeneratedCode(): Promise<void> {
}

const skipCi = isMainBranch ? '[skip ci]' : '';
let message = await run(`git show -s "${baseBranch}" --format="%s ${text.commitEndMessage} ${skipCi}"`);
let message = await run(`git show -s ${baseBranch} --format="%s ${text.commitEndMessage} ${skipCi}"`);
const authors = await run(
`git show -s "${baseBranch}" --format="
`git show -s ${baseBranch} --format="

Co-authored-by: %an <%ae>
%(trailers:key=Co-authored-by)"`,
Expand All @@ -73,7 +73,7 @@ Co-authored-by: %an <%ae>
console.log(`Pushing code to generated branch: '${branchToPush}'`);
await run('git add .');
await run(`git commit -m "${message}"`);
await run(`git push origin "${branchToPush}"`);
await run(`git push origin ${branchToPush}`);

setOutput('GENERATED_COMMIT', await run('git rev-parse HEAD'));
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/ci/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export async function getNbGitDiff({

const changes = parseInt(
(
await run(`git add -N . && git diff --shortstat "${branch}${checkHead}" -- ${path} | wc -l`, {
await run(`git add -N . && git diff --shortstat ${branch}${checkHead} -- ${path} | wc -l`, {
cwd,
})
).trim(),
Expand Down
Loading