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

Commit

Permalink
Merge main into compute AST
Browse files Browse the repository at this point in the history
  • Loading branch information
TTENSHII committed Dec 5, 2023
2 parents c73322c + e0aac41 commit cd08a38
Show file tree
Hide file tree
Showing 24 changed files with 769 additions and 31 deletions.
92 changes: 92 additions & 0 deletions .github/workflows/compil.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Compil

on: [push]

jobs:
compil-check-job-run:
runs-on: ubuntu-latest

outputs:
workflows: ${{ steps.filter.outputs.workflows }}
src: ${{ steps.filter.outputs.src }}
make: ${{ steps.filter.outputs.make }}
combined: ${{ steps.filter.outputs.workflows == 'true' || steps.filter.outputs.src == 'true' || steps.filter.outputs.make == 'true' }}

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Check modified files need re run
id: filter
uses: dorny/paths-filter@v2
with:
filters: |
workflows:
- '.github/workflows/**'
src:
- '*.hs'
make:
- 'Makefile'
compil-windows:
runs-on: windows-latest
needs: [compil-check-job-run]
if: needs.compil-check-job-run.outputs.combined

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Haskell
uses: haskell-actions/setup@v2
with:
enable-stack: true
stack-version: 'latest'

- name: Install dependencies
run: ./scripts/InstallDepsWindows.ps1

- name: Compil
run: make

compil-linux:
runs-on: ubuntu-latest
needs: [compil-check-job-run]
if: needs.compil-check-job-run.outputs.combined

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Haskell
uses: haskell-actions/setup@v2
with:
enable-stack: true
stack-version: 'latest'

- name: Install dependencies
run: sudo ./scripts/InstallDepsLinux.bash

- name: Compil
run: make

compil-macos:
runs-on: macos-latest
needs: [compil-check-job-run]
if: needs.compil-check-job-run.outputs.combined

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Haskell
uses: haskell-actions/setup@v2
with:
enable-stack: true
stack-version: 'latest'

- name: Install dependencies
run: ./scripts/InstallDepsMacOS.zsh

- name: Compil
run: make
85 changes: 85 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Documentation
on: [push]

jobs:
documentation:
runs-on: ubuntu-latest
permissions:
contents: write # To push a branch
pages: write # To push to a GitHub Pages site
id-token: write # To update the deployment status

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Check modified files need re run
id: filter
uses: dorny/paths-filter@v2
with:
filters: |
docs:
- 'docs/**'
docs2:
- 'book.toml'
workflow:
- '.github/workflows/documentation.yml'
- name: Install latest mdbook
if: steps.filter.outputs.docs == 'true' || steps.filter.outputs.docs2 == 'true' || steps.filter.outputs.workflow == 'true' || github.ref == 'refs/heads/main'
run: |
tag=$(curl 'https://api.github.com/repos/rust-lang/mdbook/releases/latest' | jq -r '.tag_name')
url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz"
mkdir mdbook
curl -sSL $url | tar -xz --directory=./mdbook
echo `pwd`/mdbook >> $GITHUB_PATH
- name: Install emojify
if: steps.filter.outputs.docs == 'true' || steps.filter.outputs.docs2 == 'true' || steps.filter.outputs.workflow == 'true' || github.ref == 'refs/heads/main'
run: |
wget --no-verbose https://github.com/shonfeder/emojitsu/releases/download/0.1.1/gh-actions-emojitsu
chmod +x gh-actions-emojitsu
# Emojify the markdown
find . -type f -name "*.md" -exec ./gh-actions-emojitsu emojify -i {} \;
- name: Build Book
if: steps.filter.outputs.docs == 'true' || steps.filter.outputs.docs2 == 'true' || steps.filter.outputs.workflow == 'true' || github.ref == 'refs/heads/main'
run: mdbook build

- name: Install Haskell
uses: haskell-actions/setup@v2
with:
enable-stack: true
stack-version: 'latest'

- name: Compil
if: steps.filter.outputs.docs == 'true' || steps.filter.outputs.docs2 == 'true' || steps.filter.outputs.workflow == 'true' || github.ref == 'refs/heads/main'
run: |
if ! stack build; then
exit 0
fi
- name: Tests
if: steps.filter.outputs.docs == 'true' || steps.filter.outputs.docs2 == 'true' || steps.filter.outputs.workflow == 'true' || github.ref == 'refs/heads/main'
run: |
if ! stack test --test-arguments "--html book/Tests.html"; then
exit 0
fi
- name: Setup Pages
if: github.ref == 'refs/heads/main'
uses: actions/configure-pages@v3

