Skip to content

Commit

Permalink
Refactorings.
Browse files Browse the repository at this point in the history
  • Loading branch information
gdotdesign committed May 8, 2024
1 parent 653449c commit d38639f
Show file tree
Hide file tree
Showing 848 changed files with 22,042 additions and 6,737 deletions.
6 changes: 6 additions & 0 deletions .ameba.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@ Metrics/CyclomaticComplexity:

Lint/NotNil:
Enabled: false

Documentation/DocumentationAdmonition:
Enabled: false

Lint/UselessAssign:
ExcludeTypeDeclarations: true
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest, macos-13, macos-latest]
runs-on: ${{ matrix.os }}

steps:
Expand All @@ -31,11 +31,11 @@ jobs:
mkdir build
docker-compose run --rm app crystal build src/mint.cr -o build/mint-${GITHUB_REF_SLUG}-linux --static --no-debug --release
- if: matrix.os == 'macos-latest'
- if: startsWith(matrix.os, 'macos')
name: Build binary (macOS)
run: |
mkdir build
crystal build src/mint.cr -o build/mint-${GITHUB_REF_SLUG}-osx --release
crystal build src/mint.cr -o build/mint-${GITHUB_REF_SLUG}-${{ matrix.os }} --release
- name: Upload artifacts
uses: actions/upload-artifact@v3
Expand All @@ -50,15 +50,15 @@ jobs:
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_bucket: ${{ secrets.AWS_BUCKET }}
aws_key_id: ${{ secrets.AWS_KEY }}
source_dir: build
destination_dir: ""
source_dir: build

- if: startsWith(github.ref, 'refs/tags/')
name: Upload to GitHub Releases
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
file: build/*
overwrite: true
file_glob: true
file: build/*
16 changes: 8 additions & 8 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ jobs:
- name: Log into ${{ env.REGISTRY }} registry
uses: docker/login-action@v3
with:
password: ${{ secrets.GITHUB_TOKEN }}
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
Expand All @@ -52,12 +52,12 @@ jobs:
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=tag
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{version}}
type=ref,event=branch
type=ref,event=pr
type=sha,format=long
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=ref,event=tag
type=ref,event=pr
# Build and push Docker image with Buildx
# https://github.com/docker/build-push-action
Expand All @@ -67,10 +67,10 @@ jobs:
with:
context: .
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
cache-from: type=gha
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
platforms: |
linux/amd64
linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
57 changes: 57 additions & 0 deletions .github/workflows/ci-base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: CI

on:
workflow_call:
inputs:
crystal-version:
required: true
type: string

jobs:
test:
name: Test
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-13]
runs-on: ${{ matrix.os }}

steps:
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
with:
crystal: ${{ inputs.crystal-version }}

- name: Download source
uses: actions/checkout@v4

- name: Install dependencies
run: shards install

- name: Run specs
run: crystal spec --error-on-warnings --error-trace

- name: Build the binary
run: shards build --error-on-warnings --error-trace

- name: Run core specs (Firefox)
working-directory: ./core/tests
run: ../../bin/mint test -b firefox

- name: Run core specs (Google Chrome)
working-directory: ./core/tests
run: ../../bin/mint test -b chrome

- name: Check formatting (Mint)
working-directory: ./core
run: ../bin/mint format --check

- name: Check formatting (Mint tests)
working-directory: ./core/tests
run: ../../bin/mint format --check

- name: Check formatting (Crystal)
run: crystal tool format --check

- name: Run ameba
run: bin/ameba
49 changes: 3 additions & 46 deletions .github/workflows/ci-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,49 +7,6 @@ on:

jobs:
test:
name: Test
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}

steps:
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
with:
crystal: nightly

- name: Download source
uses: actions/checkout@v4

- name: Install dependencies
run: shards install

- name: Run specs
run: crystal spec --error-on-warnings --error-trace

- name: Build the binary
run: shards build --error-on-warnings --error-trace

- name: Run core specs (Firefox)
working-directory: ./core/tests
run: ../../bin/mint test -b firefox

- name: Run core specs (Google Chrome)
working-directory: ./core/tests
run: ../../bin/mint test -b chrome

- name: Check formatting (Mint)
working-directory: ./core
run: ../bin/mint format --check

- name: Check formatting (Mint tests)
working-directory: ./core/tests
run: ../../bin/mint format --check

- name: Check formatting (Crystal)
run: crystal tool format --check

- name: Run ameba
run: bin/ameba
uses: ./.github/workflows/ci-base.yml
with:
crystal-version: nightly
49 changes: 3 additions & 46 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,49 +11,6 @@ on:

jobs:
test:
name: Test
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}

steps:
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
with:
crystal: latest

- name: Download source
uses: actions/checkout@v4

- name: Install dependencies
run: shards install

- name: Run specs
run: crystal spec --error-on-warnings --error-trace

- name: Build the binary
run: shards build --error-on-warnings --error-trace

- name: Run core specs (Firefox)
working-directory: ./core/tests
run: ../../bin/mint test -b firefox

- name: Run core specs (Google Chrome)
working-directory: ./core/tests
run: ../../bin/mint test -b chrome

- name: Check formatting (Mint)
working-directory: ./core
run: ../bin/mint format --check

- name: Check formatting (Mint tests)
working-directory: ./core/tests
run: ../../bin/mint format --check

- name: Check formatting (Crystal)
run: crystal tool format --check

- name: Run ameba
run: bin/ameba
uses: ./.github/workflows/ci-base.yml
with:
crystal-version: latest
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
/lib/
/bin/
/.shards/
.vscode
.vscode
node_modules
coverage
4 changes: 3 additions & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
crystal 1.9.1
crystal 1.10.1
mint 0.19.0
nodejs 20.10.0
yarn 1.22.19
17 changes: 14 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ test: spec ameba

.PHONY: test-core
test-core: build
cd core/tests && ../../bin/mint test -b firefox
cd core/tests && ../../bin/mint test -b chrome

.PHONY: development
development: build
Expand All @@ -37,6 +37,17 @@ local: build
documentation:
rm -rf docs && crystal docs

# This builds the binary and depends on files in "src" and "core" directories.
bin/mint: $(shell find src -type f) $(shell find core/source -type f)
src/assets/runtime.js: $(shell find runtime/src -type f)
cd runtime && make index

src/assets/runtime_test.js: $(shell find runtime/src -type f)
cd runtime && make index_testing

# This builds the binary and depends on files in some directories.
bin/mint: \
$(shell find core/source -type f) \
$(shell find runtime/src -type f) \
$(shell find src -type f) \
src/assets/runtime_test.js \
src/assets/runtime.js
shards build --error-on-warnings --error-trace --progress
Loading

0 comments on commit d38639f

Please sign in to comment.