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
This commit is contained in:
Lukas Burkhalter 2024-08-27 13:15:12 +02:00 committed by GitHub
parent 2a07a34fb8
commit 4e8fad59d6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 54 additions and 47 deletions

View file

@ -2,7 +2,6 @@ name: 'build-gosop'
description: 'Build gosop from the current branch' description: 'Build gosop from the current branch'
inputs: inputs:
gopenpgp-ref: gopenpgp-ref:
description: 'gopenpgp branch tag or commit to build from' description: 'gopenpgp branch tag or commit to build from'
required: true required: true
@ -21,6 +20,12 @@ runs:
with: with:
ref: ${{ inputs.gopenpgp-ref }} ref: ${{ inputs.gopenpgp-ref }}
path: gopenpgp path: gopenpgp
- name: Set env
run: echo "GOSOP_BRANCH_REF=$(./.github/test-suite/determine_gosop_branch.sh)" >> $GITHUB_ENV
shell: bash
- name: Print gosop branch
run: echo ${{ env.GOSOP_BRANCH_REF}}
shell: bash
# Build gosop # Build gosop
- name: Set up latest golang - name: Set up latest golang
uses: actions/setup-go@v3 uses: actions/setup-go@v3
@ -30,6 +35,7 @@ runs:
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
repository: ProtonMail/gosop repository: ProtonMail/gosop
ref: ${{ env.GOSOP_BRANCH_REF}}
path: gosop path: gosop
- name: Cache go modules - name: Cache go modules
uses: actions/cache@v3 uses: actions/cache@v3

View file

@ -1,4 +1,6 @@
VERSION=$(awk '/^module github.com\/ProtonMail\/gopenpgp\/v[0-9]+/ {print $NF}' gopenpgp/go.mod | awk -F'v' '{print $2}')
cd gosop cd gosop
echo "replace github.com/ProtonMail/gopenpgp/v2 => ../gopenpgp" >> go.mod echo "replace github.com/ProtonMail/gopenpgp/v${VERSION} => ../gopenpgp" >> go.mod
go get github.com/ProtonMail/gopenpgp/v2/crypto go get github.com/ProtonMail/gopenpgp/v${VERSION}/crypto
go build . go build .

View file

