Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move median from chainlink #1

Merged
merged 8 commits into from
Nov 27, 2023
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
76 changes: 6 additions & 70 deletions .github/workflows/pull-request-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
actions: read
steps:
- name: ci-lint
uses: smartcontractkit/.github/actions/ci-lint-go@main
uses: smartcontractkit/.github/actions/ci-lint-go@9e7cc0779934cae4a9028b8588c9adb64d8ce68c # [email protected]
with:
# grafana inputs
metrics-job-name: ci-lint
Expand All @@ -63,13 +63,13 @@ jobs:
go-cache-dep-path: "**/go.sum"
go-version-file: go.mod
golangci-lint-version: "v1.53.2"
golangci-lint-args: --out-format checkstyle:golangci-lint-report.xml ${{ needs.init.outputs.lint_args_packages }}
golangci-lint-args: --out-format colored-line-number,checkstyle:golangci-lint-report.xml

ci-lint-misc:
runs-on: ubuntu-latest
steps:
- name: ci-lint-misc
uses: smartcontractkit/.github/actions/ci-lint-misc@main
uses: smartcontractkit/.github/actions/ci-lint-misc@9e7cc0779934cae4a9028b8588c9adb64d8ce68c # [email protected]
with:
# grafana inputs
metrics-job-name: ci-lint-misc
Expand All @@ -84,7 +84,7 @@ jobs:
actions: read
steps:
- name: ci-test
uses: smartcontractkit/.github/actions/ci-test-go@main
uses: smartcontractkit/.github/actions/ci-test-go@9e7cc0779934cae4a9028b8588c9adb64d8ce68c # [email protected]
with:
# grafana inputs
metrics-job-name: ci-test
Expand All @@ -102,82 +102,18 @@ jobs:
go-version-file: go.mod
go-test-cmd: make test-ci

ci-build-artifacts-matrix:
needs: [init]
runs-on: ubuntu20.04-16cores-64GB
strategy:
fail-fast: false
matrix:
package: ${{ fromJson(needs.init.outputs.matrix_packages) }}
permissions:
id-token: write
contents: read
actions: read
steps:
- name: ci-build-artifacts-matrix (${{ matrix.package }})
uses: smartcontractkit/.github/actions/cicd-build-publish-artifacts-go@main
with:
# general inputs
app-name: chainlink-feeds-${{ matrix.package }}
publish: "true"
# grafana inputs
metrics-job-name: ci-build-artifacts-matrix (${{ matrix.package }})
gc-basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }}
gc-host: ${{ secrets.GRAFANA_CLOUD_HOST }}
# aws inputs
aws-region: ${{ secrets.AWS_REGION }}
aws-role-arn: ${{ secrets.AWS_OIDC_IAM_ROLE_ARN }}
aws-account-number: ${{ secrets.AWS_ACCOUNT_NUMBER_PROD }}
# golang inputs
go-version-file: go.mod
# goreleaser inputs
goreleaser-args: "--nightly --config ./${{ matrix.package }}/.goreleaser.ci.yaml"
goreleaser-dist: goreleaser-pro
goreleaser-key: ${{ secrets.GORELEASER_KEY }}
# zig inputs
use-zig: "true"
zig-version: "0.11.0"
# docker inputs
docker-registry: aws
docker-image-tag: devel
- name: Save GoReleaser artifacts/metadata
uses: actions/upload-artifact@v3
with:
name: goreleaser_${{ matrix.package }}
path: |
dist/artifacts.json
dist/metadata.json

ci-build-artifacts:
runs-on: ubuntu-latest
needs: [ci-build-artifacts-matrix]
if: always()
steps:
- name: Check results
if: needs.ci-build-artifacts-matrix.result != 'success'
run: exit 1
- name: Collect metrics
if: always()
id: collect-gha-metrics
uses: smartcontractkit/push-gha-metrics-action@d1618b772a97fd87e6505de97b872ee0b1f1729a # v2.0.2
with:
basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }}
hostname: ${{ secrets.GRAFANA_CLOUD_HOST }}
this-job-name: ci-build-artifacts
continue-on-error: true

ci-sonarqube:
needs: [ci-lint, ci-test]
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- name: ci-sonarqube
uses: smartcontractkit/.github/actions/ci-sonarqube@main
uses: smartcontractkit/.github/actions/ci-sonarqube@cc4cbbd6d39a8e84915b356379a4ef6a16dceaf9 # [email protected]
with:
# grafana inputs
metrics-job-name: ci-sonarqube
gc-basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }}
gc-host: ${{ secrets.GRAFANA_CLOUD_HOST }}
# sonarqube inputs
sonar-token: ${{ secrets.SONAR_TOKEN }}
sonar-host-url: ${{ secrets.SONAR_HOST_URL }}
sonar-host-url: ${{ secrets.SONAR_HOST_URL }}
76 changes: 4 additions & 72 deletions .github/workflows/push-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
actions: read
steps:
- name: ci-lint
uses: smartcontractkit/.github/actions/ci-lint-go@main
uses: smartcontractkit/.github/actions/ci-lint-go@9e7cc0779934cae4a9028b8588c9adb64d8ce68c # [email protected]
with:
# grafana inputs
metrics-job-name: ci-lint
Expand All @@ -55,7 +55,7 @@ jobs:
go-cache-dep-path: "**/go.sum"
go-version-file: go.mod
golangci-lint-version: "v1.53.2"
golangci-lint-args: --out-format checkstyle:golangci-lint-report.xml ${{ needs.init.outputs.lint_args_packages }}
golangci-lint-args: --out-format colored-line-number,checkstyle:golangci-lint-report.xml

