Skip to content

Commit

Permalink
Merge branch 'main' into chore/clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
2opremio authored Jun 27, 2024
2 parents 2d549a7 + ef78ce0 commit 2d6368f
Show file tree
Hide file tree
Showing 79 changed files with 849 additions and 725 deletions.
90 changes: 45 additions & 45 deletions .github/actions/setup-go/action.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
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'
# unfortunately we cannot use the provided caching because it uses the
# same cache for all workflows/jobs, leading to undesired cache clashes,
# causing uncached test runs etc ...
# You can see the cache key at https://github.com/actions/setup-go/blob/4e0b6c77c6448caafaff5eed51516cad78e7639a/src/cache-restore.ts#L34
# There is a ticket to add prefixes for the cache, which should solve it https://github.com/actions/setup-go/issues/358
cache: false

# 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-
# KEY_PREFIX must uniquely identify the specific instance of a job executing.
- shell: bash
run: |
echo 'KEY_PREFIX=${{ github.workflow }}-${{ github.job }}-${{ runner.os }}-${{ inputs.go-version }}-matrix(${{ join(matrix.*,'|') }})' >> $GITHUB_OUTPUT
echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_OUTPUT
echo "GOMODCACHE=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
if [ ${{ runner.os }} != 'Windows' ]; then echo SUDO='sudo' >> $GITHUB_OUTPUT; fi
id: variables

# 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-
# Cache the Go Modules downloaded during the job.
- uses: actions/cache@v4
with:
path: ${{ steps.variables.outputs.GOMODCACHE }}
key: ${{ steps.variables.outputs.KEY_PREFIX }}-go-mod-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ steps.variables.outputs.KEY_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@v4
with:
path: ${{ steps.variables.outputs.GOCACHE }}
key: ${{ steps.variables.outputs.KEY_PREFIX }}-go-build-${{ github.ref }}-${{ hashFiles('**', '!.git') }}
restore-keys: |
${{ steps.variables.outputs.KEY_PREFIX }}-go-build-${{ github.ref }}-
${{ steps.variables.outputs.KEY_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: ${{ steps.variables.outputs.SUDO }} rm -rf ${{ steps.variables.outputs.GOMODCACHE }} ${{ steps.variables.outputs.GOCACHE }}

# 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
36 changes: 21 additions & 15 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,27 @@ jobs:
fail-fast: false
matrix:
include:
- language: go
build-mode: autobuild
- language: go
build-mode: autobuild

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v4
- uses: ./.github/actions/setup-go
with:
go-version: 1.22
- run: rustup update
- uses: stellar/actions/rust-cache@main
- run: make build-libpreflight

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
12 changes: 6 additions & 6 deletions .github/workflows/dependency-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Dependency sanity checker

on:
push:
branches: [main, release/**]
branches: [ main, release/** ]
pull_request:

defaults:
Expand All @@ -13,14 +13,14 @@ 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: stellar/actions/rust-cache@main
- 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
18 changes: 9 additions & 9 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ name: Soroban Tools e2e

on:
push:
branches: [main, release/**]
branches: [ main, release/** ]
pull_request:

jobs:
integration:
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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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 }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
name: Linters
name: Go
on:
push:
branches:
- main
branches: [ main, release/** ]
pull_request:

permissions:
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
pull-requests: read
# Optional: allow the action to annotate code in the PR.
checks: write

jobs:
golangci:
golangci-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # version v3.0.2
uses: actions/checkout@v4
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
run: |
rustup update
Expand All @@ -31,8 +31,7 @@ jobs:
- name: Run golangci-lint
uses: golangci/golangci-lint-action@a4f60bb28d35aeee14e6880718e0c85ff1882e64 # version v6.0.1
with:
version: v1.52.2 # this is the golangci-lint version
args: --issues-exit-code=0 # exit without errors for now - won't fail the build
version: v1.59.1 # this is the golangci-lint version
github-token: ${{ secrets.GITHUB_TOKEN }}
only-new-issues: true

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/required_status_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ jobs:
with:
filter-workflow-names: |
Dependency sanity checker*
Linters*
Go*
Rust*
Soroban RPC*
4 changes: 2 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: stellar/actions/rust-cache@main
- uses: actions/checkout@v4
- run: rustup update
- uses: stellar/actions/rust-cache@main
- run: make rust-check
- run: make rust-test
Loading

0 comments on commit 2d6368f

Please sign in to comment.