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

Add support for macOS/arm64 + refactor the code #69

Merged
merged 5 commits into from
Jun 19, 2024
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
17 changes: 17 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://raw.githubusercontent.com/devcontainers/spec/main/schemas/devContainer.base.schema.json",
"name": "default",
"image": "node:20-bookworm",
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers/features/sshd:1": {}
},
"customizations": {
"vscode": {
"extensions": [
"streetsidesoftware.code-spell-checker"
]
}
},
"postCreateCommand": "npm install"
}
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,10 @@ insert_final_newline = true
indent_style = space
indent_size = 2
trim_trailing_whitespace = true

[{*.yml,*.yaml}]
ij_any_spaces_within_braces = false
ij_any_spaces_within_brackets = false

[Makefile]
indent_style = tab
18 changes: 0 additions & 18 deletions .eslintrc.json

This file was deleted.

3 changes: 2 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Docs: <https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/customizing-dependency-updates>
# yaml-language-server: $schema=https://json.schemastore.org/dependabot-2.0.json
# docs: https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/customizing-dependency-updates

version: 2

Expand Down
13 changes: 13 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-release-config.json
# docs: https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes

changelog:
categories:
- title: 🛠 Fixes
labels: [type:fix, type:bug]
- title: 🚀 Features
labels: [type:feature, type:feature_request]
- title: 📦 Dependency updates
labels: [dependencies]
- title: Other Changes
labels: ['*']
9 changes: 6 additions & 3 deletions .github/workflows/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
name: dependabot
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
# docs: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions

name: 🤖 Dependabot

on:
pull_request: {}
Expand All @@ -9,15 +12,15 @@ permissions:

jobs:
dependabot: # https://tinyurl.com/e69djmen
name: Enable auto-merge for Dependabot PRs
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- uses: dependabot/fetch-metadata@v2
id: metadata
with: {github-token: "${{ secrets.GITHUB_TOKEN }}"}

- name: Enable auto-merge for Dependabot PRs
if: ${{ contains(fromJSON('["version-update:semver-minor", "version-update:semver-patch"]'), steps.metadata.outputs.update-type) }}
- if: ${{ contains(fromJSON('["version-update:semver-minor", "version-update:semver-patch"]'), steps.metadata.outputs.update-type) }}
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
name: release
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
# docs: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions

name: 🚀 Release

on:
release: # Docs: <https://help.github.com/en/articles/events-that-trigger-workflows#release-event-release>
Expand All @@ -10,12 +13,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: gacts/github-slug@v1
id: slug

- name: Setup git
env: {REPO_PATH: "${{ github.repository_owner }}/${{ github.event.repository.name }}"}
- {uses: gacts/github-slug@v1, id: slug}
- env: {REPO_PATH: "${{ github.repository_owner }}/${{ github.event.repository.name }}"}
run: |
git config --local user.email 'actions@github.com'
git config --local user.name "${{ github.actor }}"
Expand Down
70 changes: 19 additions & 51 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
name: tests
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
# docs: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions

name: 🧪 Tests

on:
push:
Expand All @@ -12,66 +15,37 @@ concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

env: {FORCE_COLOR: 'true'}

jobs:
gitleaks:
name: Gitleaks
name: Check for GitLeaks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with: {fetch-depth: 0}

- name: Check for GitLeaks
uses: gacts/gitleaks@v1 # Action page: <https://github.com/gacts/gitleaks>
- {uses: actions/checkout@v4, with: {fetch-depth: 0}}
- uses: gacts/gitleaks@v1

eslint:
name: Run eslint
name: Run code linter
runs-on: ubuntu-latest
env: {FORCE_COLOR: 'true'}
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with: {node-version: '20'}

- uses: actions/cache@v4
id: yarn-cache
with:
path: '**/node_modules'
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-

- if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile --no-progress --non-interactive

- run: yarn lint
- {uses: gacts/setup-node-with-cache@v1, with: {node-version: 20}}
- run: npm install
- run: npm run lint

dist-built:
name: Check distributive built state
runs-on: ubuntu-latest
outputs:
dist-changed: ${{ steps.state.outputs.changed }}
env: {FORCE_COLOR: 'true'}
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with: {node-version: '20'}

- uses: actions/cache@v4
id: yarn-cache
with:
path: '**/node_modules'
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-

- if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile --no-progress --non-interactive

- run: yarn build

- {uses: gacts/setup-node-with-cache@v1, with: {node-version: 20}}
- run: npm install
- run: npm run build
- uses: actions/upload-artifact@v4
with: {name: dist, path: ./dist/, retention-days: 1}