ci-test:
runs-on: ubuntu-latest
Expand All @@ -65,7 +65,7 @@ jobs:
actions: read
steps:
- name: ci-test
uses: smartcontractkit/.github/actions/ci-test-go@main
uses: smartcontractkit/.github/actions/ci-test-go@9e7cc0779934cae4a9028b8588c9adb64d8ce68c # [email protected]
with:
# grafana inputs
metrics-job-name: ci-test
Expand All @@ -83,81 +83,13 @@ jobs:
go-version-file: go.mod
go-test-cmd: make test-ci

cicd-build-publish-artifacts-dev-matrix:
needs: [init]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
package: ${{ fromJson(needs.init.outputs.matrix_packages) }}
permissions:
id-token: write
contents: write
actions: read
steps:
- name: cicd-build-publish-artifacts-dev-matrix (${{ matrix.package }})
uses: smartcontractkit/.github/actions/cicd-build-publish-artifacts-go@main
with:
# general inputs
app-name: chainlink-feeds-${{ matrix.package }}
publish: "true"
# grafana inputs
metrics-job-name: cicd-build-publish-artifacts-dev-matrix (${{ matrix.package }})
gc-basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }}
gc-host: ${{ secrets.GRAFANA_CLOUD_HOST }}
# aws inputs
aws-region: ${{ secrets.AWS_REGION }}
aws-role-arn: ${{ secrets.AWS_OIDC_IAM_ROLE_ARN }}
aws-account-number: ${{ secrets.AWS_ACCOUNT_NUMBER_PROD }}
# gati inputs
use-gati: "true"
aws-role-arn-gati: ${{ secrets.AWS_OIDC_IAM_ROLE_ARN_GATI }}
aws-lambda-url-gati: ${{ secrets.AWS_LAMBDA_URL_GATI }}
# golang inputs
go-version-file: go.mod
# goreleaser inputs
goreleaser-args: "--nightly --config ./${{ matrix.package }}/.goreleaser.ci.yaml"
goreleaser-dist: goreleaser-pro
goreleaser-key: ${{ secrets.GORELEASER_KEY }}
# zig inputs
use-zig: "true"
zig-version: "0.11.0"
# docker inputs
docker-registry: aws
docker-image-tag: devel
- name: Save GoReleaser artifacts/metadata
uses: actions/upload-artifact@v3
with:
name: goreleaser_${{ matrix.package }}
path: |
dist/artifacts.json
dist/metadata.json

cicd-build-publish-artifacts-dev:
runs-on: ubuntu-latest
needs: [cicd-build-publish-artifacts-dev-matrix]
if: always()
steps:
- name: Check results
if: needs.cicd-build-publish-artifacts-dev-matrix.result != 'success'
run: exit 1
- name: Collect metrics
if: always()
id: collect-gha-metrics
uses: smartcontractkit/push-gha-metrics-action@d1618b772a97fd87e6505de97b872ee0b1f1729a # v2.0.2
with:
basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }}
hostname: ${{ secrets.GRAFANA_CLOUD_HOST }}
this-job-name: cicd-build-publish-artifacts-dev
continue-on-error: true

