-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: integration with GitHub Actions
- Loading branch information
Showing
7 changed files
with
287 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
name: "Release" | ||
|
||
permissions: | ||
contents: "write" | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["Tag"] | ||
types: | ||
- "completed" | ||
|
||
jobs: | ||
get-tag: | ||
name: "Get Tag From Package Version" | ||
runs-on: "ubuntu-latest" | ||
outputs: | ||
pkg-version: ${{ steps.pkg-version.outputs.PKG_VERSION }} | ||
steps: | ||
- name: "Check out the repo" | ||
uses: actions/checkout@v3 | ||
with: | ||
token: ${{ github.token }} | ||
|
||
- name: "Get tag" | ||
id: "pkg-version" | ||
shell: "bash" | ||
run: | | ||
echo PKG_VERSION=$(awk -F ' = ' '$1 ~ /version/ { gsub(/["]/, "", $2); printf("%s",$2) }' offchain-resolver-gateway/Cargo.toml) >> $GITHUB_OUTPUT | ||
create-release: | ||
name: "Create release" | ||
if: ${{ github.event.workflow_run.conclusion == 'success' }} | ||
needs: "get-tag" | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: "Check out the repo" | ||
uses: actions/checkout@v3 | ||
|
||
- name: "Create release" | ||
uses: "taiki-e/create-gh-release-action@v1" | ||
with: | ||
# (optional) Path to changelog. | ||
# changelog: CHANGELOG.md | ||
branch: "main" | ||
ref: refs/tags/v${{ needs.get-tag.outputs.pkg-version }} | ||
token: ${{ github.token }} | ||
|
||
upload-assets: | ||
name: "Upload assets to Github releases" | ||
if: ${{ github.event.workflow_run.conclusion == 'success' }} | ||
needs: | ||
- "get-tag" | ||
- "create-release" | ||
strategy: | ||
matrix: | ||
include: | ||
- target: "x86_64-unknown-linux-gnu" | ||
os: "ubuntu-latest" | ||
- target: "x86_64-unknown-linux-musl" | ||
os: "ubuntu-latest" | ||
- target: x86_64-apple-darwin | ||
os: macOS-11 | ||
macosx_deployment_target: 10.13 | ||
developer_dir: /Applications/Xcode_11.7.app | ||
sdkroot: /Applications/Xcode_11.7.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk | ||
- target: aarch64-apple-darwin | ||
os: macOS-11 | ||
macosx_deployment_target: 11.0 | ||
developer_dir: /Applications/Xcode_13.2.1.app | ||
sdkroot: /Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk | ||
# Windows build not working due to OpenSSL :( | ||
# error: failed to run custom build command for `openssl-sys v0.9.88` | ||
#- target: x86_64-pc-windows-msvc | ||
# os: windows-2019 | ||
# rustflags: -Ctarget-feature=+crt-static | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: "Check out the repo" | ||
uses: actions/checkout@v3 | ||
|
||
- name: "Upload Binaries" | ||
uses: "taiki-e/upload-rust-binary-action@v1" | ||
with: | ||
bin: "offchain-resolver-gateway" | ||
target: ${{ matrix.target }} | ||
archive: $bin-${{ matrix.target }} | ||
ref: refs/tags/v${{ needs.get-tag.outputs.pkg-version }} | ||
token: ${{ github.token }} | ||
|
||
push-to-registry: | ||
name: "Push Docker image to Docker Hub" | ||
if: ${{ github.event.workflow_run.conclusion == 'success' }} | ||
needs: | ||
- "get-tag" | ||
- "upload-assets" | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: "Check out the repo" | ||
uses: actions/checkout@v3 | ||
|
||
- name: "Log in to Docker Hub" | ||
uses: "docker/login-action@v2" | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: "Extract metadata (tags, labels) for Docker" | ||
id: "meta" | ||
uses: "docker/metadata-action@v4" | ||
with: | ||
images: "jeje/ens-offchain-resolver-gateway-rs" | ||
|
||
- name: "Build and push Docker image" | ||
uses: "docker/build-push-action@v3" | ||
with: | ||
context: offchain-resolver-gateway | ||
push: true | ||
tags: jeje/ens-offchain-resolver-gateway-rs:latest,jeje/ens-offchain-resolver-gateway-rs:v${{ needs.get-tag.outputs.pkg-version }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: "Tag" | ||
|
||
on: | ||
push: | ||
branches: | ||
- "main" | ||
|
||
jobs: | ||
create-tag: | ||
name: "Create tag" | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: "Check out the repo" | ||
uses: actions/checkout@v3 | ||
with: | ||
token: ${{ github.token }} | ||
|
||
- name: "Get tag" | ||
id: "get-tag" | ||
shell: "bash" | ||
run: | | ||
echo PKG_VERSION=$(awk -F ' = ' '$1 ~ /version/ { gsub(/["]/, "", $2); printf("%s",$2) }' offchain-resolver-gateway/Cargo.toml) >> $GITHUB_OUTPUT | ||
- name: "Set Tag" | ||
shell: "bash" | ||
run: | | ||
git tag v${{ steps.get-tag.outputs.PKG_VERSION }} && git push --tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
name: "Test" | ||
on: [push, pull_request] | ||
|
||
#on: | ||
# pull_request: | ||
|
||
jobs: | ||
check: | ||
name: "Cargo check" | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: "Check out the repo" | ||
uses: actions/checkout@v3 | ||
|
||
- uses: "actions-rs/toolchain@v1" | ||
with: | ||
profile: "minimal" | ||
toolchain: "stable" | ||
override: true | ||
|
||
- uses: "actions-rs/cargo@v1" | ||
with: | ||
command: "check" | ||
|
||
test: | ||
name: "Cargo test" | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: "Check out the repo" | ||
uses: actions/checkout@v3 | ||
|
||
- uses: "actions-rs/toolchain@v1" | ||
with: | ||
profile: "minimal" | ||
toolchain: "stable" | ||
override: true | ||
|
||
- uses: "actions-rs/cargo@v1" | ||
with: | ||
command: "test" | ||
|
||
fmt: | ||
name: "Cargo format" | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: "Check out the repo" | ||
uses: actions/checkout@v3 | ||
|
||
- uses: "actions-rs/toolchain@v1" | ||
with: | ||
profile: "minimal" | ||
toolchain: "stable" | ||
override: true | ||
|
||
- run: "rustup component add rustfmt" | ||
|
||
- uses: "actions-rs/cargo@v1" | ||
with: | ||
command: "fmt" | ||
args: "--all -- --check" | ||
|
||
clippy: | ||
name: "Cargo clippy" | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: "Check out the repo" | ||
uses: actions/checkout@v3 | ||
|
||
- uses: "actions-rs/toolchain@v1" | ||
with: | ||
profile: "minimal" | ||
toolchain: "stable" | ||
override: true | ||
|
||
- run: "rustup component add clippy" | ||
|
||
- uses: "actions-rs/cargo@v1" | ||
with: | ||
command: "clippy" | ||
args: "-- -D warnings" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# ENS Offchain Resolver Gateway | ||
|
||
This repository contains multiple things: | ||
* ENS gateway implementation offering something similar to [](), | ||
in [offchain-resolver-gateway](./offchain-resolver-gateway) directory | ||
* [ERC-3668: CCIP Read](https://eips.ethereum.org/EIPS/eip-3668#gateway-interface) | ||
**library** in order to develop some servers, like the provided ENS gateway, in | ||
[ccip-read-server](./ccip-read-server) directory + | ||
TODO: deliver this library as a crate on `crates.io` | ||
|
||
The ENS gateway implementation is avaible as [releases](https://github.com/jeje/ens-offchain-resolver-gateway-rs/releases). | ||
|
||
## Usage | ||
|
||
``` | ||
ENS Offchain Gateway server answering requests from CCIP-READ protocol (aka ERC-3668) | ||
Usage: offchain-resolver-gateway [OPTIONS] --privatekey <VALUE> <--json <FILE>> | ||
Options: | ||
-k, --privatekey <VALUE> private key of the wallet allowed to sign offchain ENS record results [env: PRIVATE_KEY] | ||
-t, --ttl <VALUE> TTL for signatures [env: TTL=] [default: 300] | ||
-i, --ip <VALUE> server IP to bind to [env: LISTEN_IP=] [default: 127.0.0.1] | ||
-p, --port <VALUE> server port to bind to [env: LISTEN_PORT=] [default: 8080] | ||
--json <FILE> Json file to use as a database | ||
-h, --help Print help | ||
-V, --version Print version | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM alpine:3.16.2 as builder | ||
|
||
WORKDIR /opt/ | ||
|
||
RUN apk add curl protoc musl-dev gzip git | ||
|
||
# offchain-resolver-gateway | ||
RUN curl -sLO https://github.com/jeje/ens-offchain-resolver-gateway-rs/releases/latest/download/offchain-resolver-gateway-x86_64-unknown-linux-musl.tar.gz \ | ||
&& tar -xvf offchain-resolver-gateway-x86_64-unknown-linux-musl.tar.gz \ | ||
&& chmod +x offchain-resolver-gateway | ||
|
||
######################################################### | ||
|
||
FROM alpine:3.16.2 | ||
|
||
RUN apk add tmux | ||
|
||
COPY --from=builder /opt/offchain-resolver-gateway /opt/offchain-resolver-gateway | ||
|
||
RUN chown -R root:root /opt/ |