Skip to content

Commit

Permalink
chore: instead of running the whole pipeline again, only allow drafts…
Browse files Browse the repository at this point in the history
… when main is green already (#55)
  • Loading branch information
kmruiz authored Sep 23, 2024
1 parent 59629c5 commit 3833ed0
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 39 deletions.
41 changes: 2 additions & 39 deletions .github/workflows/draft-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,47 +68,10 @@ jobs:
echo "If this version has already been release consider using a different one."
exit 1
fi
- name: Setup Docker (for Test Containers)
- name: Verify Checks in main
run: |
sudo apt update -y
sudo apt install -y docker docker-compose
- name: Run Unit and Integration Tests
run: |
./gradlew "unitTest" ":packages:jetbrains-plugin:test"
./gradlew "mainStatus"
- name: Prepare License Key
env:
JB_TEST_KEY: ${{ secrets.JB_TEST_KEY }}
run: |
mkdir -p packages/jetbrains-plugin/build/idea-sandbox/config-uiTest
echo "$JB_TEST_KEY" | base64 -d > packages/jetbrains-plugin/build/idea-sandbox/config-uiTest/idea.key
- name: Start UI Test Environment
run: |
export DISPLAY=:99.0
Xvfb -ac :99 -screen 0 1920x1080x24 &
sleep 10
mkdir -p packages/jetbrains-plugin/build/reports
./gradlew :packages:jetbrains-plugin:runIdeForUiTests > packages/jetbrains-plugin/build/reports/idea.log &
IDEA_PID=$!
echo $IDEA_PID > idea.pid
- name: Wait for IDE to start
uses: jtalk/url-health-check-action@v3
with:
url: "http://127.0.0.1:8082"
max-attempts: 15
retry-delay: 30s
- name: Run UI Tests
uses: nick-fields/retry@v3
env:
DISPLAY: ":99.0"
with:
timeout_minutes: 30
max_attempts: 3
command: ./gradlew --quiet --console=plain :packages:jetbrains-plugin:uiTest
- name: Stop IDEA
run: |
IDEA_PID=$(cat idea.pid)
kill -9 $IDEA_PID
- name: Patch Plugin XML
run: |
./gradlew ":packages:jetbrains-plugin:patchPluginXml"
Expand Down
28 changes: 28 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
import groovy.json.JsonSlurper
import java.net.URL

group = "com.mongodb"
// This should be bumped when releasing a new version using the versionBump task:
Expand Down Expand Up @@ -164,4 +166,30 @@ tasks {
println(rootProject.version)
}
}

register("mainStatus") {
group = "environment"

doLast {
val checks = JsonSlurper().parse(URL("https://api.github.com/repos/mongodb-js/intellij/commits/main/check-runs")) as Map<String, Any>
val check_runs = checks["check_runs"] as List<Map<String, Any>>
var success: Boolean = true
for (check in check_runs) {
if (check["name"] == "Prepare Release") {
continue
}

if (check["conclusion"] != "success") {
System.err.println("[❌] Check ${check["name"]} is still with status ${check["status"]} and conclusion ${check["conclusion"]}: ${check["html_url"]}")
success = false
} else {
println("[✅] Check ${check["name"]} has finished successfully: ${check["html_url"]}")
}
}

if (!success) {
throw GradleException("Checks in main must be successful.")
}
}
}
}

0 comments on commit 3833ed0

Please sign in to comment.