- id: state
run: echo "changed=`git diff --diff-filter=ACMUXTR --name-only | grep dist/ > /dev/null && echo 'true' || echo 'false'`" >> $GITHUB_OUTPUT

Expand All @@ -85,13 +59,10 @@ jobs:
pull-requests: write
steps:
- uses: actions/checkout@v4

- uses: actions/download-artifact@v4
with: {name: dist, path: ./dist/}

- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Automatic distributive rebuild
with: {commit_message: Automatic distributive rebuild}

run-this-action: # non-existing files will not generate an error
name: Run action (${{ matrix.runs-on }}, version ${{ matrix.version }})
Expand All @@ -100,15 +71,12 @@ jobs:
fail-fast: false
matrix:
runs-on: [ubuntu-latest, macos-latest, windows-latest]
version: [1.10.15, latest]
version: [1.13.5, 1.14.5, latest]
steps:
- uses: actions/checkout@v4

- name: Run this action
uses: ./
with:
version: ${{ matrix.version }}

with: {version: '${{ matrix.version }}'}
- run: geth version
- run: abigen --version
- run: bootnode -h
Expand Down
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@
# Environment files
*.env

# npm lock file (use yarn only)
package-lock.json
# yarn lock file (use npm only)
yarn.lock

# Logs
logs
*.log
yarn-debug.log*
yarn-error.log*

# Temp dirs & trash
/temp
Expand Down
42 changes: 0 additions & 42 deletions CHANGELOG.md

This file was deleted.

35 changes: 19 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
#!/usr/bin/make
# Makefile readme (ru): <https://blog.hook.sh/nix/makefile-full-doc/>
# Makefile readme (en): <https://www.gnu.org/software/make/manual/html_node/index.html#SEC_Contents>
# Makefile readme: <https://www.gnu.org/software/make/manual/html_node/index.html#SEC_Contents>

SHELL = /bin/bash
DC_RUN_ARGS = --rm --user "$(shell id -u):$(shell id -g)"
.DEFAULT_GOAL := build
.MAIN := build

.PHONY : help install shell lint test build
.DEFAULT_GOAL : help

help: ## Show this help
@printf "\033[33m%s:\033[0m\n" 'Available commands'
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " \033[32m%-18s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
NODE_IMAGE = node:20-alpine
RUN_ARGS = --rm -v "$(shell pwd):/src:rw" \
-t --workdir "/src" \
-u "$(shell id -u):$(shell id -g)" \
-e "NPM_CONFIG_UPDATE_NOTIFIER=false" \
-e PATH="$$PATH:/src/node_modules/.bin" $(NODE_IMAGE)

.PHONY: install
install: ## Install all dependencies
docker-compose run $(DC_RUN_ARGS) node yarn install --no-progress --non-interactive
docker run $(RUN_ARGS) npm install

.PHONY: shell
shell: ## Start shell into a container with node
docker-compose run $(DC_RUN_ARGS) node sh
docker run -e "PS1=\[\033[1;34m\]\w\[\033[0;35m\] \[\033[1;36m\]# \[\033[0m\]" -i $(RUN_ARGS) sh

lint: ## Execute provided linters
docker-compose run $(DC_RUN_ARGS) node yarn lint
.PHONY: lint
lint: ## Run lint
docker run $(RUN_ARGS) npm run lint

build: ## Build frontend
docker-compose run $(DC_RUN_ARGS) node yarn build
.PHONY: build
build: install ## Build the extension and pack it into a zip file
docker run $(RUN_ARGS) npm run build
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Following inputs can be used as `step.with` keys:
New versions releasing scenario:

- Make required changes in the [changelog](CHANGELOG.md) file
- Build the action distribution (`make build` or `yarn build`)
- Build the action distribution (`make build` or `npm run build`)
- Commit and push changes (including `dist` directory changes - this is important) into the `master` branch
- Publish new release using repo releases page (git tag should follow `vX.Y.Z` format)

Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-action.json
# docs: https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions

name: Install Geth (Go Ethereum) and tools
description: Installs Geth (Go Ethereum) and tools (abigen, bootnode, clef, evm, rlpdump) into your actions workflow

Expand Down
9 changes: 4 additions & 5 deletions dist/index.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion dist/index.js.map

This file was deleted.

1 change: 0 additions & 1 deletion dist/sourcemap-register.js

This file was deleted.

18 changes: 0 additions & 18 deletions docker-compose.yml

This file was deleted.

Loading