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 3b26bd4
Show file tree
Hide file tree
Showing 38 changed files with 462 additions and 85 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
name: (all packages) Docker Test Env tests
name: CTF Docker Test Env tests
on:
pull_request_review:
types: [submitted]
pull_request:
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
@@ -1,4 +1,4 @@
name: (k8s package) E2E tests
name: CTF k8s E2E tests
on:
pull_request:

Expand All @@ -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
@@ -1,10 +1,25 @@
name: (k8s package) Publish Test Base Image
name: CTF k8s Publish Test Base Image
on:
push:
tags:
- '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
130 changes: 120 additions & 10 deletions .github/workflows/lint.yaml → .github/workflows/ctf-lint.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,38 @@
name: (all packages) Lints
name: CTF Lints
on:
push:
branches:
- main
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
Original file line number Diff line number Diff line change
@@ -1,15 +1,32 @@
name: (all packages) Static Analysis
name: CTF Static Analysis
on:
push:
branches: [main]
schedule:
- cron: '23 19 * * 4'
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)/**'
codeQL:
name: CodeQL Checks
runs-on: ubuntu-latest
permissions:
security-events: write
needs: [changes]
if: ${{ needs.changes.outputs.ctf_changes == 'true' }}
steps:
- name: Checkout repository
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: (all packages) Unit tests
name: CTF Unit tests
on:
push:
tags:
Expand Down
Loading

0 comments on commit 3b26bd4

Please sign in to comment.