Skip to content

Commit

Permalink
fix references, scope pipeline better
Browse files Browse the repository at this point in the history
  • Loading branch information
Tofel committed Aug 23, 2024
1 parent 1760400 commit 088964c
Show file tree
Hide file tree
Showing 30 changed files with 423 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,26 @@ on:
types: [labeled]

jobs:
changes:
runs-on: ubuntu-latest
environment: integration
outputs:
ctf_changes: ${{ steps.changes.outputs.src }}
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Check for relevant changes
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: changes
with:
filters: |
src:
- '!(seth|havoc|wasp|tools)/**'
eth_env:
if: ${{ github.event_name == 'pull_request_review' || github.event.label.name == 'docker_tests' }}
if: ${{ needs.changes.outputs.ctf_changes == 'true' && (github.event_name == 'pull_request_review' || github.event.label.name == 'docker_tests') }}
runs-on: ubuntu-latest
name: Docker Test ${{ matrix.test.name }}
needs: [changes]
strategy:
fail-fast: false
matrix:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,29 @@ env:
TEST_LOG_LEVEL: debug

jobs:
changes:
runs-on: ubuntu-latest
environment: integration
outputs:
ctf_changes: ${{ steps.changes.outputs.src }}
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Check for relevant changes
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: changes
with:
filters: |
src:
- '!(seth|havoc|wasp|tools)/**'
build_tests:
runs-on: ubuntu-latest
environment: integration
permissions:
id-token: write
contents: read
needs: [changes]
if: needs.changes.outputs.ctf_changes == 'true'
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Build Base Image
Expand All @@ -34,6 +51,7 @@ jobs:
AWS_REGION: ${{ secrets.QA_AWS_REGION }}
AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
- name: Base Image Built

run: |
# shellcheck disable=SC2086
cat <<EOT >>$GITHUB_STEP_SUMMARY
Expand All @@ -56,6 +74,7 @@ jobs:
cat <<EOT >>$GITHUB_STEP_SUMMARY
### chainlink-testing-framework-tests image tag for this test run :ship: -> \`ci.${{ github.sha }}\`
EOT
e2e_tests:
runs-on: ubuntu-latest
environment: integration
Expand All @@ -64,8 +83,17 @@ jobs:
contents: read
env:
TEST_SUITE: local-runner
needs: [changes]
if: needs.changes.outputs.ctf_changes == 'true'
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Check for relevant changes
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: changes
with:
filters: |
src:
- '!(seth|havoc|wasp|tools)/**'
- name: Install Nix
uses: cachix/install-nix-action@8887e596b4ee1134dae06b98d573bd674693f47c # v26
with:
Expand Down Expand Up @@ -108,7 +136,8 @@ jobs:
e2e_remote_runner_tests:
runs-on: ubuntu-latest
environment: integration
needs: [build_tests]
needs: [build_tests, changes]
if: needs.changes.outputs.ctf_changes == 'true'
permissions:
id-token: write
contents: read
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@ on:
- 'v*'

jobs:
changes:
runs-on: ubuntu-latest
environment: integration
outputs:
ctf_changes: ${{ steps.changes.outputs.src }}
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Check for relevant changes
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: changes
with:
filters: |
src:
- '!(seth|havoc|wasp|tools)/**'
publish_test_base_image:
runs-on: ubuntu-latest
environment: integration
Expand All @@ -13,6 +28,8 @@ jobs:
contents: read
env:
BASE_IMAGE_TAG: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/test-base-image:${{ github.ref_name }}
needs: [changes]
if: needs.changes.outputs.ctf_changes == 'true'
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Build Base Image
Expand Down
128 changes: 119 additions & 9 deletions .github/workflows/lint.yaml → .github/workflows/ctf-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,33 @@ on:
pull_request:

