Skip to content

Commit 7ad1c8b

Browse files
committed
Initial Commit
0 parents  commit 7ad1c8b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+17624
-0
lines changed

.github/workflows/lines-of-code.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Update LOC metrics (lines of code)
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
7+
jobs:
8+
update:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
- name: Download scc
13+
run: |
14+
mkdir scc
15+
cd scc
16+
gh release download v3.1.0 -R boyter/scc -p '*Linux_x86_64.tar.gz' -O scc.tar.gz
17+
tar -xf scc.tar.gz
18+
chmod +x scc
19+
pwd >> $GITHUB_PATH
20+
env:
21+
GH_TOKEN: ${{ github.token }}
22+
- name: Run update script
23+
run: |
24+
cargo metadata --offline --format-version 1 --no-deps | jq -r ".workspace_members[]" | while read -r name version pathInfo ; do
25+
linesOfRustCode=$(scc -c --no-cocomo -f json -i rs ${pathInfo:13:-1} | jq '.[] | .Code');
26+
27+
curl \
28+
--header "Content-Type: application/json" \
29+
--header "X-POST-ACCESS-KEY: ${{ secrets.PROJECTS_POST_ACCESS_KEY }}" \
30+
--data "{\"project\":\"$name\",\"language\":\"rust\",\"loc\":$linesOfRustCode}" \
31+
-w "\nUpdated-project: \n" \
32+
https://projects.kaleidawave.workers.dev/update-project;
33+
34+
echo "\`$name\` has $linesOfRustCode lines of code" >> $GITHUB_STEP_SUMMARY;
35+
done

.github/workflows/publish.yml

+111
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
name: Crates and GitHub release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
ezno-version:
7+
description: "major/minor/patch or semver"
8+
required: false
9+
default: "none"
10+
ezno-parser-version:
11+
description: "major/minor/patch or semver for parse"
12+
required: false
13+
default: "none"
14+
ezno-checker-version:
15+
description: "major/minor/patch or semver for type checker"
16+
required: false
17+
default: "none"
18+
other-versions:
19+
description: "comma seperated 'name=version_argument' pairs"
20+
required: false
21+
default: "none"
22+
23+
concurrency: release-crate
24+
25+
jobs:
26+
crates-publish:
27+
runs-on: ubuntu-latest
28+
outputs:
29+
new-ezno-version: ${{ steps.push.outputs.new-ezno-version }}
30+
steps:
31+
- uses: actions/checkout@v3
32+
- name: Set git credentials
33+
run: |
34+
git config user.name github-actions
35+
git config user.email github-actions@github.com
36+
- id: set-arguments
37+
run: |
38+
$ARGS="ezno=${{ github.event.inputs.ezno-version }},ezno-parser=${{ github.event.inputs.ezno-parser-version }},ezno-checker=${{ github.event.inputs.ezno-checker-version }},${{ github.event.inputs.other-versions }}"
39+
$VALUE=$(jq --raw-input 'split(",") | map(select(length > 0 and . != "none")) | map_values(split("=") | { (.[0]): .[1] }) | reduce .[] as $o ({}; . + $o)')
40+
echo $VALUE
41+
echo "publish-args=$VALUE" >> $GITHUB_OUTPUT
42+
- name: Crates publish
43+
uses: kaleidawave/crates-release-gh-action@main
44+
id: release
45+
with:
46+
version: ${{ steps.set-arguments.outputs.publish-args }}
47+
crates-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
48+
- name: Push updated Cargo.toml
49+
id: push
50+
run: |
51+
echo "new-ezno-version=$(echo '${{ steps.release.outputs.new-versions-json-object }}' | jq ".ezno" )" >> $GITHUB_OUTPUT
52+
# Create tags
53+
echo '${{ steps.release.outputs.new-versions }}' | jq -r '.[]' | while read -r update; do
54+
git tag "release/$update"
55+
done
56+
git add .
57+
git commit -m "Release: ${{ steps.release.outputs.new-versions-description }}"
58+
git push --tags origin main
59+
- name: Discord
60+
uses: dusmartijngames/discord-webhook-notify@master
61+
with:
62+
severity: info
63+
text: "Released version ${{ steps.release.outputs.new-versions-description }}"
64+
webhookUrl: ${{ secrets.DISCORD_WEBHOOK_ENDPOINT }}
65+
66+
build:
67+
if: ${{ github.event.inputs.ezno-version != 'none' }}
68+
needs: crates-publish
69+
strategy:
70+
matrix:
71+
os: [ubuntu-latest, windows-latest]
72+
include:
73+
- os: windows-latest
74+
executable-extension: .exe
75+
platform_name: x86_64-pc-windows
76+
- os: ubuntu-latest
77+
platform_name: x86_64-unknown-linux
78+
runs-on: ${{ matrix.os }}
79+
steps:
80+
- uses: actions/checkout@v3
81+
- name: Build binary
82+
run: cargo build --release
83+
- name: Rename and move release assets
84+
run: |
85+
mkdir artifacts
86+
mv target/release/ezno${{ matrix.executable-extension }} artifacts/ezno-${{ needs.crates-publish.outputs.new-ezno-version }}-${{ matrix.platform_name }}${{ matrix.executable-extension }}
87+
- uses: actions/upload-artifact@v3
88+
with:
89+
name: build-artifacts
90+
path: artifacts/*
91+
if-no-files-found: error
92+
retention-days: 1
93+
94+
github-release:
95+
if: ${{ github.event.inputs.ezno-version != 'none' }}
96+
needs: [crates-publish, build]
97+
runs-on: ubuntu-latest
98+
steps:
99+
- uses: actions/checkout@v2
100+
- uses: actions/download-artifact@v3
101+
with:
102+
name: build-artifacts
103+
path: build-artifacts
104+
- name: GitHub release
105+
uses: softprops/action-gh-release@v1
106+
with:
107+
body: "Release ${{ needs.crates-publish.outputs.new-ezno-version }}"
108+
tag_name: "release/${{ needs.crates-publish.outputs.new-ezno-version }}"
109+
files: |
110+
README.md
111+
build-artifacts/*

.github/workflows/rust.yml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Rust
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
validity:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
- uses: actions/cache@v3
18+
with:
19+
path: |
20+
~/.cargo/registry
21+
~/.cargo/git
22+
target
23+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
24+
- name: Check source is valid
25+
run: cargo check --workspace
26+
27+
formating:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@v3
31+
- name: Check formatting with rustfmt
32+
run: cargo fmt --all --check
33+
34+
tests:
35+
needs: validity
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v3
39+
- name: Run all tests
40+
run: cargo test --workspace --verbose --all-features
41+
42+
clippy:
43+
needs: validity
44+
runs-on: ubuntu-latest
45+
steps:
46+
- uses: actions/checkout@v3
47+
- name: Lint code with clippy
48+
run: cargo clippy

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/target
2+
/pkg
3+
/private
4+
.vscode
5+
.env
6+
/checker/examples

0 commit comments

Comments
 (0)