Merge b5a7068605ee2f2fe5d40a9323bffef9eb06c2a0 into b70b06e2fe56114372f9d78d170d0538f1a37ac2
This commit is contained in:
commit
e2bfec8dea
3
.github/label-pr.yml
vendored
3
.github/label-pr.yml
vendored
@ -11,6 +11,9 @@
|
||||
- regExp: ".*\\.cpp+$"
|
||||
labels: ["CPP"]
|
||||
|
||||
- regExp: ".*\\.nim+$"
|
||||
labels: ["nim"]
|
||||
|
||||
- regExp: ".*\\.sh+$"
|
||||
labels: ["shell"]
|
||||
|
||||
|
4
.github/labels.yml
vendored
4
.github/labels.yml
vendored
@ -95,6 +95,10 @@
|
||||
color: 009dff
|
||||
description: "Relevant to CCP"
|
||||
|
||||
- name: Nim
|
||||
color: fff700
|
||||
description: "Relevant to Nim"
|
||||
|
||||
- name: vlang
|
||||
color: 03cafc
|
||||
description: "Relevant to vlang"
|
||||
|
375
.github/workflows/nim.yml
vendored
Normal file
375
.github/workflows/nim.yml
vendored
Normal file
@ -0,0 +1,375 @@
|
||||
name: Nim
|
||||
|
||||
# Relevant to events - https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows
|
||||
on:
|
||||
pull_request:
|
||||
types: [synchronize, opened, reopened, ready_for_review]
|
||||
paths:
|
||||
- '**.nim'
|
||||
|
||||
jobs:
|
||||
# Linting
|
||||
lint-gcc:
|
||||
runs-on: ubuntu-latest
|
||||
container: debian:stable
|
||||
steps:
|
||||
- name: Check for git..
|
||||
run: |
|
||||
# Sync repos if needed
|
||||
# Check for git
|
||||
if ! apt list --installed 2>/dev/null | grep -qP "^git\/stable.*"; then
|
||||
# Check if we can install git
|
||||
if ! apt list | grep -qP "^git\/stable.*"; then
|
||||
apt update || exit 1
|
||||
|
||||
# Install git
|
||||
apt install -y git
|
||||
|
||||
# Self-check
|
||||
if ! apt list --installed 2>/dev/null | grep -qP "^git\/stable.*"; then exit 255; fi
|
||||
elif apt list | grep -qP "^git\/stable.*"; then
|
||||
exit 0 # Git already installed
|
||||
else
|
||||
exit 255
|
||||
fi
|
||||
elif apt list --installed 2>/dev/null | grep -qP "^git\/stable.*"; then
|
||||
exit 0 # Git already installed
|
||||
|
||||
# Self-check
|
||||
if ! apt list --installed 2>/dev/null | grep -qP "^git\/stable.*"; then exit 255; fi
|
||||
else
|
||||
exit 255
|
||||
fi
|
||||
- name: Installing nim backend..
|
||||
run: |
|
||||
# Check for curl
|
||||
if ! command -v curl; then
|
||||
# Check if we can install nim
|
||||
if ! apt list | grep -qP "^curl\/stable.*"; then
|
||||
apt update || exit 1
|
||||
|
||||
apt install -y curl || exit 1
|
||||
# Curl is already installable
|
||||
elif apt list | grep -qP "^curl\/stable.*"; then
|
||||
# Install curl
|
||||
apt install -y curl
|
||||
else
|
||||
exit 255
|
||||
fi
|
||||
elif command -v curl; then
|
||||
exit 0 # curl is already installed no need to do anything
|
||||
else
|
||||
exit 255
|
||||
fi
|
||||
- name: Installing nim backend..
|
||||
shell: bash
|
||||
run: |
|
||||
# Check for nim
|
||||
if ! command -v nim; then
|
||||
# Check if we can install nim
|
||||
if ! apt list | grep -qP "^nim\/stable.*"; then
|
||||
apt update || exit 1
|
||||
|
||||
# If nim is still not available -> Use upstream method
|
||||
if ! apt list | grep -qP "^nim\/stable.*"; then
|
||||
curl https://nim-lang.org/choosenim/init.sh --output /tmp/nim.sh || exit 1
|
||||
[ ! -x "/tmp/nim.sh" ] && { chmod +x /tmp/nim.sh || exit 1 ;}
|
||||
/tmp/nim.sh -y || exit 1
|
||||
exit 0
|
||||
elif apt list | grep -qP "^nim\/stable.*"; then
|
||||
# Install nim
|
||||
apt install -y nim
|
||||
|
||||
# Self-check
|
||||
if ! apt list --installed 2>/dev/null | grep -qP "^nim\/stable.*"; then exit 255; fi
|
||||
else
|
||||
exit 255
|
||||
fi
|
||||
elif apt list | grep -qP "^nim\/stable.*"; then
|
||||
# Install nim
|
||||
apt install -y nim
|
||||
else
|
||||
exit 255
|
||||
fi
|
||||
elif apt list --installed 2>/dev/null | grep -qP "^nim\/stable.*"; then
|
||||
exit 0 # Nim is already installed no need to do anything
|
||||
else
|
||||
exit 255
|
||||
fi
|
||||
- name: Pulling git dir..
|
||||
uses: actions/checkout@v2
|
||||
- name: Processing files..
|
||||
# Make sure that bash is used
|
||||
shell: bash
|
||||
run: |
|
||||
cd "$GITHUB_WORKSPACE"
|
||||
|
||||
# Process files
|
||||
## NOTICE: Do not use for loop to avoid pitfall https://mywiki.wooledge.org/BashPitfalls#pf1
|
||||
git --git-dir="$GITHUB_WORKSPACE/.git" ls-files -z -- '*.nim' | while IFS= read -rd '' file; do
|
||||
printf 'linting nim file %s\n' "$file"
|
||||
nim --cc:gcc check "$file" || exit 1
|
||||
done
|
||||
lint-clang:
|
||||
runs-on: ubuntu-latest
|
||||
container: debian:stable
|
||||
steps:
|
||||
- name: Check for git..
|
||||
run: |
|
||||
# Sync repos if needed
|
||||
# Check for git
|
||||
if ! apt list --installed 2>/dev/null | grep -qP "^git\/stable.*"; then
|
||||
# Check if we can install git
|
||||
if ! apt list | grep -qP "^git\/stable.*"; then
|
||||
apt update || exit 1
|
||||
|
||||
# Install git
|
||||
apt install -y git
|
||||
|
||||
# Self-check
|
||||
if ! apt list --installed 2>/dev/null | grep -qP "^git\/stable.*"; then exit 255; fi
|
||||
elif apt list | grep -qP "^git\/stable.*"; then
|
||||
exit 0 # Git already installed
|
||||
else
|
||||
exit 255
|
||||
fi
|
||||
elif apt list --installed 2>/dev/null | grep -qP "^git\/stable.*"; then
|
||||
exit 0 # Git already installed
|
||||
|
||||
# Self-check
|
||||
if ! apt list --installed 2>/dev/null | grep -qP "^git\/stable.*"; then exit 255; fi
|
||||
else
|
||||
exit 255
|
||||
fi
|
||||
- name: Installing nim dependencies (curl)..
|
||||
run: |
|
||||
# Check for curl
|
||||
if ! command -v curl; then
|
||||
# Check if we can install nim
|
||||
if ! apt list | grep -qP "^curl\/stable.*"; then
|
||||
# In case we can't install Nim from package manager
|
||||
if ! apt list | grep -qP "^nim\/stable.*"; then
|
||||
apt update || exit 1
|
||||
|
||||
apt install -y curl || exit 1
|
||||
elif apt list | grep -qP "^nim\/stable.*"; then
|
||||
true # No need to install curl
|
||||
fi
|
||||
# Curl is already installable
|
||||
elif apt list | grep -qP "^curl\/stable.*"; then
|
||||
# Install curl
|
||||
apt install -y curl
|
||||
else
|
||||
exit 255
|
||||
fi
|
||||
elif command -v curl; then
|
||||
exit 0 # curl is already installed no need to do anything
|
||||
else
|
||||
exit 255
|
||||
fi
|
||||
- name: Installing nim backend..
|
||||
shell: bash
|
||||
run: |
|
||||
# Check for nim
|
||||
if ! command -v nim; then
|
||||
# Check if we can install nim
|
||||
if ! apt list | grep -qP "^nim\/stable.*"; then
|
||||
apt update || exit 1
|
||||
|
||||
# If nim is still not available -> Use upstream method
|
||||
if ! apt list | grep -qP "^nim\/stable.*"; then
|
||||
curl https://nim-lang.org/choosenim/init.sh --output /tmp/nim.sh || exit 1
|
||||
[ ! -x "/tmp/nim.sh" ] && { chmod +x /tmp/nim.sh || exit 1 ;}
|
||||
/tmp/nim.sh -y || exit 1
|
||||
exit 0
|
||||
elif apt list | grep -qP "^nim\/stable.*"; then
|
||||
# Install nim
|
||||
apt install -y nim
|
||||
|
||||
# Self-check
|
||||
if ! apt list --installed 2>/dev/null | grep -qP "^nim\/stable.*"; then exit 255; fi
|
||||
else
|
||||
exit 255
|
||||
fi
|
||||
elif apt list | grep -qP "^nim\/stable.*"; then
|
||||
# Install nim
|
||||
apt install -y nim
|
||||
else
|
||||
exit 255
|
||||
fi
|
||||
elif apt list --installed 2>/dev/null | grep -qP "^nim\/stable.*"; then
|
||||
exit 0 # Nim is already installed no need to do anything
|
||||
else
|
||||
exit 255
|
||||
fi
|
||||
- name: Pulling git dir..
|
||||
uses: actions/checkout@v2
|
||||
- name: Processing files..
|
||||
# Make sure that bash is used
|
||||
shell: bash
|
||||
run: |
|
||||
cd "$GITHUB_WORKSPACE"
|
||||
|
||||
# Process files
|
||||
## NOTICE: Do not use for loop to avoid pitfall https://mywiki.wooledge.org/BashPitfalls#pf1
|
||||
git --git-dir="$GITHUB_WORKSPACE/.git" ls-files -z -- '*.nim' | while IFS= read -rd '' file; do
|
||||
printf 'linting nim file %s\n' "$file"
|
||||
nim --cc:clang check "$file" || exit 1
|
||||
done
|
||||
|
||||
build-gcc:
|
||||
runs-on: ubuntu-latest
|
||||
container: debian:stable
|
||||
steps:
|
||||
- name: Check for git..
|
||||
run: |
|
||||
# Sync repos if needed
|
||||
# Check for git
|
||||
if ! apt list --installed 2>/dev/null | grep -qP "^git\/stable.*"; then
|
||||
# Check if we can install git
|
||||
if ! apt list | grep -qP "^git\/stable.*"; then
|
||||
apt update || exit 1
|
||||
|
||||
# Install git
|
||||
apt install -y git
|
||||
|
||||
# Self-check
|
||||
if ! apt list --installed 2>/dev/null | grep -qP "^git\/stable.*"; then exit 255; fi
|
||||
elif apt list | grep -qP "^git\/stable.*"; then
|
||||
exit 0 # Git already installed
|
||||
else
|
||||
exit 255
|
||||
fi
|
||||
elif apt list --installed 2>/dev/null | grep -qP "^git\/stable.*"; then
|
||||
exit 0 # Git already installed
|
||||
|
||||
# Self-check
|
||||
if ! apt list --installed 2>/dev/null | grep -qP "^git\/stable.*"; then exit 255; fi
|
||||
else
|
||||
exit 255
|
||||
fi
|
||||
- name: Installing nim backend..
|
||||
shell: bash
|
||||
run: |
|
||||
# Check for nim
|
||||
if ! command -v nim; then
|
||||
# Check if we can install nim
|
||||
if ! apt list | grep -qP "^nim\/stable.*"; then
|
||||
apt update || exit 1
|
||||
|
||||
# If nim is still not available -> Use upstream method
|
||||
if ! apt list | grep -qP "^nim\/stable.*"; then
|
||||
curl https://nim-lang.org/choosenim/init.sh --output /tmp/nim.sh || exit 1
|
||||
[ ! -x "/tmp/nim.sh" ] && { chmod +x /tmp/nim.sh || exit 1 ;}
|
||||
/tmp/nim.sh -y || exit 1
|
||||
exit 0
|
||||
elif apt list | grep -qP "^nim\/stable.*"; then
|
||||
# Install nim
|
||||
apt install -y nim
|
||||
|
||||
# Self-check
|
||||
if ! apt list --installed 2>/dev/null | grep -qP "^nim\/stable.*"; then exit 255; fi
|
||||
else
|
||||
exit 255
|
||||
fi
|
||||
elif apt list | grep -qP "^nim\/stable.*"; then
|
||||
# Install nim
|
||||
apt install -y nim
|
||||
else
|
||||
exit 255
|
||||
fi
|
||||
elif apt list --installed 2>/dev/null | grep -qP "^nim\/stable.*"; then
|
||||
exit 0 # Nim is already installed no need to do anything
|
||||
else
|
||||
exit 255
|
||||
fi
|
||||
- name: Processing files..
|
||||
# Make sure that bash is used
|
||||
shell: bash
|
||||
run: |
|
||||
cd "$GITHUB_WORKSPACE"
|
||||
|
||||
# Process files
|
||||
## NOTICE: Do not use for loop to avoid pitfall https://mywiki.wooledge.org/BashPitfalls#pf1
|
||||
git --git-dir="$GITHUB_WORKSPACE/.git" ls-files -z -- '*.nim' | while IFS= read -rd '' file; do
|
||||
printf 'linting nim file %s\n' "$file"
|
||||
nim --cc:gcc check "$file" || exit 1
|
||||
done
|
||||
build-clang:
|
||||
runs-on: ubuntu-latest
|
||||
container: debian:stable
|
||||
steps:
|
||||
- name: Check for git..
|
||||
run: |
|
||||
# Sync repos if needed
|
||||
# Check for git
|
||||
if ! apt list --installed 2>/dev/null | grep -qP "^git\/stable.*"; then
|
||||
# Check if we can install git
|
||||
if ! apt list | grep -qP "^git\/stable.*"; then
|
||||
apt update || exit 1
|
||||
|
||||
# Install git
|
||||
apt install -y git
|
||||
|
||||
# Self-check
|
||||
if ! apt list --installed 2>/dev/null | grep -qP "^git\/stable.*"; then exit 255; fi
|
||||
elif apt list | grep -qP "^git\/stable.*"; then
|
||||
exit 0 # Git already installed
|
||||
else
|
||||
exit 255
|
||||
fi
|
||||
elif apt list --installed 2>/dev/null | grep -qP "^git\/stable.*"; then
|
||||
exit 0 # Git already installed
|
||||
|
||||
# Self-check
|
||||
if ! apt list --installed 2>/dev/null | grep -qP "^git\/stable.*"; then exit 255; fi
|
||||
else
|
||||
exit 255
|
||||
fi
|
||||
- name: Installing nim backend..
|
||||
shell: bash
|
||||
run: |
|
||||
# Check for nim
|
||||
if ! command -v nim; then
|
||||
# Check if we can install nim
|
||||
if ! apt list | grep -qP "^nim\/stable.*"; then
|
||||
apt update || exit 1
|
||||
|
||||
# If nim is still not available -> Use upstream method
|
||||
if ! apt list | grep -qP "^nim\/stable.*"; then
|
||||
curl https://nim-lang.org/choosenim/init.sh --output /tmp/nim.sh || exit 1
|
||||
[ ! -x "/tmp/nim.sh" ] && { chmod +x /tmp/nim.sh || exit 1 ;}
|
||||
/tmp/nim.sh -y || exit 1
|
||||
exit 0
|
||||
elif apt list | grep -qP "^nim\/stable.*"; then
|
||||
# Install nim
|
||||
apt install -y nim
|
||||
|
||||
# Self-check
|
||||
if ! apt list --installed 2>/dev/null | grep -qP "^nim\/stable.*"; then exit 255; fi
|
||||
else
|
||||
exit 255
|
||||
fi
|
||||
elif apt list | grep -qP "^nim\/stable.*"; then
|
||||
# Install nim
|
||||
apt install -y nim
|
||||
else
|
||||
exit 255
|
||||
fi
|
||||
elif apt list --installed 2>/dev/null | grep -qP "^nim\/stable.*"; then
|
||||
exit 0 # Nim is already installed no need to do anything
|
||||
else
|
||||
exit 255
|
||||
fi
|
||||
- name: Processing files..
|
||||
# Make sure that bash is used
|
||||
shell: bash
|
||||
run: |
|
||||
cd "$GITHUB_WORKSPACE"
|
||||
|
||||
# Process files
|
||||
## NOTICE: Do not use for loop to avoid pitfall https://mywiki.wooledge.org/BashPitfalls#pf1
|
||||
git --git-dir="$GITHUB_WORKSPACE/.git" ls-files -z -- '*.nim' | while IFS= read -rd '' file; do
|
||||
printf 'linting nim file %s\n' "$file"
|
||||
nim --cc:clang check "$file" || exit 1
|
||||
done
|
10
Makefile
10
Makefile
@ -70,6 +70,10 @@ build-golang:
|
||||
@ [ ! -d build/build-golang ] && mkdir build/build-golang
|
||||
@ go build -o build/build-golang/zernit-golang src/bin/main.go
|
||||
|
||||
build-nim:
|
||||
@ [ ! -d build ] && mkdir build
|
||||
@ [ ! -d build/build-nim ] && mkdir build/build-nim
|
||||
@ nim c -r -o build/build-nim/zernit-nim src/bin/main.nim
|
||||
## CHECK/TESTS ##
|
||||
|
||||
check:
|
||||
@ -112,6 +116,10 @@ check-vlang:
|
||||
@ printf 'FIXME: %s\n' "Add tests for vlang"
|
||||
@ exit 1
|
||||
|
||||
check-nim:
|
||||
@ printf 'FIXME: %s\n' "Add tests for nim"
|
||||
@ exit 1
|
||||
|
||||
## BENCHES ##
|
||||
|
||||
# FIXME: Run all benches if this is executed
|
||||
@ -129,4 +137,4 @@ clean: clean-vendor clean-benches
|
||||
|
||||
clean-vendor:
|
||||
@ # FIXME: Output helpful message if directory doesn't exists
|
||||
@ [ -d vendor ] && { rm -rf vendor || exit 1 ;} || exit 0
|
||||
@ [ -d vendor ] && { rm -rf vendor || exit 1 ;} || exit 0
|
||||
|
@ -1,9 +1,31 @@
|
||||
#include <iostream>
|
||||
#include "iostream"
|
||||
|
||||
using namespace std;
|
||||
class PackageManager {
|
||||
public:
|
||||
std::string Name;
|
||||
|
||||
std::string name() {
|
||||
return Name;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
float major, minor, patch;
|
||||
float version() {
|
||||
return major + minor + patch;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
void Zernit() {
|
||||
// Refer to the documentation
|
||||
int fixme = 1;
|
||||
if (fixme) { std::cout << "FIXME: Translate zernit into a C++++"; }
|
||||
}
|
||||
|
||||
int main() {
|
||||
// Refer to the documentation
|
||||
cout << "FIXME: Translate zernit into a C++++";
|
||||
return 1;
|
||||
}
|
||||
PackageManager *pm;
|
||||
float zernit = 0.1;
|
||||
if (zernit) { Zernit(); }
|
||||
return 1;
|
||||
}
|
||||
|
24
src/bin/main.nim
Normal file
24
src/bin/main.nim
Normal file
@ -0,0 +1,24 @@
|
||||
# Created By Angel Uniminin in 2020.
|
||||
|
||||
import strformat
|
||||
|
||||
proc SoftwareVersion(major: float32 = 0, minor: float32 = 0, patch: float64 = 0): float64 = 0.0
|
||||
if false:
|
||||
let null_ver: string = "0.0.0"
|
||||
echo null_ver
|
||||
|
||||
#else:
|
||||
# echo("Unknown Error")
|
||||
|
||||
proc programmingL(lang: string): string =
|
||||
const lang = "nim"
|
||||
return lang
|
||||
|
||||
const PackageManager: string = "Zernit"
|
||||
const Version: string = "0.0.0"
|
||||
|
||||
if true:
|
||||
echo(fmt"Welcome to {PackageManager}! Version: {Version}")
|
||||
|
||||
else:
|
||||
echo("Unknown Error")
|
Loading…
Reference in New Issue
Block a user