jobs:
changes:
runs-on: ubuntu-latest
environment: integration
outputs:
ctf_changes: ${{ steps.changes.outputs.ctf_src }}
tools_changes: ${{ steps.changes.outputs.tools_src }}
charts_changes: ${{ steps.changes.outputs.charts_src }}
actions_changes: ${{ steps.changes.outputs.actions_src }}
k8s_test_runner_changes: ${{ steps.changes.outputs.k8s_test_runner_src }}
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Check for relevant changes
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: changes
with:
filters: |
ctf_src:
- '!(seth|havoc|wasp|tools)/**'
tools_src:
- 'tools/**'
charts_src:
- 'charts/**'
actions_src:
- '.github/**'
k8s_test_runner_src:
- 'k8s-test-runner/**'
pre-commit:
name: Pre-commit checks
runs-on: ubuntu-latest
Expand All @@ -29,8 +56,10 @@ jobs:
gitdiffs=\$(git diff --name-only ${BASE_REF}...${HEAD_REF} | xargs) &&\
echo \"changed files: \$gitdiffs\" &&\
pre-commit run --hook-stage pre-commit --show-diff-on-failure --color=always --files \${gitdiffs}"
tools:
tools-version:
name: Get tool-versions
needs: [changes]
runs-on: ubuntu-latest
steps:
- name: Check out Code
Expand All @@ -40,20 +69,56 @@ jobs:
id: tool-versions
outputs:
golangci-lint-version: ${{ steps.tool-versions.outputs.golangci-lint_version }}
golangci:

golangci-ctf:
name: Linting-${{ matrix.project.name }}
runs-on: ubuntu-latest
needs: [tools]
needs: [changes, tools-version]
if: needs.changes.outputs.ctf_changes == 'true'
strategy:
fail-fast: false
matrix:
project:
- name: root
path: ./
steps:
- name: Check out Code
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Install Go
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/setup-go@e29366cdecfe6befff9ab8c3cfe4825218505d58 # v2.3.16
with:
test_download_vendor_packages_command: cd ${{ matrix.project.path }} && go mod download
go_mod_path: ${{ matrix.project.path }}go.mod
cache_key_id: ctf-go-${{ matrix.project.name }}
cache_restore_only: 'false'
- name: golangci-lint ${{ needs.tools-version.outputs.golangci-lint-version }}
uses: golangci/golangci-lint-action@9d1e0624a798bb64f6c3cea93db47765312263dc # v5.1.0
with:
version: v${{ needs.tools-version.outputs.golangci-lint-version }}
args: --out-format checkstyle:golangci-lint-report.xml
skip-cache: true
working-directory: ${{ matrix.project.path }}
- name: Print lint report artifact
if: always()
run: test -f ${{ matrix.project.path }}golangci-lint-report.xml || true
- name: Store lint report artifact
if: always()
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: golangci-lint-report-${{ matrix.project.name }}
path: ${{ matrix.project.path }}golangci-lint-report.xml

golangci-tools:
name: Linting-${{ matrix.project.name }}
runs-on: ubuntu-latest
needs: [changes, tools-version]
if: needs.changes.outputs.tools_changes == 'true'
strategy:
fail-fast: false
matrix:
project:
- name: gotestloghelper
path: ./tools/gotestloghelper/
- name: k8s-test-runner
path: ./k8s-test-runner/
- name: testlistgenerator
path: ./tools/testlistgenerator/
- name: ecrimagefetcher
Expand All @@ -74,10 +139,48 @@ jobs:
go_mod_path: ${{ matrix.project.path }}go.mod
cache_key_id: ctf-go-${{ matrix.project.name }}
cache_restore_only: 'false'
- name: golangci-lint ${{ needs.tools.outputs.golangci-lint-version }}
- name: golangci-lint ${{ needs.tools-version.outputs.golangci-lint-version }}
uses: golangci/golangci-lint-action@9d1e0624a798bb64f6c3cea93db47765312263dc # v5.1.0
with:
version: v${{ needs.tools-version.outputs.golangci-lint-version }}
args: --out-format checkstyle:golangci-lint-report.xml
skip-cache: true
working-directory: ${{ matrix.project.path }}
- name: Print lint report artifact
if: always()
run: test -f ${{ matrix.project.path }}golangci-lint-report.xml || true
- name: Store lint report artifact
if: always()
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: golangci-lint-report-${{ matrix.project.name }}
path: ${{ matrix.project.path }}golangci-lint-report.xml

