Updated pipelines to be conditional based on logic instead of config

This commit is contained in:
Morgan Pretty 2023-08-02 09:34:02 +10:00
parent c76b391d68
commit eb3af31f0c
1 changed files with 23 additions and 16 deletions

View File

@ -69,11 +69,9 @@ local update_cocoapods_cache = {
] ]
}; };
// Unit test pipeline
[ local run_unit_tests = {
// Unit tests kind: 'pipeline',
{
kind: 'pipeline',
type: 'exec', type: 'exec',
name: 'Unit Tests', name: 'Unit Tests',
platform: { os: 'darwin', arch: 'amd64' }, platform: { os: 'darwin', arch: 'amd64' },
@ -90,14 +88,14 @@ local update_cocoapods_cache = {
}, },
update_cocoapods_cache update_cocoapods_cache
], ],
}, };
// Simulator build
{ // Build for simulators
kind: 'pipeline', local build_for_simulator = {
kind: 'pipeline',
type: 'exec', type: 'exec',
name: 'Simulator Build', name: 'Simulator Build',
platform: { os: 'darwin', arch: 'amd64' }, platform: { os: 'darwin', arch: 'amd64' },
when: { event: { exclude: [ 'pull_request' ] } },
steps: [ steps: [
clone_submodules, clone_submodules,
load_cocoapods_cache, load_cocoapods_cache,
@ -118,14 +116,14 @@ local update_cocoapods_cache = {
] ]
}, },
], ],
}, };
// AppStore build (generate an archive to be signed later)
{ // Build for AppStore (generate an archive to be signed later)
kind: 'pipeline', local build_for_app_store = {
kind: 'pipeline',
type: 'exec', type: 'exec',
name: 'AppStore Build', name: 'AppStore Build',
platform: { os: 'darwin', arch: 'amd64' }, platform: { os: 'darwin', arch: 'amd64' },
when: { event: { exclude: [ 'pull_request' ] } },
steps: [ steps: [
clone_submodules, clone_submodules,
load_cocoapods_cache, load_cocoapods_cache,
@ -146,5 +144,14 @@ local update_cocoapods_cache = {
] ]
}, },
], ],
}, };
// Setup the actual pipelines we want to run
local isPullRequest = std.extVar('DRONE_PULL_REQUEST'); // Get the pull request status
[
run_unit_tests,
if isPullRequest == 'true' then {} else build_for_simulator,
if isPullRequest == 'true' then {} else build_for_app_store,
] ]