diff --git a/.github/actions/setup-go/action.yml b/.github/actions/setup-go/action.yml index 1bfd4a41..1936ca24 100644 --- a/.github/actions/setup-go/action.yml +++ b/.github/actions/setup-go/action.yml @@ -1,55 +1,21 @@ name: 'Setup the Go environment' description: 'Installs go and restores/saves the build/module cache' -inputs: - go-version: - required: true runs: using: "composite" steps: - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: ${{ inputs.go-version }} - stable: ${{ !(contains(inputs.go-version, 'beta') || contains(inputs.go-version, 'rc')) }} + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.22' - # Restore original modification time of files based on the date of the most - # recent commit that modified them as mtimes affect the Go test cache. - - name: Restore modification time of checkout files - shell: bash - run: | - # Set a base, fixed modification time of all directories. - # git-restore-mtime doesn't set the mtime of all directories. - # (see https://github.com/MestreLion/git-tools/issues/47 for details) - touch -m -t '201509301646' $(find . -type d -not -path '.git/*') - # Restore original modification time from git. git clone sets the - # modification time to the current time, but Go tests that access fixtures - # get invalidated if their modification times change. - sudo apt-get install -y git-restore-mtime - git restore-mtime + # Restore original modification time of files based on the date of the most + # recent commit that modified them as mtimes affect the Go test cache. + # See https://github.com/golang/go/issues/58571 for details + - name: Restore modification time of checkout files + uses: chetan/git-restore-mtime-action@075f9bc9d159805603419d50f794bd9f33252ebe - # The PREFIX must uniquely identify the specific instance of a job executing. - - shell: bash - run: echo 'PREFIX=${{ github.workflow }}-${{ github.job }}-${{ runner.os }}-${{ inputs.go-version }}-matrix(${{ join(matrix.*,'|') }})' >> $GITHUB_ENV - - # Cache the Go Modules downloaded during the job. - - uses: actions/cache@v2 - with: - path: ~/go/pkg/mod - key: ${{ env.PREFIX }}-go-mod-${{ hashFiles('**/go.sum') }} - restore-keys: ${{ env.PREFIX }}-go-mod- - - # Cache any build and test artifacts during the job, which will speed up - # rebuilds and cause test runs to skip tests that have no reason to rerun. - - uses: actions/cache@v2 - with: - path: ~/.cache/go-build - key: ${{ env.PREFIX }}-go-build-${{ github.ref }}-${{ hashFiles('**', '!.git') }} - restore-keys: | - ${{ env.PREFIX }}-go-build-${{ github.ref }}- - ${{ env.PREFIX }}-go-build- - - # Reset the cache for master/protected branches, to ensure they build and run the tests from zero - # and that the module cache is cleaned (otherwise it accumulates orphan dependencies over time). - - if: github.ref_protected - shell: bash - run: sudo rm -rf ~/.cache/go-build ~/go/pkg/mod + # Reset the cache for master/protected branches, to ensure they build and run the tests from zero + # and that the module cache is cleaned (otherwise it accumulates orphan dependencies over time). + - if: github.ref_protected + shell: bash + run: sudo rm -rf ~/.cache/go-build ~/go/pkg/mod diff --git a/.github/workflows/dependency-check.yml b/.github/workflows/dependency-check.yml index 79a14aa7..91ed52b6 100644 --- a/.github/workflows/dependency-check.yml +++ b/.github/workflows/dependency-check.yml @@ -2,7 +2,7 @@ name: Dependency sanity checker on: push: - branches: [main, release/**] + branches: [ main, release/** ] pull_request: defaults: @@ -13,14 +13,12 @@ jobs: dependency-sanity-checker: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: rustup update - - uses: actions/setup-go@v3 - with: - go-version: 1.22 + - uses: ./.github/actions/setup-go - run: scripts/check-dependencies.bash validate-rust-git-rev-deps: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: stellar/actions/rust-check-git-rev-deps@main diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index ce1677ad..f14121e9 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -2,7 +2,7 @@ name: Soroban Tools e2e on: push: - branches: [main, release/**] + branches: [ main, release/** ] pull_request: jobs: @@ -10,7 +10,7 @@ jobs: name: System tests strategy: matrix: - scenario-filter: ["^TestDappDevelop$/^.*$"] + scenario-filter: [ "^TestDappDevelop$/^.*$" ] runs-on: ubuntu-latest-4-cores env: # the gh tag of system-test repo version to run @@ -28,7 +28,7 @@ jobs: # or set SYSTEM_TEST_CORE_GIT_REF to empty, and set SYSTEM_TEST_CORE_IMAGE # to pull a pre-compiled image from dockerhub instead SYSTEM_TEST_CORE_IMAGE: stellar/stellar-core:20 - SYSTEM_TEST_CORE_IMAGE_BIN_PATH: /usr/bin/stellar-core + SYSTEM_TEST_CORE_IMAGE_BIN_PATH: /usr/bin/stellar-core # sets the version of rust toolchain that will be pre-installed in the # test runtime environment, tests invoke rustc/cargo @@ -42,8 +42,8 @@ jobs: # option #2, set the version of stellar-sdk used as a ref to a gh repo if # a value is set on SYSTEM_TEST_JS_STELLAR_SDK_GH_REPO, it takes # precedence over any SYSTEM_TEST_JS_STELLAR_SDK_NPM_VERSION - SYSTEM_TEST_JS_STELLAR_SDK_GH_REPO: - SYSTEM_TEST_JS_STELLAR_SDK_GH_REF: + SYSTEM_TEST_JS_STELLAR_SDK_GH_REPO: + SYSTEM_TEST_JS_STELLAR_SDK_GH_REF: # the version of rs-stellar-xdr to use for quickstart SYSTEM_TEST_RS_XDR_GIT_REF: v20.0.2 @@ -59,18 +59,18 @@ jobs: SYSTEM_TEST_SOROBAN_EXAMPLES_GIT_HASH: "v20.0.0" SYSTEM_TEST_SOROBAN_EXAMPLES_GIT_REPO: "https://github.com/stellar/soroban-examples.git" steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 name: checkout system-test with: repository: stellar/system-test ref: ${{ env.SYSTEM_TEST_GIT_REF }} path: system-test - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 name: checkout soroban-tools with: repository: stellar/soroban-tools path: soroban-tools - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 name: checkout soroban-rpc with: repository: stellar/soroban-rpc @@ -81,7 +81,7 @@ jobs: run: | rm -rf $GITHUB_WORKSPACE/system-test/js-stellar-sdk; - if: ${{ env.SYSTEM_TEST_JS_STELLAR_SDK_GH_REPO != ''}} - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: ${{ env.SYSTEM_TEST_JS_STELLAR_SDK_GH_REPO }} ref: ${{ env.SYSTEM_TEST_JS_STELLAR_SDK_GH_REF }} diff --git a/.github/workflows/golang.yml b/.github/workflows/golang.yml index a9726b9e..fd0f6bcb 100644 --- a/.github/workflows/golang.yml +++ b/.github/workflows/golang.yml @@ -8,7 +8,7 @@ permissions: contents: read # Optional: allow read access to pull request. Use with `only-new-issues` option. pull-requests: read - # Optional: allow write access to checks to allow the action to annotate code in the PR. + # Optional: allow the action to annotate code in the PR. checks: write jobs: @@ -20,10 +20,7 @@ jobs: with: fetch-depth: 0 # required for new-from-rev option in .golangci.yml - - name: Setup GO - uses: actions/setup-go@268d8c0ca0432bb2cf416faae41297df9d262d7f # version v3.3.0 - with: - go-version: '>=1.22.1' + - uses: ./.github/actions/setup-go - uses: stellar/actions/rust-cache@main - name: Build libpreflight diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 6f9dd3fa..6b1cb36a 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -13,7 +13,7 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: rustup update - uses: stellar/actions/rust-cache@main - run: make rust-check diff --git a/.github/workflows/soroban-rpc.yml b/.github/workflows/soroban-rpc.yml index e9122e82..882cf708 100644 --- a/.github/workflows/soroban-rpc.yml +++ b/.github/workflows/soroban-rpc.yml @@ -15,10 +15,9 @@ jobs: strategy: matrix: os: [ ubuntu-20.04, ubuntu-22.04 ] - go: [ 1.22 ] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: # For pull requests, build and test the PR head not a merge of the PR with the destination. ref: ${{ github.event.pull_request.head.sha || github.ref }} @@ -26,8 +25,6 @@ jobs: # Otherwise, the Go test cache will fail (due to the modification time of fixtures changing). fetch-depth: "0" - uses: ./.github/actions/setup-go - with: - go-version: ${{ matrix.go }} - run: rustup update - uses: stellar/actions/rust-cache@main - run: make build-libpreflight @@ -55,13 +52,8 @@ jobs: go_arch: amd64 runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 - # we cannot use our own ./.github/actions/setup-go action - # because it uses apt-get and some OSs (e.g. windows) don't have it - - uses: actions/setup-go@v3 - with: - go-version: 1.22 - + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup-go # On windows, make sure we have the same compiler (linker) used by rust. # This is important since the symbols names won't match otherwise. - if: matrix.os == 'windows-latest' @@ -102,7 +94,6 @@ jobs: strategy: matrix: os: [ ubuntu-20.04, ubuntu-22.04 ] - go: [ 1.22 ] protocol-version: [ 20, 21 ] runs-on: ${{ matrix.os }} env: @@ -114,7 +105,7 @@ jobs: PROTOCOL_21_CORE_DEBIAN_PKG_VERSION: 21.0.1-1897.dfd3dbff1.focal PROTOCOL_21_CORE_DOCKER_IMG: stellar/unsafe-stellar-core:21.0.1-1897.dfd3dbff1.focal steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: # For pull requests, build and test the PR head not a merge of the PR with the destination. ref: ${{ github.event.pull_request.head.sha || github.ref }} @@ -123,8 +114,6 @@ jobs: fetch-depth: "0" - uses: ./.github/actions/setup-go - with: - go-version: ${{ matrix.go }} - name: Pull and set Stellar Core image shell: bash