Skip to content

Commit fd70074

Browse files
fix(okx): Update OKX/MEXC endpoints and add dYdX Github Actions workflows (#14)
* fix(okx): deprecate wsaws.okx.com endpoint * fix(build): add Dockerfile and reference new slinky-dev-base image * build(e2e): ghcr authz and pull * fix: use github.repository_owner * build(docker): port from skip to dydxprotocol ghcr.io * build(docker): add image labels pointing to new repo * build(actions): normalize github actions workflows * build(docker): upgrade to 1.25.1 debian trixie base images * build(docker): update simapp go.mod, fix slinky-dev-base key * build(docker): update Makefile docker-build to include all images * fix(tests): use errors.New for constant label * chore(tests): update petri test go.mod for go 1.25.1 * build(e2e): add qemu and setup buildx * tests(docker): e2e tests depend on e2e builds, not all docker builds * build(actions): source go version from .go-version and test * build(docker): clean up image names * chore(infra): delete nomad manifest * fix(docker): fix sidecar.prod base url * fix(test): integration test image names * build(docker): change testapp->local * perf(build): enable caching for build.yml workflow * build(docker): enable go build caching and integrate with actions * build(actions): restrict qemu to arm64,amd64 * build(actions): disable check-latest for setup-go * build(actions): overwrite when extracting go caches * build(actions): rm go module cache, don't overwrite * build(actions): override perms for rm go module cache * build(actions): use linux/amd64, linux/arm64, sequoia, tahoe * chore(readme): remove notes about missing dydx support * build(actions): consolidate base images, add alpine workflow * fix: rm dev-base * fix(docker-build action): don't iterate platforms * build(lint): remove hardcoded go version * build(e2e): remove multi-platform builds as runner only uses native arch * test(integration): use local image references to use build products * test(integration): build dependencies and load to local docker daemon * build(docker): add scope tags for caching * build(docker): add github token to avoid cache throttling * build(docker): remove linux/arm64 builds * fix(docker): install certificates after second FROM * chore(okx): remove unused URL's * fix(providers): fix mexc websocket url
1 parent b9c6a9b commit fd70074

34 files changed

+429
-576
lines changed

.dockerignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,13 @@
11
go.work*
2+
#.git
3+
#**/.git
4+
~/.cache/go-build
5+
~/go/pkg/mod
6+
/go/pkg/mod
7+
/root/.cache/go-build
8+
/go.work
9+
/build
10+
/.buildx-cache
11+
/Users/*/Library/Caches/go-build
12+
/Users/*/go/pkg/mod
13+
/src

.github/workflows/build-docker.yml

Lines changed: 34 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -14,101 +14,57 @@ jobs:
1414
build:
1515
strategy:
1616
matrix:
17-
image: [{file: "slinky.base.Dockerfile", name: "slinky-base"},{file: "slinky.e2e.Dockerfile", name: "slinky-simapp"}, {file: "slinky.sidecar.prod.Dockerfile", name: "slinky-sidecar"}, {file: "slinky.local.Dockerfile", name: "slinky-testapp"}, {file: "slinky.sidecar.e2e.Dockerfile", name: "slinky-e2e-sidecar"}]
18-
runs-on: ubuntu-latest-m
17+
image: [
18+
{file: "slinky.base.Dockerfile", name: "slinky-base"},
19+
{file: "slinky.sim.app.Dockerfile", name: "slinky-sim-app"},
20+
{file: "slinky.local.Dockerfile", name: "slinky-local-app"},
21+
{file: "slinky.sidecar.e2e.Dockerfile", name: "slinky-e2e-sidecar"},
22+
{file: "slinky.sidecar.Dockerfile", name: "slinky-sidecar"},
23+
{file: "slinky.market.simulator.Dockerfile", name: "slinky-market-simulator"},
24+
]
25+
runs-on: ubuntu-latest
1926
permissions:
2027
contents: read
2128
packages: write
22-
env:
23-
registry_url: 494494944992.dkr.ecr.us-east-2.amazonaws.com/skip-mev/${{ matrix.image.name }}
24-
repo_name: skip-mev/${{ matrix.image.name }}
29+
2530
steps:
2631
- name: Check out the PR commit head
27-
uses: actions/checkout@v4
32+
uses: actions/checkout@v5
2833
if: github.event_name == 'pull_request'
2934
with:
3035
ref: ${{ github.event.pull_request.head.sha }}
36+
3137
- name: Check out the repo
32-
uses: actions/checkout@v4
38+
uses: actions/checkout@v5
3339
if: github.event_name != 'pull_request'
34-
- name: Configure AWS Credentials
35-
uses: aws-actions/[email protected]
36-
with:
37-
aws-region: us-east-2
38-
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
39-
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
40-
- name: Login to Amazon ECR
41-
id: login-ecr
42-
uses: aws-actions/amazon-ecr-login@v2
43-
- name: Log in to the Container registry
44-
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
40+
41+
- name: Login to GHCR
42+
uses: docker/login-action@v3
4543
with:
4644
registry: ghcr.io
47-
username: ${{ github.actor }}
45+
username: ${{ github.repository_owner }}
4846
password: ${{ secrets.GITHUB_TOKEN }}
49-
- name: Set up QEMU
50-
uses: docker/setup-qemu-action@v3
47+
5148
- name: Set up Docker Buildx
5249
uses: docker/setup-buildx-action@v3
53-
- name: Create ECR repository if it does not exist
54-
run: |
55-
aws ecr describe-repositories --region us-east-2 --repository-names $repo_name || aws ecr create-repository --repository-name $repo_name --region us-east-2
56-
- name: Docker meta
57-
id: meta
58-
uses: docker/metadata-action@v5
59-
env:
60-
DOCKER_METADATA_PR_HEAD_SHA: true
50+
51+
- uses: actions/cache@v4
6152
with:
62-
# list of Docker images to use as base name for tags
63-
images: |
64-
${{ env.registry_url }}
65-
ghcr.io/skip-mev/${{ matrix.image.name }}
66-
tags: |
67-
type=ref,event=pr
68-
type=semver,pattern=v{{major}}.{{minor}}.{{patch}}
69-
type=semver,pattern=v{{major}}
70-
type=sha,priority=700,prefix=
71-
type=ref,event=branch
53+
path: |
54+
~/.cache/go-build
55+
~/go/pkg/mod
56+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
57+
restore-keys: |
58+
${{ runner.os }}-go-
59+
7260
- name: Build and push
73-
uses: docker/build-push-action@v5
61+
uses: docker/build-push-action@v6
7462
with:
7563
context: .
64+
push: ${{ github.event_name == 'push' }}
65+
platforms: linux/amd64
7666
file: "./contrib/images/${{ matrix.image.file }}"
77-
tags: ${{ steps.meta.outputs.tags }}
78-
labels: ${{ steps.meta.outputs.labels }}
79-
push: true
80-
platforms: ${{ startsWith(github.ref, 'refs/tags/v') && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
81-
- uses: cloudposse/[email protected]
82-
id: out
83-
with:
84-
matrix-step-name: github-action-matrix-outputs-read
85-
matrix-key: ${{ matrix.image.name }}
86-
outputs: |-
87-
image: ${{ steps.meta.outputs.version }}
88-
deploy:
89-
needs: [build]
90-
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch'
91-
runs-on: ubuntu-latest
92-
environment: dev
93-
permissions:
94-
id-token: write
95-
steps:
96-
- name: Check out the repo
97-
uses: actions/checkout@v4
98-
- uses: cloudposse/github-action-matrix-outputs-read@main
99-
id: matrix_output
100-
with:
101-
matrix-step-name: github-action-matrix-outputs-read
102-
- name: Update the image tags
103-
uses: skip-mev/gitops-actions/update-values@main
104-
with:
105-
service: "slinky"
106-
app_id: ${{ vars.DEPLOYER_APP_ID }}
107-
app_private_key: ${{ secrets.DEPLOYER_PRIVATE_KEY }}
108-
manifests_repo: "slinky-manifests"
109-
values_file_name: "values-dev.yaml"
110-
modified_values: |
111-
{
112-
".chain.image.tag": "${{ fromJSON(steps.matrix_output.outputs.result).image['slinky-testapp'] }}",
113-
".sidecar.image.tag": "${{ fromJSON(steps.matrix_output.outputs.result).image['slinky-e2e-sidecar'] }}",
114-
}
67+
tags: ghcr.io/dydxprotocol/${{ matrix.image.name }}:latest
68+
cache-from: type=gha,scope=${{ matrix.image.name }}
69+
cache-to: type=gha,mode=max,scope=${{ matrix.image.name }}
70+
github-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/build.yml

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,51 @@ jobs:
1212

1313
strategy:
1414
matrix:
15-
os: [linux, darwin]
16-
arch: [amd64, arm64, 386]
17-
exclude:
15+
include:
16+
- os: linux
17+
arch: amd64
18+
runner: ubuntu-latest
19+
- os: linux
20+
arch: arm64
21+
runner: ubuntu-latest
1822
- os: darwin
19-
arch: 386
23+
arch: arm64
24+
runner: macos-15
25+
- os: darwin
26+
arch: arm64
27+
runner: macos-26
2028

2129
steps:
2230
- name: Checkout code
23-
uses: actions/checkout@v3
31+
uses: actions/checkout@v5
2432

2533
- name: Set up Go
26-
uses: actions/setup-go@v5
34+
uses: actions/setup-go@v6
2735
with:
28-
go-version: "1.23.3"
36+
go-version-file: .go-version
37+
check-latest: false
2938

3039
- name: Set environment variables
3140
run: |
3241
echo "GOOS=${{ matrix.os }}" >> $GITHUB_ENV
3342
echo "GOARCH=${{ matrix.arch }}" >> $GITHUB_ENV
3443
35-
- name: Build chain and sidecar
44+
- name: Clear Go module cache dir
45+
run: sudo rm -rf ~/go/pkg/mod
46+
47+
- uses: actions/cache@v4
48+
with:
49+
path: |
50+
~/.cache/go-build
51+
~/go/pkg/mod
52+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
53+
restore-keys: |
54+
${{ runner.os }}-go-
55+
56+
- name: Build chain
57+
run: |
58+
make build-sim-app
59+
60+
- name: Build sidecar
3661
run: |
37-
make build-test-app && make build
62+
make build

.github/workflows/e2e.yml

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,56 @@
11
name: E2E tests
2-
on:
2+
on:
33
pull_request:
44
paths-ignore:
55
- docs/**
66
branches:
77
- main
88
- release/v1.x.x
99
workflow_dispatch:
10-
10+
1111
jobs:
1212
e2e:
1313
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
packages: read
1417
steps:
15-
- uses: actions/checkout@v4
16-
- uses: actions/setup-go@v5
18+
- uses: actions/checkout@v5
19+
20+
- uses: actions/setup-go@v6
1721
with:
18-
go-version: 1.23.3
19-
cache: true
20-
cache-dependency-path: go.sum
22+
go-version-file: .go-version
23+
check-latest: false
24+
25+
- name: Set up Docker Buildx
26+
uses: docker/setup-buildx-action@v3
27+
2128
- uses: technote-space/[email protected]
2229
id: git_diff
2330
with:
2431
PATTERNS: |
2532
**/*.go
2633
go.mod
2734
go.sum
35+
36+
- name: Login to GHCR
37+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin
38+
39+
- name: Pull slinky-base image
40+
run: docker pull ghcr.io/dydxprotocol/slinky-base:latest
41+
42+
- name: Clear Go module cache dir
43+
run: sudo rm -rf ~/go/pkg/mod
44+
45+
- uses: actions/cache@v4
46+
with:
47+
path: |
48+
~/.cache/go-build
49+
~/go/pkg/mod
50+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
51+
restore-keys: |
52+
${{ runner.os }}-go-
53+
2854
- name: tests
2955
if: env.GIT_DIFF
3056
run: |

.github/workflows/lint.yml

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,47 +13,57 @@ permissions:
1313

1414
jobs:
1515
golangci:
16-
name: golangci-lint
16+
name: Lint Go
1717
runs-on: ubuntu-latest
1818
steps:
19-
- uses: actions/setup-go@v5
19+
- name: Check out code
20+
uses: actions/checkout@v5
21+
22+
- name: Setup Go
23+
uses: actions/setup-go@v6
2024
with:
21-
go-version: 1.23.3
22-
- uses: actions/checkout@v4
23-
- name: golangci-lint
25+
go-version-file: .go-version
26+
check-latest: false
27+
28+
- name: Lint code
2429
uses: golangci/golangci-lint-action@v6
2530
with:
26-
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
2731
version: latest
2832
only-new-issues: true
33+
2934
lint-markdown:
30-
name: Lint markdown
35+
name: Lint Markdown
3136
runs-on: ubuntu-latest
3237
steps:
3338
- name: Check out code
34-
uses: actions/checkout@v4
39+
uses: actions/checkout@v5
3540

3641
- name: Lint markdown
3742
uses: avto-dev/markdown-lint@v1
3843
with:
3944
args: "**/*.md"
45+
4046
govulncheck:
47+
name: Vulnerability Scan
4148
runs-on: ubuntu-latest
4249
steps:
43-
- uses: actions/checkout@v4
44-
- uses: actions/setup-go@v5
50+
- name: Check out code
51+
uses: actions/checkout@v5
52+
53+
- name: Setup Go
54+
uses: actions/setup-go@v6
4555
with:
46-
go-version: 1.23.3
47-
cache: true
48-
cache-dependency-path: go.sum
49-
- uses: technote-space/[email protected]
50-
id: git_diff
56+
go-version-file: .go-version
57+
check-latest: false
58+
59+
- name: Run govulncheck
60+
id: govulncheck
61+
uses: golang/govulncheck-action@v1
62+
with:
63+
go-version-file: .go-version
64+
go-package: ./...
65+
66+
- name: Run gosec
67+
uses: securego/gosec@master
5168
with:
52-
PATTERNS: |
53-
**/*.go
54-
go.mod
55-
go.sum
56-
- name: govulncheck
57-
if: env.GIT_DIFF
58-
run: |
59-
make govulncheck
69+
args: ./...

.github/workflows/release.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,18 @@ jobs:
1616
contents: write # for goreleaser/goreleaser-action to create a GitHub release
1717
runs-on: ubuntu-latest
1818
steps:
19-
- uses: actions/checkout@v4
20-
- name: Install Go
21-
uses: actions/setup-go@v5
19+
- name: Checkout code
20+
uses: actions/checkout@v5
21+
22+
- name: Setup Go
23+
uses: actions/setup-go@v6
2224
with:
23-
go-version: 1.23.3
25+
go-version-file: .go-version
26+
check-latest: false
27+
2428
- name: Unshallow
2529
run: git fetch --prune --unshallow
30+
2631
- name: Create release
2732
uses: goreleaser/goreleaser-action@v6
2833
with:

0 commit comments

Comments
 (0)