Skip to content

Commit c89602d

Browse files
authored
Add destination to export options (#247)
* Add destination to export options * Update CI workflow * Fix lint issues * Fix lint issues * Fix lint issues * Improve temp dir creation in tests * Fix imports * Update export option consts * Restore certificate filter test * Fix certificate filtering, select tha later expiring from duplicates
1 parent 0b8c3a2 commit c89602d

26 files changed

+138
-259
lines changed

appleauth/key_helper.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package appleauth
22

33
import (
4-
"io/ioutil"
54
"net/http"
65
"net/url"
6+
"os"
77
"path/filepath"
88
"regexp"
99

@@ -24,7 +24,7 @@ func fetchPrivateKey(privateKeyURL string) ([]byte, string, error) {
2424
if err != nil {
2525
return nil, "", err
2626
}
27-
key, err := ioutil.ReadFile(localFile)
27+
key, err := os.ReadFile(localFile)
2828
if err != nil {
2929
return nil, "", err
3030
}

bitrise.yml

Lines changed: 70 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -3,111 +3,114 @@ default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
33

44
app:
55
envs:
6-
- ORIG_BITRISE_SOURCE_DIR: $BITRISE_SOURCE_DIR
6+
- ORIG_BITRISE_SOURCE_DIR: $BITRISE_SOURCE_DIR
77

88
workflows:
99
ci:
1010
before_run:
11-
- test
12-
- swiftpm_cache
11+
- test
12+
- swiftpm_cache
1313

1414
test:
1515
after_run:
16-
- integration-test
16+
- integration-test
1717
steps:
18-
- go-list:
19-
- golint:
20-
- errcheck:
21-
- go-test:
18+
- git::https://github.com/bitrise-steplib/steps-check.git:
19+
title: Lint
20+
inputs:
21+
- workflow: lint
22+
- skip_step_yml_validation: "yes"
23+
- go-list:
24+
inputs:
25+
- exclude: "*/mocks"
26+
- go-test: { }
2227

2328
integration-test:
24-
after_run:
2529
steps:
26-
- script:
27-
title: Run integration tests
28-
inputs:
29-
- content: |-
30-
#!/bin/bash
31-
echo "Running integration tests ..."
32-
set -ex
30+
- script:
31+
title: Run integration tests
32+
inputs:
33+
- content: |-
34+
#!/bin/bash
35+
echo "Running integration tests ..."
36+
set -ex
3337
34-
go test -v ./_tests/integration/...
38+
go test -v ./_tests/integration/...
3539
3640
_swiftpm_step:
3741
envs:
38-
- CURRENT_PROJECT_PATH: $CURRENT_PROJECT_PATH
39-
- BITRISE_ACCESS_TOKEN: $BITRISE_ACCESS_TOKEN
42+
- CURRENT_PROJECT_PATH: $CURRENT_PROJECT_PATH
43+
- BITRISE_ACCESS_TOKEN: $BITRISE_ACCESS_TOKEN
4044
steps:
41-
- build-router-start:
42-
inputs:
43-
- workflows: swiftpm_run_xcodebuild
44-
- wait_for_builds: "true"
45-
- access_token: $BITRISE_ACCESS_TOKEN
46-
- environment_key_list: CURRENT_PROJECT_PATH
47-
- verbose: "yes"
45+
- build-router-start:
46+
inputs:
47+
- workflows: swiftpm_run_xcodebuild
48+
- wait_for_builds: "true"
49+
- access_token: $BITRISE_ACCESS_TOKEN
50+
- environment_key_list: CURRENT_PROJECT_PATH
51+
- verbose: "yes"
4852

4953
swiftpm_run_xcodebuild:
5054
envs:
51-
- CURRENT_PROJECT_PATH: $CURRENT_PROJECT_PATH
52-
- SAMPLES_DIR: $ORIG_BITRISE_SOURCE_DIR/_checkout
55+
- CURRENT_PROJECT_PATH: $CURRENT_PROJECT_PATH
56+
- SAMPLES_DIR: $ORIG_BITRISE_SOURCE_DIR/_checkout
5357
steps:
54-
- script:
55-
title: Cleanup $TMP_DIR
56-
inputs:
57-
- content: |
58-
#!/bin/bash
59-
set -ex
58+
- script:
59+
title: Cleanup $TMP_DIR
60+
inputs:
61+
- content: |
62+
#!/bin/bash
63+
set -ex
6064
61-
rm -rf $SAMPLES_DIR
62-
mkdir $SAMPLES_DIR
63-
git clone https://github.com/bitrise-io/sample-apps-ios-swiftpm.git -b master $SAMPLES_DIR
65+
rm -rf $SAMPLES_DIR
66+
mkdir $SAMPLES_DIR
67+
git clone https://github.com/bitrise-io/sample-apps-ios-swiftpm.git -b master $SAMPLES_DIR
6468
65-
rm -rf /Users/lpusok/Library/Developer/Xcode/DerivedData/*
66-
- cache-pull:
67-
run_if: true
68-
inputs:
69-
- is_debug_mode: true
70-
- xcode-test:
71-
title: Run xcodebuild
72-
inputs:
73-
- project_path: $SAMPLES_DIR/$CURRENT_PROJECT_PATH/sample-swiftpm2.xcodeproj
74-
- scheme: sample-swiftpm2
75-
- cache_level: swift_packages
76-
- cache-push:
77-
title: Push cache
78-
run_if: true
79-
is_skippable: false
80-
inputs:
81-
- is_debug_mode: true
69+
rm -rf /Users/lpusok/Library/Developer/Xcode/DerivedData/*
70+
- cache-pull:
71+
run_if: true
72+
inputs:
73+
- is_debug_mode: true
74+
- xcode-test:
75+
title: Run xcodebuild
76+
inputs:
77+
- project_path: $SAMPLES_DIR/$CURRENT_PROJECT_PATH/sample-swiftpm2.xcodeproj
78+
- scheme: sample-swiftpm2
79+
- cache_level: swift_packages
80+
- cache-push:
81+
title: Push cache
82+
run_if: true
83+
is_skippable: false
84+
inputs:
85+
- is_debug_mode: true
8286

8387
_swiftpm_step2:
8488
envs:
85-
- CURRENT_PROJECT_PATH: sample-swiftpm2
89+
- CURRENT_PROJECT_PATH: sample-swiftpm2
8690
after_run:
87-
- _swiftpm_step
91+
- _swiftpm_step
8892

8993
_swiftpm_step3:
9094
envs:
91-
- CURRENT_PROJECT_PATH: sample-swiftpm3
95+
- CURRENT_PROJECT_PATH: sample-swiftpm3
9296
after_run:
93-
- _swiftpm_step
97+
- _swiftpm_step
9498

9599
_swiftpm_step5:
96100
envs:
97-
- CURRENT_PROJECT_PATH: sample-swiftpm5
101+
- CURRENT_PROJECT_PATH: sample-swiftpm5
98102
after_run:
99-
- _swiftpm_step
103+
- _swiftpm_step
100104

101105
_swiftpm_step7:
102106
envs:
103-
- CURRENT_PROJECT_PATH: sample-swiftpm7
107+
- CURRENT_PROJECT_PATH: sample-swiftpm7
104108
after_run:
105-
- _swiftpm_step
109+
- _swiftpm_step
106110

107111
swiftpm_cache:
108112
after_run:
109-
- _swiftpm_step2
110-
- _swiftpm_step3
111-
- _swiftpm_step5
112-
- _swiftpm_step7
113-
113+
- _swiftpm_step2
114+
- _swiftpm_step3
115+
- _swiftpm_step5
116+
- _swiftpm_step7

certificateutil/filter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func FilterValidCertificateInfos(certificateInfos []CertificateInfoModel) ValidC
4242
}
4343

4444
sort.Slice(certs, func(i, j int) bool {
45-
return certs[i].EndDate.Before(certs[j].EndDate)
45+
return certs[i].EndDate.After(certs[j].EndDate)
4646
})
4747
validCertificates = append(validCertificates, certs[0])
4848
if len(certs) > 1 {

certificateutil/filter_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func TestFilterValidCertificateInfos(t *testing.T) {
6060
if err != nil {
6161
t.Errorf("init: failed to generate certificate, error: %s", err)
6262
}
63-
earlierValidCertInfo := NewCertificateInfo(*latestValidCert, earlierValidCert)
63+
earlierValidCertInfo := NewCertificateInfo(*earlierValidCert, privateKey)
6464
t.Logf("Test certificate generated: %s", earlierValidCertInfo)
6565

6666
invalidCert, privateKey, err := GenerateTestCertificate(serial, teamID, teamName, commonName, invalidExpiry)

certificateutil/util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import (
88
"regexp"
99
"strings"
1010

11+
"github.com/bitrise-io/go-pkcs12"
1112
"github.com/bitrise-io/go-utils/command"
1213
"github.com/bitrise-io/go-utils/fileutil"
13-
"github.com/bitrise-io/go-pkcs12"
1414
"github.com/pkg/errors"
1515
)
1616

devportalservice/devportalservice.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"bytes"
55
"encoding/json"
66
"fmt"
7-
"io/ioutil"
7+
"io"
88
"net/http"
99
"os"
1010
"regexp"
@@ -126,7 +126,7 @@ func (c *BitriseClient) download() ([]byte, error) {
126126
}
127127
}()
128128

129-
body, err := ioutil.ReadAll(resp.Body)
129+
body, err := io.ReadAll(resp.Body)
130130
if err != nil {
131131
return nil, fmt.Errorf("failed to read response body: %s", err)
132132
}

devportalservice/devportalservice_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package devportalservice
22

33
import (
4-
"io/ioutil"
4+
"io"
55
"net/http"
66
"strings"
77
"testing"
@@ -23,7 +23,7 @@ func TestGetAppleDeveloperConnection(t *testing.T) {
2323
name: "No Apple Developer Connection set for the build",
2424
response: &http.Response{
2525
StatusCode: 200,
26-
Body: ioutil.NopCloser(strings.NewReader("{}")),
26+
Body: io.NopCloser(strings.NewReader("{}")),
2727
},
2828
want: &AppleDeveloperConnection{},
2929
wantErr: false,
@@ -32,7 +32,7 @@ func TestGetAppleDeveloperConnection(t *testing.T) {
3232
name: "No Apple Developer Connection set for the build, test devices available",
3333
response: &http.Response{
3434
StatusCode: 200,
35-
Body: ioutil.NopCloser(strings.NewReader(testDevicesResponseBody)),
35+
Body: io.NopCloser(strings.NewReader(testDevicesResponseBody)),
3636
},
3737
want: &testConnectionOnlyDevices,
3838
wantErr: false,
@@ -41,7 +41,7 @@ func TestGetAppleDeveloperConnection(t *testing.T) {
4141
name: "Apple ID-based Apple Developer Connection set for the build",
4242
response: &http.Response{
4343
StatusCode: 200,
44-
Body: ioutil.NopCloser(strings.NewReader(testAppleIDConnectionResponseBody)),
44+
Body: io.NopCloser(strings.NewReader(testAppleIDConnectionResponseBody)),
4545
},
4646
want: &testConnectionWithAppleIDConnection,
4747
wantErr: false,
@@ -50,7 +50,7 @@ func TestGetAppleDeveloperConnection(t *testing.T) {
5050
name: "API key Apple Developer Connection set for the build",
5151
response: &http.Response{
5252
StatusCode: 200,
53-
Body: ioutil.NopCloser(strings.NewReader(testAPIKeyConnectionResponseBody)),
53+
Body: io.NopCloser(strings.NewReader(testAPIKeyConnectionResponseBody)),
5454
},
5555
want: &testConnectionWithAPIKeyConnection,
5656
wantErr: false,
@@ -59,7 +59,7 @@ func TestGetAppleDeveloperConnection(t *testing.T) {
5959
name: "Apple ID-based and API key Apple Developer Connection set for the build, test device available",
6060
response: &http.Response{
6161
StatusCode: 200,
62-
Body: ioutil.NopCloser(strings.NewReader(testAppleIDAndAPIKeyConnectionResponseBody)),
62+
Body: io.NopCloser(strings.NewReader(testAppleIDAndAPIKeyConnectionResponseBody)),
6363
},
6464
want: &testConnectionWithAppleIDAndAPIKeyConnection,
6565
wantErr: false,
@@ -89,7 +89,7 @@ func TestFastlaneLoginSession(t *testing.T) {
8989
name: "No Apple Developer Connection set for the build",
9090
response: &http.Response{
9191
StatusCode: 200,
92-
Body: ioutil.NopCloser(strings.NewReader("{}")),
92+
Body: io.NopCloser(strings.NewReader("{}")),
9393
},
9494
want: "",
9595
wantErr: false,
@@ -98,7 +98,7 @@ func TestFastlaneLoginSession(t *testing.T) {
9898
name: "Apple ID-based Apple Developer Connection set for the build",
9999
response: &http.Response{
100100
StatusCode: 200,
101-
Body: ioutil.NopCloser(strings.NewReader(testAppleIDConnectionResponseBody)),
101+
Body: io.NopCloser(strings.NewReader(testAppleIDConnectionResponseBody)),
102102
},
103103
want: testFastlaneSession,
104104
wantErr: false,

exportoptions/appstore_options.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ type AppStoreOptionsModel struct {
1313
SigningCertificate string
1414
InstallerSigningCertificate string
1515
SigningStyle string
16+
Destination string
1617
ICloudContainerEnvironment ICloudContainerEnvironment
1718
DistributionBundleIdentifier string
1819

@@ -39,12 +40,15 @@ func (options AppStoreOptionsModel) Hash() map[string]interface{} {
3940
if options.TeamID != "" {
4041
hash[TeamIDKey] = options.TeamID
4142
}
43+
//nolint:gosimple
4244
if options.UploadBitcode != UploadBitcodeDefault {
4345
hash[UploadBitcodeKey] = options.UploadBitcode
4446
}
47+
//nolint:gosimple
4548
if options.UploadSymbols != UploadSymbolsDefault {
4649
hash[UploadSymbolsKey] = options.UploadSymbols
4750
}
51+
//nolint:gosimple
4852
if options.ManageAppVersion != manageAppVersionDefault {
4953
hash[manageAppVersionKey] = options.ManageAppVersion
5054
}
@@ -66,6 +70,9 @@ func (options AppStoreOptionsModel) Hash() map[string]interface{} {
6670
if options.SigningStyle != "" {
6771
hash[SigningStyleKey] = options.SigningStyle
6872
}
73+
if options.Destination != "" {
74+
hash[DestinationKey] = options.Destination
75+
}
6976
return hash
7077
}
7178

exportoptions/non_appstore_options.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ type NonAppStoreOptionsModel struct {
1313
BundleIDProvisioningProfileMapping map[string]string
1414
SigningCertificate string
1515
SigningStyle string
16+
Destination string
1617
ICloudContainerEnvironment ICloudContainerEnvironment
1718
DistributionBundleIdentifier string
1819

@@ -43,9 +44,11 @@ func (options NonAppStoreOptionsModel) Hash() map[string]interface{} {
4344
if options.TeamID != "" {
4445
hash[TeamIDKey] = options.TeamID
4546
}
47+
//nolint:gosimple
4648
if options.CompileBitcode != CompileBitcodeDefault {
4749
hash[CompileBitcodeKey] = options.CompileBitcode
4850
}
51+
//nolint:gosimple
4952
if options.EmbedOnDemandResourcesAssetPacksInBundle != EmbedOnDemandResourcesAssetPacksInBundleDefault {
5053
hash[EmbedOnDemandResourcesAssetPacksInBundleKey] = options.EmbedOnDemandResourcesAssetPacksInBundle
5154
}
@@ -73,6 +76,9 @@ func (options NonAppStoreOptionsModel) Hash() map[string]interface{} {
7376
if options.SigningStyle != "" {
7477
hash[SigningStyleKey] = options.SigningStyle
7578
}
79+
if options.Destination != "" {
80+
hash[DestinationKey] = options.Destination
81+
}
7682
return hash
7783
}
7884

0 commit comments

Comments
 (0)