golangci-k8s-test-runner:
name: Linting-${{ matrix.project.name }}
runs-on: ubuntu-latest
needs: [changes, tools-version]
if: needs.changes.outputs.k8s_test_runner_changes == 'true'
strategy:
fail-fast: false
matrix:
project:
- name: k8s-test-runner
path: ./k8s-test-runner/
steps:
- name: Check out Code
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Install Go
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/setup-go@e29366cdecfe6befff9ab8c3cfe4825218505d58 # v2.3.16
with:
test_download_vendor_packages_command: cd ${{ matrix.project.path }} && go mod download
go_mod_path: ${{ matrix.project.path }}go.mod
cache_key_id: ctf-go-${{ matrix.project.name }}
cache_restore_only: 'false'
- name: golangci-lint ${{ needs.tools-version.outputs.golangci-lint-version }}
uses: golangci/golangci-lint-action@9d1e0624a798bb64f6c3cea93db47765312263dc # v5.1.0
with:
version: v${{ needs.tools.outputs.golangci-lint-version }}
version: v${{ needs.tools-version.outputs.golangci-lint-version }}
args: --out-format checkstyle:golangci-lint-report.xml
skip-cache: true
working-directory: ${{ matrix.project.path }}
Expand All @@ -94,7 +197,7 @@ jobs:
vulnerabilities-check:
name: Check for Vulnerabilities
runs-on: ubuntu-latest
needs: [tools]
needs: [tools-version]
steps:
- name: Check out Code
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
Expand All @@ -113,6 +216,8 @@ jobs:
asdf-install:
name: Validate GitHub Action Workflows
runs-on: ubuntu-latest
needs: [changes]
if: needs.changes.outputs.actions_changes == 'true' || needs.changes.outputs.charts_changes == 'true'
steps:
- name: Check out Code
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
Expand All @@ -122,6 +227,8 @@ jobs:
helmlint:
name: Lint Helm Charts
runs-on: ubuntu-latest
needs: [changes]
if: needs.changes.outputs.charts_changes == 'true'
steps:
- name: Checkout
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
Expand All @@ -139,6 +246,8 @@ jobs:
actionlint:
name: Validate GitHub Action Workflows
runs-on: ubuntu-latest
needs: [changes]
if: needs.changes.outputs.actions_changes == 'true'
steps:
- name: Check out Code
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
Expand All @@ -147,7 +256,8 @@ jobs:

sonarqube:
name: SonarQube Analysis
needs: [golangci]
needs: [golangci-ctf, golangci-tools, golangci-k8s-test-runner]
if: ${{ needs.golangci-ctf.result != 'skipped' || needs.golangci-tools.result != 'skipped' || needs.golangci-k8s-test-runner.result != 'skipped' }}
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions seth/client_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (

"github.com/ethereum/go-ethereum/core/types"
"github.com/pkg/errors"
"github.com/smartcontractkit/seth"
"github.com/stretchr/testify/require"

"github.com/smartcontractkit/seth/test_utils"
"github.com/smartcontractkit/chainlink-testing-framework/seth"
"github.com/smartcontractkit/chainlink-testing-framework/seth/test_utils"
)

func TestAPI(t *testing.T) {
Expand Down
10 changes: 6 additions & 4 deletions seth/client_contract_map_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ package seth_test

import (
"crypto/ecdsa"
"os"
"testing"

"github.com/barkimedes/go-deepcopy"
"github.com/ethereum/go-ethereum/common"
"github.com/smartcontractkit/seth"
"github.com/smartcontractkit/seth/test_utils"
"github.com/stretchr/testify/require"
"os"
"testing"

"github.com/smartcontractkit/chainlink-testing-framework/seth"
"github.com/smartcontractkit/chainlink-testing-framework/seth/test_utils"
)

func TestContractMapSavesDeployedContractsToFileAndReadsThem(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion seth/client_decode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"math/big"
"testing"

"github.com/smartcontractkit/seth"
"github.com/smartcontractkit/chainlink-testing-framework/seth"
"github.com/stretchr/testify/require"
)

Expand Down
8 changes: 4 additions & 4 deletions seth/client_main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/pkg/errors"
"github.com/smartcontractkit/seth"
network_debug_contract "github.com/smartcontractkit/seth/contracts/bind/debug"
network_sub_contract "github.com/smartcontractkit/seth/contracts/bind/sub"
"github.com/stretchr/testify/require"

link_token "github.com/smartcontractkit/seth/contracts/bind/link"
"github.com/smartcontractkit/chainlink-testing-framework/seth"
network_debug_contract "github.com/smartcontractkit/chainlink-testing-framework/seth/contracts/bind/debug"
link_token "github.com/smartcontractkit/chainlink-testing-framework/seth/contracts/bind/link"
network_sub_contract "github.com/smartcontractkit/chainlink-testing-framework/seth/contracts/bind/sub"
)

/*
Expand Down
Loading

0 comments on commit 088964c

Please sign in to comment.