Skip to content

Commit 4e8fad5

Browse files
authored
CI: Update v2 branch CI to be on par with v3 (#286)
* ci: Update CI to be on par with v3 * ci: Update gosop branch for GopenPGP-v2
1 parent 2a07a34 commit 4e8fad5

9 files changed

Lines changed: 54 additions & 47 deletions

File tree

.github/actions/build-gosop/action.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ name: 'build-gosop'
22
description: 'Build gosop from the current branch'
33

44
inputs:
5-
65
gopenpgp-ref:
76
description: 'gopenpgp branch tag or commit to build from'
87
required: true
@@ -21,6 +20,12 @@ runs:
2120
with:
2221
ref: ${{ inputs.gopenpgp-ref }}
2322
path: gopenpgp
23+
- name: Set env
24+
run: echo "GOSOP_BRANCH_REF=$(./.github/test-suite/determine_gosop_branch.sh)" >> $GITHUB_ENV
25+
shell: bash
26+
- name: Print gosop branch
27+
run: echo ${{ env.GOSOP_BRANCH_REF}}
28+
shell: bash
2429
# Build gosop
2530
- name: Set up latest golang
2631
uses: actions/setup-go@v3
@@ -30,6 +35,7 @@ runs:
3035
uses: actions/checkout@v3
3136
with:
3237
repository: ProtonMail/gosop
38+
ref: ${{ env.GOSOP_BRANCH_REF}}
3339
path: gosop
3440
- name: Cache go modules
3541
uses: actions/cache@v3

.github/test-suite/build_gosop.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
VERSION=$(awk '/^module github.com\/ProtonMail\/gopenpgp\/v[0-9]+/ {print $NF}' gopenpgp/go.mod | awk -F'v' '{print $2}')
2+
13
cd gosop
2-
echo "replace github.com/ProtonMail/gopenpgp/v2 => ../gopenpgp" >> go.mod
3-
go get github.com/ProtonMail/gopenpgp/v2/crypto
4+
echo "replace github.com/ProtonMail/gopenpgp/v${VERSION} => ../gopenpgp" >> go.mod
5+
go get github.com/ProtonMail/gopenpgp/v${VERSION}/crypto
46
go build .

.github/test-suite/config.json.template

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"path": "__GOSOP_BRANCH__"
66
},
77
{
8-
"id": "gosop-main",
9-
"path": "__GOSOP_MAIN__"
8+
"id": "gosop-target",
9+
"path": "__GOSOP_TARGET__"
1010
},
1111
{
1212
"path": "__SQOP__"
@@ -17,10 +17,6 @@
1717
{
1818
"path": "__SOP_OPENPGPJS__"
1919
},
20-
{
21-
"id": "gosop-v2",
22-
"path": "__GOSOP_V2__"
23-
},
2420
{
2521
"path": "__RNP_SOP__"
2622
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
VERSION=$(awk '/^module github.com\/ProtonMail\/gopenpgp\/v[0-9]+/ {print $NF}' gopenpgp/go.mod | awk -F'v' '{print $2}')
2+
3+
if [ "$VERSION" -eq 3 ]; then
4+
echo "gosop-gopenpgp-v3"
5+
else
6+
echo "gosop-gopenpgp-v2"
7+
fi
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
CONFIG_TEMPLATE=$1
22
CONFIG_OUTPUT=$2
33
GOSOP_BRANCH=$3
4-
GOSOP_MAIN=$4
4+
GOSOP_TARGET=$4
55
cat $CONFIG_TEMPLATE \
66
| sed "s@__GOSOP_BRANCH__@${GOSOP_BRANCH}@g" \
7-
| sed "s@__GOSOP_MAIN__@${GOSOP_MAIN}@g" \
7+
| sed "s@__GOSOP_TARGET__@${GOSOP_TARGET}@g" \
88
| sed "s@__SQOP__@${SQOP}@g" \
99
| sed "s@__GPGME_SOP__@${GPGME_SOP}@g" \
10-
| sed "s@__SOP_OPENPGPJS__@${SOP_OPENPGPJS}@g" \
11-
| sed "s@__GOSOP_V2__@${GOSOP_DIR_V2}/gosop@g" \
10+
| sed "s@__SOP_OPENPGPJS__@${SOP_OPENPGPJS_V2}@g" \
1211
| sed "s@__RNP_SOP__@${RNP_SOP}@g" \
1312
> $CONFIG_OUTPUT

.github/workflows/android.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ on:
44
push:
55
branches: [ main ]
66
pull_request:
7-
branches: [ main ]
7+
branches: [ main, v2 ]
88

99
jobs:
1010
build:
1111
name: Build library for Android with gomobile
12-
runs-on: ubuntu-latest
12+
runs-on: ubuntu-20.04
1313

1414
steps:
1515
- name: Set up JDK 1.8

.github/workflows/go.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
branches: [ main ]
66
pull_request:
7-
branches: [ main ]
7+
branches: [ main, v2 ]
88

99
jobs:
1010
test:
@@ -36,7 +36,7 @@ jobs:
3636

3737
- name: Test
3838
run: go test -v -race ./...
39-
39+
4040
lint:
4141
name: Lint
4242
runs-on: ubuntu-latest
@@ -48,4 +48,4 @@ jobs:
4848
- name: golangci-lint
4949
uses: golangci/golangci-lint-action@v3
5050
with:
51-
version: v1.50.1
51+
version: v1.50.1

.github/workflows/ios.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@ on:
44
push:
55
branches: [ main ]
66
pull_request:
7-
branches: [ main ]
7+
branches: [ main, v2 ]
88

99
jobs:
1010
build:
1111
name: Build library for iOS with gomobile
1212
runs-on: macos-latest
1313

1414
steps:
15-
- name: Set up xcode 14.2
15+
- name: Set up xcode 14.3
1616
uses: maxim-lobanov/setup-xcode@v1
1717
with:
18-
xcode-version: 14.2
18+
xcode-version: 14.3
1919
id: xcode
2020

2121
- name: Set up Go 1.x
@@ -31,9 +31,6 @@ jobs:
3131
env:
3232
platform: ${{ 'iOS Simulator' }}
3333
run: |
34-
for d in $ANDROID_NDK_HOME/../23*; do
35-
ANDROID_NDK_HOME=$d
36-
done
3734
./build.sh apple
3835
find dist
3936

.github/workflows/sop-test-suite.yml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: SOP interoperability test suite
22

33
on:
44
pull_request:
5-
branches: [ main ]
5+
branches: [ main, v2 ]
66

77
jobs:
88

@@ -23,49 +23,49 @@ jobs:
2323
name: gosop-${{ github.sha }}
2424
path: ./gosop-${{ github.sha }}
2525

26-
build-gosop-main:
27-
name: Build gosop from main
26+
build-gosop-target:
27+
name: Build gosop from target
2828
runs-on: ubuntu-latest
2929
steps:
3030
- name: Checkout
3131
uses: actions/checkout@v3
3232
- name: Build gosop from branch
3333
uses: ./.github/actions/build-gosop
3434
with:
35-
gopenpgp-ref: main
36-
binary-location: ./gosop-main
35+
gopenpgp-ref: ${{ github.base_ref }}
36+
binary-location: ./gosop-target
3737
# Upload as artifact
38-
- name: Upload gosop-main artifact
38+
- name: Upload gosop-target artifact
3939
uses: actions/upload-artifact@v3
4040
with:
41-
name: gosop-main
42-
path: ./gosop-main
41+
name: gosop-target
42+
path: ./gosop-target
4343

4444

4545
test-suite:
4646
name: Run interoperability test suite
4747
runs-on: ubuntu-latest
4848
container:
49-
image: ghcr.io/protonmail/openpgp-interop-test-docker:v1.1.4
49+
image: ghcr.io/protonmail/openpgp-interop-test-docker:v1.1.7
5050
credentials:
5151
username: ${{ github.actor }}
5252
password: ${{ secrets.github_token }}
5353
needs:
5454
- build-gosop
55-
- build-gosop-main
55+
- build-gosop-target
5656
steps:
5757
- name: Checkout
5858
uses: actions/checkout@v3
59-
# Fetch gosop from main
60-
- name: Download gosop-main
59+
# Fetch gosop from target
60+
- name: Download gosop-target
6161
uses: actions/download-artifact@v3
6262
with:
63-
name: gosop-main
64-
# Test gosop-main
65-
- name: Make gosop-main executable
66-
run: chmod +x gosop-main
67-
- name: Print gosop-main version
68-
run: ./gosop-main version --extended
63+
name: gosop-target
64+
# Test gosop-target
65+
- name: Make gosop-target executable
66+
run: chmod +x gosop-target
67+
- name: Print gosop-target version
68+
run: ./gosop-target version --extended
6969
# Fetch gosop from branch
7070
- name: Download gosop-branch
7171
uses: actions/download-artifact@v3
@@ -80,7 +80,7 @@ jobs:
8080
run: ./gosop-branch version --extended
8181
# Run test suite
8282
- name: Prepare test configuration
83-
run: ./.github/test-suite/prepare_config.sh $CONFIG_TEMPLATE $CONFIG_OUTPUT $GITHUB_WORKSPACE/gosop-branch $GITHUB_WORKSPACE/gosop-main
83+
run: ./.github/test-suite/prepare_config.sh $CONFIG_TEMPLATE $CONFIG_OUTPUT $GITHUB_WORKSPACE/gosop-branch $GITHUB_WORKSPACE/gosop-target
8484
env:
8585
CONFIG_TEMPLATE: .github/test-suite/config.json.template
8686
CONFIG_OUTPUT: .github/test-suite/config.json
@@ -104,8 +104,8 @@ jobs:
104104
name: test-suite-results.html
105105
path: .github/test-suite/test-suite-results.html
106106

107-
compare-with-main:
108-
name: Compare with main
107+
compare-with-target:
108+
name: Compare with target
109109
runs-on: ubuntu-latest
110110
needs: test-suite
111111
steps:
@@ -117,9 +117,9 @@ jobs:
117117
with:
118118
name: test-suite-results.json
119119
- name: Compare with baseline
120-
uses: ProtonMail/openpgp-interop-test-analyzer@5d7f4b6868ebe3bfc909302828342c461f5f4940
120+
uses: ProtonMail/openpgp-interop-test-analyzer@v2.0.0
121121
with:
122122
results: ${{ steps.download-test-results.outputs.download-path }}/test-suite-results.json
123123
output: baseline-comparison.json
124-
baseline: gosop-main
124+
baseline: gosop-target
125125
target: gosop-branch

0 commit comments

Comments
 (0)