@ -5,8 +5,8 @@
"path": "__GOSOP_BRANCH__" "path": "__GOSOP_BRANCH__"
}, },
{ {
"id": "gosop-main", "id": "gosop-target",
"path": "__GOSOP_MAIN__" "path": "__GOSOP_TARGET__"
}, },
{ {
"path": "__SQOP__" "path": "__SQOP__"
@ -17,10 +17,6 @@
{ {
"path": "__SOP_OPENPGPJS__" "path": "__SOP_OPENPGPJS__"
}, },
{
"id": "gosop-v2",
"path": "__GOSOP_V2__"
},
{ {
"path": "__RNP_SOP__" "path": "__RNP_SOP__"
} }

View file

@ -0,0 +1,7 @@
VERSION=$(awk '/^module github.com\/ProtonMail\/gopenpgp\/v[0-9]+/ {print $NF}' gopenpgp/go.mod | awk -F'v' '{print $2}')
if [ "$VERSION" -eq 3 ]; then
echo "gosop-gopenpgp-v3"
else
echo "gosop-gopenpgp-v2"
fi

View file

@ -1,13 +1,12 @@
CONFIG_TEMPLATE=$1 CONFIG_TEMPLATE=$1
CONFIG_OUTPUT=$2 CONFIG_OUTPUT=$2
GOSOP_BRANCH=$3 GOSOP_BRANCH=$3
GOSOP_MAIN=$4 GOSOP_TARGET=$4
cat $CONFIG_TEMPLATE \ cat $CONFIG_TEMPLATE \
| sed "s@__GOSOP_BRANCH__@${GOSOP_BRANCH}@g" \ | sed "s@__GOSOP_BRANCH__@${GOSOP_BRANCH}@g" \
| sed "s@__GOSOP_MAIN__@${GOSOP_MAIN}@g" \ | sed "s@__GOSOP_TARGET__@${GOSOP_TARGET}@g" \
| sed "s@__SQOP__@${SQOP}@g" \ | sed "s@__SQOP__@${SQOP}@g" \
| sed "s@__GPGME_SOP__@${GPGME_SOP}@g" \ | sed "s@__GPGME_SOP__@${GPGME_SOP}@g" \
| sed "s@__SOP_OPENPGPJS__@${SOP_OPENPGPJS}@g" \ | sed "s@__SOP_OPENPGPJS__@${SOP_OPENPGPJS_V2}@g" \
| sed "s@__GOSOP_V2__@${GOSOP_DIR_V2}/gosop@g" \
| sed "s@__RNP_SOP__@${RNP_SOP}@g" \ | sed "s@__RNP_SOP__@${RNP_SOP}@g" \
> $CONFIG_OUTPUT > $CONFIG_OUTPUT

View file

@ -4,12 +4,12 @@ on:
push: push:
branches: [ main ] branches: [ main ]
pull_request: pull_request:
branches: [ main ] branches: [ main, v2 ]
jobs: jobs:
build: build:
name: Build library for Android with gomobile name: Build library for Android with gomobile
runs-on: ubuntu-latest runs-on: ubuntu-20.04
steps: steps:
- name: Set up JDK 1.8 - name: Set up JDK 1.8

View file

@ -4,7 +4,7 @@ on:
push: push:
branches: [ main ] branches: [ main ]
pull_request: pull_request:
branches: [ main ] branches: [ main, v2 ]
jobs: jobs:
test: test:
@ -36,7 +36,7 @@ jobs:
- name: Test - name: Test
run: go test -v -race ./... run: go test -v -race ./...
lint: lint:
name: Lint name: Lint
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -48,4 +48,4 @@ jobs:
- name: golangci-lint - name: golangci-lint
uses: golangci/golangci-lint-action@v3 uses: golangci/golangci-lint-action@v3
with: with:
version: v1.50.1 version: v1.50.1

View file

@ -4,7 +4,7 @@ on:
push: push:
branches: [ main ] branches: [ main ]
pull_request: pull_request:
branches: [ main ] branches: [ main, v2 ]
jobs: jobs:
build: build:
@ -12,10 +12,10 @@ jobs:
runs-on: macos-latest runs-on: macos-latest
steps: steps:
- name: Set up xcode 14.2 - name: Set up xcode 14.3
uses: maxim-lobanov/setup-xcode@v1 uses: maxim-lobanov/setup-xcode@v1
with: with:
xcode-version: 14.2 xcode-version: 14.3
id: xcode id: xcode
- name: Set up Go 1.x - name: Set up Go 1.x
@ -31,9 +31,6 @@ jobs:
env: env:
platform: ${{ 'iOS Simulator' }} platform: ${{ 'iOS Simulator' }}
run: | run: |
for d in $ANDROID_NDK_HOME/../23*; do
ANDROID_NDK_HOME=$d
done
./build.sh apple ./build.sh apple
find dist find dist

View file

@ -2,7 +2,7 @@ name: SOP interoperability test suite
on: on:
pull_request: pull_request:
branches: [ main ] branches: [ main, v2 ]
jobs: jobs:
@ -23,8 +23,8 @@ jobs:
name: gosop-${{ github.sha }} name: gosop-${{ github.sha }}
path: ./gosop-${{ github.sha }} path: ./gosop-${{ github.sha }}
build-gosop-main: build-gosop-target:
name: Build gosop from main name: Build gosop from target
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
@ -32,40 +32,40 @@ jobs:
- name: Build gosop from branch - name: Build gosop from branch
uses: ./.github/actions/build-gosop uses: ./.github/actions/build-gosop
with: with:
gopenpgp-ref: main gopenpgp-ref: ${{ github.base_ref }}
binary-location: ./gosop-main binary-location: ./gosop-target
# Upload as artifact # Upload as artifact
- name: Upload gosop-main artifact - name: Upload gosop-target artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: gosop-main name: gosop-target
path: ./gosop-main path: ./gosop-target
test-suite: test-suite:
name: Run interoperability test suite name: Run interoperability test suite
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: container:
image: ghcr.io/protonmail/openpgp-interop-test-docker:v1.1.4 image: ghcr.io/protonmail/openpgp-interop-test-docker:v1.1.7
credentials: credentials:
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.github_token }} password: ${{ secrets.github_token }}
needs: needs:
- build-gosop - build-gosop
- build-gosop-main - build-gosop-target
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
# Fetch gosop from main # Fetch gosop from target
- name: Download gosop-main - name: Download gosop-target
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
with: with:
name: gosop-main name: gosop-target
# Test gosop-main # Test gosop-target
- name: Make gosop-main executable - name: Make gosop-target executable
run: chmod +x gosop-main run: chmod +x gosop-target
- name: Print gosop-main version - name: Print gosop-target version
run: ./gosop-main version --extended run: ./gosop-target version --extended
# Fetch gosop from branch # Fetch gosop from branch
- name: Download gosop-branch - name: Download gosop-branch
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
@ -80,7 +80,7 @@ jobs:
run: ./gosop-branch version --extended run: ./gosop-branch version --extended
# Run test suite # Run test suite
- name: Prepare test configuration - name: Prepare test configuration
run: ./.github/test-suite/prepare_config.sh $CONFIG_TEMPLATE $CONFIG_OUTPUT $GITHUB_WORKSPACE/gosop-branch $GITHUB_WORKSPACE/gosop-main run: ./.github/test-suite/prepare_config.sh $CONFIG_TEMPLATE $CONFIG_OUTPUT $GITHUB_WORKSPACE/gosop-branch $GITHUB_WORKSPACE/gosop-target
env: env:
CONFIG_TEMPLATE: .github/test-suite/config.json.template CONFIG_TEMPLATE: .github/test-suite/config.json.template
CONFIG_OUTPUT: .github/test-suite/config.json CONFIG_OUTPUT: .github/test-suite/config.json
@ -104,8 +104,8 @@ jobs:
name: test-suite-results.html name: test-suite-results.html
path: .github/test-suite/test-suite-results.html path: .github/test-suite/test-suite-results.html
compare-with-main: compare-with-target:
name: Compare with main name: Compare with target
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: test-suite needs: test-suite
steps: steps:
@ -117,9 +117,9 @@ jobs:
with: with:
name: test-suite-results.json name: test-suite-results.json
- name: Compare with baseline - name: Compare with baseline
uses: ProtonMail/openpgp-interop-test-analyzer@5d7f4b6868ebe3bfc909302828342c461f5f4940 uses: ProtonMail/openpgp-interop-test-analyzer@v2.0.0
with: with:
results: ${{ steps.download-test-results.outputs.download-path }}/test-suite-results.json results: ${{ steps.download-test-results.outputs.download-path }}/test-suite-results.json
output: baseline-comparison.json output: baseline-comparison.json
baseline: gosop-main baseline: gosop-target
target: gosop-branch target: gosop-branch