Skip to content
This repository has been archived by the owner on May 2, 2024. It is now read-only.

Commit

Permalink
update workflow to sync versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
dpaiton committed Apr 28, 2024
1 parent 14fb186 commit 019ace0
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 19 deletions.
54 changes: 45 additions & 9 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ jobs:
name: build on linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout hyperdrive-bindings
uses: actions/checkout@v4
with:
token: ${{github.token}}

Expand All @@ -46,19 +47,33 @@ jobs:
- name: set up pip
run: python -m pip install --upgrade pip

- name: check out hyperdrive-rs
- name: Fetch latest release tag from hyperdrive
run: ./scripts/fetch-latest-tag.sh hyperdrive
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Fetch latest release tag from hyperdrive-rs
run: ./scripts/fetch-latest-tag.sh hyperdrive-rs ${{ env.latest_tag_hyperdrive }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Check out hyperdrive-rs
uses: actions/checkout@v4
with:
repository: delvtech/hyperdrive-rs
ref: "v1.0.1"
ref: ${{ env.latest_tag_hyperdrive-rs }}
path: "./hyperdrive-rs"

- name: check out hyperdrive
uses: actions/checkout@master
uses: actions/checkout@v4
with:
repository: delvtech/hyperdrive
ref: "v1.0.3"
ref: ${{ env.latest_tag_hyperdrive }}
path: "./hyperdrive-rs/hyperdrive"
ssh-key: ${{ secrets.HYPERDRIVE_ACCESS_KEY }}

- name: build hyperdrive
run: cd hyperdrive-rs/hyperdrive && make build-sol

- name: build hyperdrivepy
shell: bash
Expand All @@ -83,19 +98,40 @@ jobs:
python-version: [cp310]

steps:
- uses: actions/checkout@v3
- name: Checkout hyperdrive-bindings
uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.GITHUB_TOKEN }}

- name: Fetch latest release tag from hyperdrive
run: ./scripts/fetch-latest-tag.sh hyperdrive
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Fetch latest release tag from hyperdrive-rs
run: ./scripts/fetch-latest-tag.sh hyperdrive-rs ${{ env.latest_tag_hyperdrive }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Check out hyperdrive-rs
uses: actions/checkout@v4
with:
repository: delvtech/hyperdrive-rs
ref: ${{ env.latest_tag_hyperdrive-rs }}
path: "./hyperdrive-rs"

- name: check out hyperdrive
uses: actions/checkout@master
uses: actions/checkout@v4
with:
repository: delvtech/hyperdrive
ref: "v1.0.3"
path: "./hyperdrive"
ref: ${{ env.latest_tag_hyperdrive }}
path: "./hyperdrive-rs/hyperdrive"
ssh-key: ${{ secrets.HYPERDRIVE_ACCESS_KEY }}

- name: build hyperdrive
run: cd hyperdrive-rs/hyperdrive && make build-sol

- name: set up python
uses: actions/setup-python@v4
with:
Expand Down
21 changes: 16 additions & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,40 @@ jobs:
name: python lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout hyperdrive-bindings
uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.GITHUB_TOKEN }}

# NOTE: This is needed to ensure that hyperdrive-wrappers builds correctly.
- name: install foundry
- name: Install foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: check out hyperdrive-rs
- name: Fetch latest release tag from hyperdrive
run: ./scripts/fetch-latest-tag.sh hyperdrive
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Fetch latest release tag from hyperdrive-rs
run: ./scripts/fetch-latest-tag.sh hyperdrive-rs ${{ env.latest_tag_hyperdrive }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Check out hyperdrive-rs
uses: actions/checkout@v4
with:
repository: delvtech/hyperdrive-rs
ref: "v1.0.3"
ref: ${{ env.latest_tag_hyperdrive-rs }}
path: "./hyperdrive-rs"

- name: check out hyperdrive
uses: actions/checkout@v4
with:
repository: delvtech/hyperdrive
ref: "v1.0.3"
ref: ${{ env.latest_tag_hyperdrive }}
path: "./hyperdrive-rs/hyperdrive"
ssh-key: ${{ secrets.HYPERDRIVE_ACCESS_KEY }}

Expand Down
21 changes: 16 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,30 @@ jobs:
with:
version: nightly

- name: check out hyperdrive-rs
uses: actions/checkout@v3
- name: Fetch latest release tag from hyperdrive
run: ./scripts/fetch-latest-tag.sh hyperdrive
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Fetch latest release tag from hyperdrive-rs
run: ./scripts/fetch-latest-tag.sh hyperdrive-rs ${{ env.latest_tag_hyperdrive }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Check out hyperdrive-rs
uses: actions/checkout@v4
with:
repository: delvtech/hyperdrive-rs
ref: "v1.0.3"
ref: ${{ env.latest_tag_hyperdrive-rs }}
path: "./hyperdrive-rs"

- name: check out hyperdrive
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: delvtech/hyperdrive
ref: "v1.0.3"
ref: ${{ env.latest_tag_hyperdrive }}
path: "./hyperdrive-rs/hyperdrive"
ssh-key: ${{ secrets.HYPERDRIVE_ACCESS_KEY }}

- name: build hyperdrive
run: cd hyperdrive-rs/hyperdrive && make build-sol
Expand Down
29 changes: 29 additions & 0 deletions scripts/fetch-latest-tag.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

# Repository name (required)
REPO=$1

# Version prefix from repo A (optional)
VERSION_PREFIX=${2:-} # Defaults to an empty string if not provided

# GitHub Token provided by GitHub Actions
TOKEN=${GITHUB_TOKEN}

# Fetch all tags from the repository. If VERSION_PREFIX is empty, all tags are fetched.
# Fetch all tags from the GitHub API and filter for the latest tag containing the prefix
if [[ -z "$VERSION_PREFIX" ]]; then
# If no prefix is provided, fetch the latest release
TAG=$(curl -sH "Authorization: token $TOKEN" "https://api.github.com/repos/$REPO/releases/latest" | jq -r '.tag_name')
else
# Fetch all tags, filter by prefix, and get the most recent one
TAG=$(curl -sH "Authorization: token $TOKEN" "https://api.github.com/repos/$REPO/tags" \
| jq -r --arg PREFIX "$VERSION_PREFIX" '[.[0] | select(.name | startswith($PREFIX))] | sort_by(.name) | .[-1].name')
fi
echo "$TAG"

# Sanitize repository name to create a valid environment variable name
# Replace '/' with '_' and convert to lower case
ENV_REPO_NAME=$(echo "$REPO" | tr '/' '_' | tr '[:upper:]' '[:lower:]')

# Output the tag for subsequent steps
echo "latest_tag_${ENV_REPO_NAME}=$TAG" >> $GITHUB_ENV

0 comments on commit 019ace0

Please sign in to comment.