Skip to content
This repository was archived by the owner on Aug 29, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions .github/actions/copy-workflow-go/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,32 @@ description: Copy workflow steps specific to go
runs:
using: "composite"
steps:
# GitHub Actions Expressions do not support last item access/array length retrieval
- id: go
run: echo "::set-output name=version::$(jq -r '.[-1]' <<< '${{ toJSON(matrix.cfg.go.versions) }}')"
shell: bash
- uses: actions/setup-go@v3
with:
# This should be the same Go version we use in the go-check workflow.
# go mod tidy, go vet, staticcheck and gofmt might behave differently depending on the version.
go-version: "1.19.x"
go-version: ${{ steps.go.outputs.version }}
- name: bump go.mod go version if needed
uses: protocol/[email protected]
with:
working-directory: ${{ env.TARGET_REPO_DIR }}
run: |
# We want our modules to support two Go versions at a time.
# As of August 2022, Go 1.19 is the latest stable.
# go.mod's Go version declares the language version being used.
# As such, it has to be the minimum of all Go versions supported.
# Bump this every six months, as new Go versions come out.
TARGET_VERSION=1.18
PREVIOUS_TARGET_VERSION=1.17
TARGET_VERSION='${{ matrix.cfg.go.versions[0] }}'
TARGET_VERSION="${TARGET_VERSION%.x}"
TARGET_MAJOR_VERSION="${TARGET_VERSION%.[0-9]*}"
TARGET_MINOR_VERSION="${TARGET_VERSION#[0-9]*.}"
# Assumptions:
# - all versions are targetted incrementally
# - no versions are skipped
# - patch version is never pinned explicitly
PREVIOUS_TARGET_VERSION="$TARGET_MAJOR_VERSION.$(($TARGET_MINOR_VERSION-1))"
# Note that the "<" comparison doesn't understand semver,
# but it should be good enough for the foreseeable future.
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/release-check.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: Release Checker
on: [ workflow_call ]
on:
workflow_call:
inputs:
go-version:
required: true
type: string
default: 1.19.x # TODO: remove once release-check is upgraded in all the targets

jobs:
releaser:
Expand All @@ -10,7 +16,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: "1.19.x"
go-version: ${{ inputs.go-version }}
- id: version
name: Determine version
env:
Expand Down
9 changes: 9 additions & 0 deletions configs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,12 @@ To customise the copy workflow further, you can add more fields to the `defaults
## Testing

You can use [testing](https://github.com/protocol/.github/tree/testing) branch for worklow/configuration testing. Once you push your changes to the branch, a [dispatch](../.github/workflows/dispatch.yml) workflow will be triggered. The workflow will use [testing.json](testing.json) configuration file only. You can manipalate that configuration file as needed(you can copy all the `defaults` from [go.json](go.json) for [example](https://github.com/protocol/.github/commit/43476995428996a90ca95bf838f084ba1a710c68)).

## Upgrading Go

To upgrade Go, modify the `defaults.go.versions` array in the [Go config](go.json).

Remember to:
- Keep the array sorted in increasing order,
- Upgrade versions incrementally. Do not skip a version,
- never pin the patch version (`"1.19.x"` is correct, `"1.19.8"` is incorrect).
5 changes: 4 additions & 1 deletion configs/go.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
".github/workflows/tagpush.yml"
],
"deploy_versioning": true,
"deploy_go": true
"deploy_go": true,
"go": {
"versions": [ "1.18.x", "1.19.x" ]
}
},
"repositories": [
{
Expand Down
2 changes: 1 addition & 1 deletion templates/.github/workflows/go-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
uses: protocol/.github/.github/actions/read-config@next
- uses: actions/setup-go@v3
with:
go-version: "1.19.x"
go-version: ${{{ config.go.versions[-1] }}}
- name: Run repo-specific setup
uses: ./.github/actions/go-check-setup
if: hashFiles('./.github/actions/go-check-setup') != ''
Expand Down
2 changes: 1 addition & 1 deletion templates/.github/workflows/go-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
fail-fast: false
matrix:
os: [ "ubuntu", "windows", "macos" ]
go: [ "1.18.x", "1.19.x" ]
go: ${{{ config.go.versions }}}
env:
COVERAGES: ""
runs-on: ${{ fromJSON(vars[format('UCI_GO_TEST_RUNNER_{0}', matrix.os)] || format('"{0}-latest"', matrix.os)) }}
Expand Down
2 changes: 2 additions & 0 deletions templates/.github/workflows/release-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ on:
jobs:
release-check:
uses: protocol/.github/.github/workflows/release-check.yml@master
with:
go-version: ${{{ config.go.versions[-1] }}}