-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:EpitechPromo2027/B-FUN-500-BAR-5-2-…
…glados-oriol.linan into 11-token-to-ast
- Loading branch information
Showing
10 changed files
with
229 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
Jabolol | ||
lib/Codegen/* @Jabolol |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
name: Release Workflow | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
- macos-14 | ||
- macos-13 | ||
runs-on: "${{ matrix.os }}" | ||
if: github.ref == 'refs/heads/main' | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Install required packages | ||
if: matrix.os == 'ubuntu-latest' | ||
run: sudo apt update && sudo apt install -y build-essential libffi-dev libgmp-dev zlib1g-dev | ||
|
||
- name: Install required packages | ||
if: matrix.os == 'macos-14' || matrix.os == 'macos-13' | ||
run: brew install libffi zlib | ||
|
||
- name: Setup Haskell | ||
uses: ./external/haskell-setup | ||
with: | ||
ghc-version: 9.4.8 | ||
cabal-version: 3.12.1.0 | ||
|
||
- name: Build project | ||
run: cabal build | ||
|
||
- name: Get binary path | ||
run: | | ||
mv "$(cabal list-bin exe:glados)" "$(cabal list-bin exe:glados)_$(uname -s)_$(uname -m)" | ||
echo "GLADOS_BIN=$(cabal list-bin exe:glados)_$(uname -s)_$(uname -m)" >> $GITHUB_ENV | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: "${{ matrix.os }}-artifact" | ||
path: | | ||
${{ env.GLADOS_BIN }} | ||
overwrite: true | ||
|
||
release: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
if: github.ref == 'refs/heads/main' | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
fetch-depth: 0 | ||
|
||
- name: Download artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: artifacts | ||
merge-multiple: true | ||
|
||
- name: Determine release body | ||
id: release_body | ||
run: | | ||
if [ -z "$(git tag --list)" ]; then | ||
git log --oneline --no-decorate > release_body.txt | ||
else | ||
latest_tag=$(git describe --tags --abbrev=0) | ||
git log ${latest_tag}..HEAD --oneline --no-decorate > release_body.txt | ||
fi | ||
- name: Create Release | ||
uses: softprops/action-gh-release@master | ||
with: | ||
tag_name: draft | ||
draft: true | ||
files: | | ||
artifacts/* | ||
body_path: release_body.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,4 @@ cabal.project.local~ | |
venv/ | ||
*.tix | ||
codecov.json | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule setup-chrome
added at
facf10
Submodule setup-deno
added at
56da42
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,6 @@ source-repository head | |
common warnings | ||
ghc-options: | ||
-Wall | ||
-fhpc | ||
|
||
library | ||
import: warnings | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
/// <reference lib="dom" /> | ||
|
||
import { $ } from "npm:zx"; | ||
import puppeteer from "https://deno.land/x/puppeteer@16.2.0/mod.ts"; | ||
|
||
const WEBHOOK_URL = Deno.args[0]; | ||
const CHROME_PATH = Deno.args[1]; | ||
|
||
if (!WEBHOOK_URL) { | ||
throw new Error("WEBHOOK_URL is not set"); | ||
} | ||
|
||
if (!CHROME_PATH) { | ||
throw new Error("CHROME_PATH is not set"); | ||
} | ||
|
||
const hpcRootPath = | ||
await $`find dist-newstyle -name hpc_index.html | head -n 1`; | ||
|
||
const browser = await puppeteer.launch({ | ||
args: [ | ||
"--no-sandbox", | ||
"--disable-dev-shm-usage", | ||
], | ||
executablePath: CHROME_PATH, | ||
}); | ||
|
||
const page = await browser.newPage(); | ||
|
||
await page.goto(`file://${Deno.cwd()}/${hpcRootPath.stdout.trim()}`); | ||
|
||
const { width, height } = await page.evaluate(() => { | ||
const body = document.body; | ||
const html = document.documentElement; | ||
|
||
const contentWidth = Math.max( | ||
body.scrollWidth, | ||
body.offsetWidth, | ||
html.clientWidth, | ||
html.scrollWidth, | ||
html.offsetWidth, | ||
); | ||
const contentHeight = Math.max( | ||
body.scrollHeight, | ||
body.offsetHeight, | ||
html.clientHeight, | ||
html.scrollHeight, | ||
html.offsetHeight, | ||
); | ||
|
||
return { width: contentWidth, height: contentHeight }; | ||
}); | ||
|
||
await page.setViewport({ width, height }); | ||
|
||
await page.screenshot({ path: "coverage.png", type: "png" }); | ||
|
||
await browser.close(); | ||
|
||
const form = new FormData(); | ||
|
||
const gitCommitHash = (await $`git rev-parse HEAD`).stdout.trim(); | ||
|
||
form.append( | ||
"payload_json", | ||
JSON.stringify({ | ||
embeds: [ | ||
{ | ||
title: "HPC Test Report", | ||
description: `\`\`\`md\n# ${gitCommitHash}\n\`\`\``, | ||
image: { | ||
url: "attachment://coverage.png", | ||
}, | ||
color: 0x36393f, | ||
}, | ||
], | ||
}), | ||
); | ||
|
||
form.append( | ||
"file2", | ||
new Blob([await Deno.readFile(`./coverage.png`)], { type: "image/png" }), | ||
"coverage.png", | ||
); | ||
|
||
const req = await fetch(WEBHOOK_URL, { | ||
body: form, | ||
method: "POST", | ||
}); | ||
|
||
if (!req.ok) { | ||
await fetch(WEBHOOK_URL, { | ||
method: "POST", | ||
body: JSON.stringify( | ||
`\`\`\`json\n${JSON.stringify(await req.json(), null, 2)}\n\`\`\``, | ||
), | ||
}); | ||
} | ||
|
||
await $`rm coverage.png`; |