Skip to content

Commit

Permalink
Migrate nightly from scheduled workflow to scheduled pipeline (#35977)
Browse files Browse the repository at this point in the history
Summary:
I'm moving nightlies from scheduled workflow to scheduled pipeline.
We're not able to manually retrigger nightlies as they're a scheduled workflow and don't expose a parameter. Here I'm cleaning it up.

Plus I'm:
1. Removing the `main_only` reference which is unused
2. Setting up the `run_release_workflow` and `run_nightly_workflow` parameters.

## Changelog

[INTERNAL] - Migrate nightly from scheduled workflow to scheduled pipeline

Pull Request resolved: #35977

Test Plan: Will wait for CI results.

Reviewed By: cipolleschi

Differential Revision: D42776969

Pulled By: cortinico

fbshipit-source-id: d4ef9654d23cb91f85ce2b38e75e27dc0c575e95
  • Loading branch information
cortinico authored and facebook-github-bot committed Jan 27, 2023
1 parent d3cc48d commit d30bd1b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 19 deletions.
52 changes: 34 additions & 18 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ references:
attach_workspace:
at: *hermes_workspace_root

main_only: &main_only
filters:
branches:
only: main
main_or_stable_only: &main_or_stable_only
filters:
branches:
Expand Down Expand Up @@ -1559,7 +1555,7 @@ jobs:
# PIPELINE PARAMETERS
# -------------------------
parameters:
run_package_release_workflow_only:
run_release_workflow:
default: false
type: boolean

Expand All @@ -1571,18 +1567,32 @@ parameters:
default: "9999"
type: string

run_nightly_workflow:
default: false
type: boolean

# -------------------------
# WORK FLOWS
# WORKFLOWS
#
# When creating a new workflow, make sure to include condition:
#
# when:
# and:
# - equal: [ false, << pipeline.parameters.run_release_workflow >> ]
# - equal: [ false, << pipeline.parameters.run_nightly_workflow >> ]
#
# When creating a new workflow, make sure to include condition `unless: << pipeline.parameters.run_package_release_workflow_only >>`
# It's setup this way so we can trigger a release via a POST
# See limitations: https://support.circleci.com/hc/en-us/articles/360050351292-How-to-trigger-a-workflow-via-CircleCI-API-v2
# -------------------------

workflows:
version: 2

tests:
unless: << pipeline.parameters.run_package_release_workflow_only >>
when:
and:
- equal: [ false, << pipeline.parameters.run_release_workflow >> ]
- equal: [ false, << pipeline.parameters.run_nightly_workflow >> ]
jobs:
- prepare_hermes_workspace
- build_hermesc_linux:
Expand Down Expand Up @@ -1737,16 +1747,16 @@ workflows:

# This workflow should only be triggered by release script
package_release:
when: << pipeline.parameters.run_package_release_workflow_only >>
when: << pipeline.parameters.run_release_workflow >>
jobs:
# This job will trigger publish_release workflow
# This job will push a tag that will trigger the publish_release workflow
- prepare_package_for_release:
name: prepare_package_for_release
version: << pipeline.parameters.release_version >>
latest : << pipeline.parameters.release_latest >>

# This job will run only when a tag is published due to all the jobs being filtered.
publish_release:
unless: << pipeline.parameters.run_package_release_workflow_only >>
jobs:
- prepare_hermes_workspace:
filters: *only_release_tags
Expand Down Expand Up @@ -1777,6 +1787,10 @@ workflows:
- build_hermesc_windows

package_and_publish_release_dryrun:
when:
and:
- equal: [ false, << pipeline.parameters.run_release_workflow >> ]
- equal: [ false, << pipeline.parameters.run_nightly_workflow >> ]
jobs:
- prepare_package_for_release:
name: prepare_package_for_release
Expand Down Expand Up @@ -1808,7 +1822,10 @@ workflows:
- build_hermesc_windows

analysis:
unless: << pipeline.parameters.run_package_release_workflow_only >>
when:
and:
- equal: [ false, << pipeline.parameters.run_release_workflow >> ]
- equal: [ false, << pipeline.parameters.run_nightly_workflow >> ]
jobs:
# Run lints on every commit
- analyze_code
Expand All @@ -1820,14 +1837,9 @@ workflows:
- js_coverage

nightly:
unless: << pipeline.parameters.run_package_release_workflow_only >>
triggers:
- schedule:
<<: *main_only
cron: "0 20 * * *"
when: << pipeline.parameters.run_nightly_workflow >>
jobs:
- nightly_job

- prepare_hermes_workspace
- build_hermesc_linux:
requires:
Expand All @@ -1849,6 +1861,10 @@ workflows:
- build_hermesc_windows

publish_bumped_packages:
when:
and:
- equal: [ false, << pipeline.parameters.run_release_workflow >> ]
- equal: [ false, << pipeline.parameters.run_nightly_workflow >> ]
jobs:
- find_and_publish_bumped_packages:
<<: *main_or_stable_only
2 changes: 1 addition & 1 deletion scripts/bump-oss-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ async function main() {
const parameters = {
release_version: version,
release_latest: latest,
run_package_release_workflow_only: true,
run_release_workflow: true,
};

const options = {
Expand Down

0 comments on commit d30bd1b

Please sign in to comment.