Skip to content

Commit

Permalink
Merge branch 'main' into joshy-independant-difficulty-adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshOrndorff committed Jan 7, 2024
2 parents d2b3782 + b743f8a commit 981642d
Show file tree
Hide file tree
Showing 45 changed files with 7,866 additions and 301 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,16 @@ indent_style=space
indent_size=2
tab_width=8
end_of_line=lf

[*.js]
indent_style=space
indent_size=4


[*.jsx]
indent_style=space
indent_size=4

[Dockerfile]
indent_style=space
indent_size=2
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build/Lint CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x, 20.x]

steps:
- uses: actions/checkout@v4.1.1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm install
working-directory: fork-visualizer
- run: npm run build
working-directory: fork-visualizer
- run: npm run lint
working-directory: fork-visualizer

all:
# This dummy job depends on all the mandatory checks. It succeeds if and only if all CI checks
# are successful.
needs: [build]
runs-on: ubuntu-latest
steps:
- run: echo Success
2 changes: 1 addition & 1 deletion .github/workflows/contracts-unit-test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
export WASM_BUILD_WORKSPACE_HINT=${PWD}
export CARGO_TARGET_DIR=/tmp/$RUST_CONTRACTS_TOOLCHAIN/target/
cargo +${RUST_CONTRACTS_TOOLCHAIN} install cargo-dylint dylint-link
cargo +${RUST_CONTRACTS_TOOLCHAIN} install --locked cargo-dylint dylint-link
cargo +${RUST_CONTRACTS_TOOLCHAIN} install --version $CARGO_CONTRACT_VERSION \
--force --locked cargo-contract
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-tests-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
shell: bash
run: |
alias curl='docker run -it --rm curlimages/curl:8.1.2'
curl --retry 12 --retry-all-errors --retry-delay 3 -H "Content-Type: application/json" -d '{ "id": 1, "jsonrpc": "2.0", "method": "rpc_methods"}' http://127.0.0.1:9933
curl --retry 12 --retry-all-errors --retry-delay 3 -H "Content-Type: application/json" -d '{ "id": 1, "jsonrpc": "2.0", "method": "rpc_methods"}' http://127.0.0.1:9944
- name: Verify contract interaction
shell: bash
Expand Down
72 changes: 72 additions & 0 deletions .github/workflows/publish-docker-fork-visualizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Workflow inspired by publish-docker.yml action

name: Create and publish fork-visualizer Docker image

on:
push:
branches: [ "*" ]
tags:
- '**'

env:
REGISTRY: ghcr.io
IMAGE_NAME: polkadot-blockchain-academy/fork-visualizer
DEV_IMAGE_NAME: polkadot-blockchain-academy/fork-visualizer-dev

jobs:
build-and-push-node-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=sha
type=raw,value=latest
if: github.ref == 'refs/heads/main'

- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: ./fork-visualizer
file: ./fork-visualizer/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
if: github.ref == 'refs/heads/main'

- name: Extract metadata (tags, labels) for Docker dev
id: metaDev
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.DEV_IMAGE_NAME }}
tags: |
type=sha
type=raw,value=latest
if: github.ref != 'refs/heads/main'

- name: Build and push Docker dev image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: ./fork-visualizer
file: ./fork-visualizer/Dockerfile
push: true
tags: ${{ steps.metaDev.outputs.tags }}
labels: ${{ steps.metaDev.outputs.labels }}
if: github.ref != 'refs/heads/main'
2 changes: 0 additions & 2 deletions .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ on:
push:
branches:
- main
# TODO this is just for testing
- joshy-publish-docker-image
tags:
- '**'

Expand Down
13 changes: 3 additions & 10 deletions .github/workflows/unit-tests-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ concurrency:
env:
CARGO_TERM_COLOR: always

# TODO: refactor common steps into a workflow
jobs:

basic-checks:
Expand All @@ -40,14 +39,11 @@ jobs:
/tmp/academy-pow/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-v1

- name: Install Rust toolchain
uses: Cardinal-Cryptography/github-actions/install-rust-toolchain@v1

- name: Run fmt
run: make fmt
run: cargo fmt --all

- name: Run clippy
run: make clippy
run: cargo clippy --all-targets -- --no-deps -D warnings

unit-tests:
runs-on: ubuntu-latest
Expand All @@ -72,8 +68,5 @@ jobs:
/tmp/academy-pow/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-v1

- name: Install Rust toolchain
uses: Cardinal-Cryptography/github-actions/install-rust-toolchain@v1

- name: Run tests
run: make test
run: cargo test
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
**/*.rs.bk
**/target/
addresses.json
addresses.json
fork-visualizer/.env
!fork-visualizer/.env.example
Loading

0 comments on commit 981642d

Please sign in to comment.