Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

Commit

Permalink
Dockerhub latest tag & absolute warplib path (#1076)
Browse files Browse the repository at this point in the history
* Dockerhub latest tag & absolute warplib path

* Add missing newline to config.ts

* Fix linting errors

* Fix - use relative path to determine import path

* Linting fix

---------

Co-authored-by: Piotr Piwoński <piwonskp>
  • Loading branch information
piwonskp authored May 26, 2023
1 parent 49fc852 commit c872aa4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ jobs:
uses: docker/build-push-action@v4
with:
push: true
tags: nethermind/warp:${{ github.event.release.tag_name }}
tags: nethermind/warp:latest,nethermind/warp:${{ github.event.release.tag_name }}
3 changes: 3 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import path from 'path';

export const WARP_ROOT = path.resolve(path.dirname(__dirname));
10 changes: 7 additions & 3 deletions src/warplib/gatherWarplibImports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,20 @@ import fs from 'fs';
import { Implicits } from '../utils/implicits';
import { parseMultipleRawCairoFunctions } from '../utils/cairoParsing';
import { glob } from 'glob';
import path from 'path';

import { WARP_ROOT } from '../config';

export const warplibImportInfo = glob
.sync('warplib/**/*.cairo')
.sync(path.join(WARP_ROOT, 'warplib/**/*.cairo'))
.reduce((warplibMap, pathToFile) => {
const rawCairoCode = fs.readFileSync(pathToFile, { encoding: 'utf8' });

const importPath = pathToFile
const importPath = path
.relative(WARP_ROOT, pathToFile)
.split('/')
.join('.')
.slice(0, pathToFile.length - '.cairo'.length);
.slice(0, -'.cairo'.length);

const fileMap: Map<string, Implicits[]> =
warplibMap.get(importPath) ?? new Map<string, Implicits[]>();
Expand Down

0 comments on commit c872aa4

Please sign in to comment.