- name: Upload artifact
if: steps.filter.outputs.docs == 'true' || steps.filter.outputs.docs2 == 'true' || steps.filter.outputs.workflow == 'true' || github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@v2
with:
# Upload entire repository
path: 'book'

- name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/main'
id: deployment
uses: actions/deploy-pages@v2
24 changes: 24 additions & 0 deletions .github/workflows/mirror.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Mirror

on: [push]

env:
MIRROR_URL: git@github.com:EpitechPromo2026/B-FUN-500-TLS-5-2-glados-xavier.mitault.git

jobs:
mirror:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: pixta-dev/repository-mirroring-action@v1
if: github.repository != 'EpitechPromo2026/B-FUN-500-TLS-5-2-glados-xavier.mitault'
with:
target_repo_url:
${{ env.MIRROR_URL }}
ssh_private_key:
${{ secrets.SSH_KEY }}
53 changes: 53 additions & 0 deletions .github/workflows/norm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Norm

on: [pull_request]
# lambdananas -o vera --exclude "Setup.hs:setup.hs:.git:.stack-work:test:tests:bonus" . >> lambdananas-reports.log
jobs:

norm:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install Deps
run: |
sudo apt-get update && sudo apt-get install -y curl
curl -fsSL 'https://github.com/Saverio976/dotfiles/raw/main/.local/bin/lambdananas' > /tmp/lambdananas
chmod +x /tmp/lambdananas
- name: Format
run: /tmp/lambdananas -o vera --exclude "Setup.hs:setup.hs:.git:.stack-work:test:tests:bonus" . >> lambdananas-reports.log

- name: Is Empty
id: isEmpty
run: |
if [ "$(cat lambdananas-reports.log)" == "" ]; then
echo "isEmpty=true" >> $GITHUB_OUTPUT
else
echo "isEmpty=false" >> $GITHUB_OUTPUT
fi
- name: Send coding style message Ok
uses: mshick/add-pr-comment@v2
if: steps.isEmpty.outputs.isEmpty == 'true'
with:
message: "No coding style issue"
refresh-message-position: true
message-id: norm-cicd

- name: Send coding style message KO
uses: mshick/add-pr-comment@v2
if: steps.isEmpty.outputs.isEmpty == 'false'
with:
message-path: |
lambdananas-reports.log
refresh-message-position: true
message-id: norm-cicd

- name: Exit Status
run: |
if [ ${{ steps.isEmpty.outputs.isEmpty }} == 'false' ]; then
exit 1
fi
46 changes: 46 additions & 0 deletions .github/workflows/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash
# Release script run in Github CI

BRANCH="$1"

LAST_TAG=$(git tag | sort -t '.' --numeric-sort -k1,1 -k2,2 -k3,3 | tail -n 1)
LAST_TAG_MAJOR=$(echo "$LAST_TAG" | cut -d'.' -f1)
LAST_TAG_MINOR=$(echo "$LAST_TAG" | cut -d'.' -f2)
LAST_TAG_PATCH=$(echo "$LAST_TAG" | cut -d'.' -f3)

git show --compact-summary "$LAST_TAG..HEAD" > CHANGELOG

TAG_MAJOR=""
TAG_MINOR=""
TAG_PATCH=""

WARNINGS=""

if grep -q "^ MAJOR" CHANGELOG; then
TAG_MAJOR=$((LAST_TAG_MAJOR + 1))
TAG_MINOR="0"
TAG_PATCH="0"
elif grep -q "^ MINOR" CHANGELOG; then
TAG_MAJOR=$((LAST_TAG_MAJOR + 0))
TAG_MINOR=$((LAST_TAG_MINOR + 1))
TAG_PATCH="0"
elif grep -q "^ PATCH" CHANGELOG; then
TAG_MAJOR=$((LAST_TAG_MAJOR + 0))
TAG_MINOR=$((LAST_TAG_MINOR + 0))
TAG_PATCH=$((LAST_TAG_PATCH + 1))
else
WARNINGS="$WARNINGS ; This release is created with default bump version because no commits was ok"
TAG_MAJOR=$((LAST_TAG_MAJOR + 0))
TAG_MINOR=$((LAST_TAG_MINOR + 0))
TAG_PATCH=$((LAST_TAG_PATCH + 1))
fi

TAG="$TAG_MAJOR.$TAG_MINOR.$TAG_PATCH"

gh release create "$TAG" \
--title "v$TAG" \
--generate-notes \
--target "$BRANCH"

echo "release_tag=$TAG" >> $GITHUB_OUTPUT
echo "$WARNINGS"
Loading

0 comments on commit cd08a38

Please sign in to comment.