ci-sonarqube:
needs: [ci-lint, ci-test]
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- name: ci-sonarqube
uses: smartcontractkit/.github/actions/ci-sonarqube@main
uses: smartcontractkit/.github/actions/ci-sonarqube@cc4cbbd6d39a8e84915b356379a4ef6a16dceaf9 # [email protected]
with:
# grafana inputs
metrics-job-name: ci-sonarqube
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.idea
coverage.txt
output.txt
104 changes: 104 additions & 0 deletions .goreleaser-template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
env:
- GOPRIVATE=github.com/smartcontractkit/*
- ZIG_EXEC={{ if index .Env "ZIG_EXEC" }}{{ .Env.ZIG_EXEC }}{{ else }}zig{{ end }}
- IMAGE_REPO={{ if index .Env "IMAGE_REPO" }}{{ .Env.IMAGE_REPO }}{{ else }}localhost:5001/{{ .ProjectName }}{{ end }}

# See https://goreleaser.com/customization/build/
builds:
- binary: "{{ .ProjectName }}"
id: linux-amd64
main: ./cmd
env:
- CGO_ENABLED=1
- CC=$ZIG_EXEC cc -target x86_64-linux-gnu
- CCX=$ZIG_EXEC c++ -target x86_64-linux-gnu
flags:
- -trimpath
- -buildmode=pie
goos:
- linux
goarch:
- amd64
- binary: "{{ .ProjectName }}"
id: linux-arm64
main: ./cmd
env:
- CGO_ENABLED=1
- CC=$ZIG_EXEC cc -target aarch64-linux-gnu
- CCX=$ZIG_EXEC c++ -target aarch64-linux-gnu
flags:
- -trimpath
- -buildmode=pie
goos:
- linux
goarch:
- arm64

# See https://goreleaser.com/customization/docker/
dockers:
- id: linux-amd64
dockerfile: ./../Dockerfile
use: buildx
goos: linux
goarch: amd64
build_flag_templates:
- "--build-arg=app={{ .ProjectName }}"
- "--platform=linux/amd64"
- "--label=org.opencontainers.image.created={{ .Date }}"
- "--label=org.opencontainers.image.name={{ .ProjectName }}"
- "--label=org.opencontainers.image.revision={{ .FullCommit }}"
- "--label=org.opencontainers.image.version={{ .Version }}"
- "--label=org.opencontainers.image.source={{ .GitURL }}"
image_templates:
- "{{ if and (not .IsSnapshot) (not .IsNightly) }}{{ .Env.IMAGE_REPO }}:{{ .Version }}-amd64{{ end }}"
- "{{ if or (.IsSnapshot) (.IsNightly) }}{{ .Env.IMAGE_REPO }}:sha-{{ .ShortCommit }}-amd64{{ end }}"

- id: linux-arm64
dockerfile: ./../Dockerfile
use: buildx
goos: linux
goarch: arm64
build_flag_templates:
- "--build-arg=app={{ .ProjectName }}"
- "--platform=linux/arm64"
- "--label=org.opencontainers.image.created={{ .Date }}"
- "--label=org.opencontainers.image.name={{ .ProjectName }}"
- "--label=org.opencontainers.image.revision={{ .FullCommit }}"
- "--label=org.opencontainers.image.version={{ .Version }}"
- "--label=org.opencontainers.image.source={{ .GitURL }}"
image_templates:
- "{{ if and (not .IsSnapshot) (not .IsNightly) }}{{ .Env.IMAGE_REPO }}:{{ .Version }}-arm64{{ end }}"
- "{{ if or (.IsSnapshot) (.IsNightly) }}{{ .Env.IMAGE_REPO }}:sha-{{ .ShortCommit }}-arm64{{ end }}"

# See https://goreleaser.com/customization/docker_manifest/
docker_manifests:
- name_template: "{{ if and (not .IsSnapshot) (not .IsNightly) }}{{ .Env.IMAGE_REPO }}:{{ .Version }}{{ end }}"
image_templates:
- "{{ if and (not .IsSnapshot) (not .IsNightly) }}{{ .Env.IMAGE_REPO }}:{{ .Version }}-amd64{{ end }}"
- "{{ if and (not .IsSnapshot) (not .IsNightly) }}{{ .Env.IMAGE_REPO }}:{{ .Version }}-arm64{{ end }}"
- name_template: "{{ if or (.IsSnapshot) (.IsNightly) }}{{ .Env.IMAGE_REPO }}:sha-{{ .ShortCommit }}{{ end }}"
image_templates:
- "{{ if or (.IsSnapshot) (.IsNightly) }}{{ .Env.IMAGE_REPO }}:sha-{{ .ShortCommit }}-amd64{{ end }}"
- "{{ if or (.IsSnapshot) (.IsNightly) }}{{ .Env.IMAGE_REPO }}:sha-{{ .ShortCommit }}-arm64{{ end }}"

checksum:
name_template: "checksums.txt"
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"

# GitHub Release
release:
github:
owner: smartcontractkit
name: chainlink-feeds
# If there is a prerelease suffix on the version tag (e.g. v1.0.0-rc1), then
# the GitHub Release will be created as a "prerelease".
# Default is false.
prerelease: auto
disable: true
19 changes: 19 additions & 0 deletions .goreleaser.ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Requires GoReleaser Pro
includes:
- from_file:
path: ./.goreleaser.yaml

nightly:
# This is a GoReleaser Pro feature that we use for pre-releases.
# Default is `{{ incpatch .Version }}-{{ .ShortCommit }}-nightly`.
name_template: '{{ incpatch .Version }}-{{ .ShortCommit }}-devel'

# Tag name to create if publish_release is enabled.
tag_name: devel

# Creates a GitHub Release
publish_release: false

# Whether to delete previous pre-releases for the same `tag_name` when
# releasing.
keep_single_release: false
10 changes: 10 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Requires GoReleaser Pro
includes:
- from_file:
path: ./.goreleaser-template.yaml

project_name: chainlink-feeds

monorepo:
tag_prefix: chainlink-feeds@
dir: chainlink-feeds
22 changes: 22 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.PHONY: all
all: build

.PHONY: build
build:
go build ./...

.PHONY: test
test:
go test ./...

.PHONY: test-ci
test-ci:
go test ./... -covermode=atomic -coverpkg=./... -coverprofile=./coverage.txt -json | tee output.txt

.PHONY: lint
lint:
golangci-lint run ./...

.PHONY: tidy
tidy:
go mod tidy
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Chainlink Feeds

This repo contains the Chainlink feeds plugin.
Loading