Skip to content

Commit

Permalink
Merge pull request #2714 from onflow/bastian/mutability-restrictions
Browse files Browse the repository at this point in the history
  • Loading branch information
turbolent authored Aug 11, 2023
2 parents 894095b + 7f32297 commit 4acc8de
Show file tree
Hide file tree
Showing 224 changed files with 18,436 additions and 28,572 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
- 'v**'

env:
GO_VERSION: '1.19.2'
GO_VERSION: '1.20'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
Expand All @@ -23,12 +23,11 @@ jobs:
benchmark:
name: Performance regression check
runs-on: ubuntu-latest
if: github.event.pull_request.head.repo.full_name == github.repository
steps:
- name: Set benchmark repetitions
# reducing repetition will speed up execution,
# but will be more inaccurate at detecting change
run: echo "::set-output name=benchmark_repetitions::7"
run: echo "benchmark_repetitions=7" >> "$GITHUB_OUTPUT"
id: settings

- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
- 'v**'

env:
GO_VERSION: '1.19.2'
GO_VERSION: '1.20'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
- 'v**'

env:
GO_VERSION: '1.19.2'
GO_VERSION: '1.20'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
Expand Down
19 changes: 14 additions & 5 deletions .github/workflows/compatibility-check-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: BackwardCompatibilityCheckTemplate
on:
workflow_call:
inputs:
repo:
required: true
type: string
default: onflow/cadence
current-branch:
required: true
type: string
Expand All @@ -17,7 +21,7 @@ on:
type: string

env:
GO_VERSION: '1.19.2'
GO_VERSION: '1.20'

concurrency:
group: ${{ github.workflow }}-${{ inputs.base-branch || github.run_id }}-${{ inputs.chain }}
Expand Down Expand Up @@ -72,12 +76,18 @@ jobs:
path: tmp/contracts.csv
key: ${{ steps.cache-key-generator.outputs.cache-key }}-contracts

- name: Configure permissions
if: github.repository != 'onflow/cadence'
run: |
echo "GOPRIVATE=github.com/${{ inputs.repo }}" >> "$GITHUB_ENV"
git config --global url."https://${{ github.actor }}:${{ github.token }}@github.com".insteadOf "https://github.com"
# Check contracts using current branch

- name: Check contracts using ${{ inputs.current-branch }}
working-directory: ./tools/compatibility-check
run: |
GOPROXY=direct go get github.com/onflow/cadence@${{ inputs.current-branch }}
GOPROXY=direct go mod edit -replace github.com/onflow/cadence=github.com/${{ inputs.repo }}@${{ inputs.current-branch }}
go mod tidy
go run ./cmd/check_contracts/main.go ../../tmp/contracts.csv ../../tmp/output-new.txt
Expand All @@ -86,7 +96,7 @@ jobs:
- name: Check contracts using ${{ inputs.base-branch }}
working-directory: ./tools/compatibility-check
run: |
GOPROXY=direct go get github.com/onflow/cadence@${{ inputs.base-branch }}
GOPROXY=direct go mod edit -replace github.com/onflow/cadence=github.com/${{ inputs.repo }}@${{ inputs.base-branch }}
go mod tidy
go run ./cmd/check_contracts/main.go ../../tmp/contracts.csv ../../tmp/output-old.txt
Expand All @@ -103,6 +113,5 @@ jobs:
# Check Diff

- name: Check diff
working-directory: ./tools/compatibility-check
run: |
go run ./cmd/check_diff/main.go ../../tmp/output-old.txt ../../tmp/output-new.txt
diff -u --color ./tmp/output-old.txt ./tmp/output-new.txt
10 changes: 8 additions & 2 deletions .github/workflows/compatibility-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: BackwardCompatibilityCheck
on:
workflow_dispatch:
inputs:
repo:
description: Repository (defaults to 'onflow/cadence')
branch:
description: 'Current branch/tag'
required: true
Expand All @@ -21,7 +23,7 @@ on:
- 'v**'

env:
GO_VERSION: '1.19.2'
GO_VERSION: '1.20'

concurrency:
group: ${{ github.workflow }}-${{ inputs.base || github.run_id }}
Expand All @@ -32,6 +34,7 @@ jobs:
runs-on: ubuntu-latest
outputs:
# Map step output to the job output, so that next job can use these values.
repo: ${{ steps.setup.outputs.repo }}
branch: ${{ steps.setup.outputs.branch }}
base: ${{ steps.setup.outputs.base }}
steps:
Expand All @@ -44,19 +47,21 @@ jobs:
# instead of the branch name, since 'go get' command does not support all kinds of branch names.
#
# Here there also is a limitation that we can't use the 'merge-branch' because it is not visible to 'go get'.
# So the workflow will not work across forks.
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "repo=`(echo "${{ github.event.pull_request.head.repo.full_name }}")`" >> $GITHUB_OUTPUT
echo "branch=`(echo "${{ github.event.pull_request.head.sha }}")`" >> $GITHUB_OUTPUT
echo "base=`(echo "${{ github.base_ref }}")`" >> $GITHUB_OUTPUT
else
echo "repo=`(echo "${{ inputs.repo || github.repository }}")`" >> $GITHUB_OUTPUT
echo "branch=`(echo "${{ inputs.branch }}")`" >> $GITHUB_OUTPUT
echo "base=`(echo "${{ inputs.base }}")`" >> $GITHUB_OUTPUT
fi
mainnet:
needs: setup
uses: ./.github/workflows/compatibility-check-template.yml
with:
repo: ${{ needs.setup.outputs.repo }}
base-branch: ${{ needs.setup.outputs.base }}
current-branch: ${{ needs.setup.outputs.branch }}
chain: flow-mainnet
Expand All @@ -66,6 +71,7 @@ jobs:
needs: setup
uses: ./.github/workflows/compatibility-check-template.yml
with:
repo: ${{ needs.setup.outputs.repo }}
base-branch: ${{ needs.setup.outputs.base }}
current-branch: ${{ needs.setup.outputs.branch }}
chain: flow-testnet
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/downstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
- 'v**'

env:
GO_VERSION: '1.19.2'
GO_VERSION: '1.20'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
Expand All @@ -40,7 +40,7 @@ jobs:
run: sh crypto_setup.sh

- name: Update Cadence
run: go mod edit -replace github.com/onflow/cadence=github.com/${{ github.event.pull_request.head.repo.full_name }}@${{ github.event.pull_request.head.sha }}
run: go mod edit -replace github.com/onflow/cadence=github.com/${{ github.event.pull_request.head.repo.full_name || github.repository }}@${{ github.event.pull_request.head.sha || github.sha }}

- name: Tidy up
run: go mod tidy
Expand All @@ -65,7 +65,7 @@ jobs:
cache: true

- name: Update Cadence
run: go mod edit -replace github.com/onflow/cadence=github.com/${{ github.event.pull_request.head.repo.full_name }}@${{ github.event.pull_request.head.sha }}
run: go mod edit -replace github.com/onflow/cadence=github.com/${{ github.event.pull_request.head.repo.full_name || github.repository }}@${{ github.event.pull_request.head.sha || github.sha }}

- name: Tidy up
run: go mod tidy
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ on:
default: 'master'

env:
GO_VERSION: '1.19.2'
GO_VERSION: '1.20'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
Expand Down
2 changes: 2 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Bastian Müller <[email protected]> <[email protected]>
Bastian Müller <[email protected]> <[email protected]>
Loading

0 comments on commit 4acc8de

Please sign in to comment.