Skip to content

Commit

Permalink
Move some logic from release.yml to windows.yml (#177)
Browse files Browse the repository at this point in the history
  • Loading branch information
Akuli authored Jan 31, 2023
1 parent 88b76da commit e092ac2
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 29 deletions.
27 changes: 12 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
).data.artifacts;
console.log(`Found ${allArtifacts.length} artifacts`);
console.log(allArtifacts.map(a => a.name));
const artifact = allArtifacts.filter(a => a.name === 'exe-and-dlls')[0];
const artifact = allArtifacts.filter(a => a.name === 'windows-zip')[0];
const zip = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
Expand All @@ -65,22 +65,19 @@ jobs:
});
// https://stackoverflow.com/a/46779188
fs.writeFileSync("exe-and-dlls.zip", Buffer.from(zip.data));
fs.writeFileSync("nested-zip-file.zip", Buffer.from(zip.data));
# TODO: Ideally the zip file would already contain everything it
# needs, and we wouldn't need this step at all.
# We get a zip file inside a zip file:
# * Inner zip file: The build creates a releasing-ready zip file. This is
# good because you can test the zip file before Jou is released.
# * Outer zip file: It is possible to include multiple files to the same
# GitHub Actions artifact, and downloadArtifact() gives a zip of all
# files that the artifact consists of.
- if: ${{ steps.tagname.outputs.datetag != '' }}
name: Create the zip file
run: |
unzip exe-and-dlls.zip
ls -l
mkdir -v jou
cp -v jou.exe jou
cp -v *.dll jou
cp -rv stdlib jou
cp -rv mingw64 jou
cp -v update.ps1 jou
zip -r jou_windows_64bit_${{ steps.tagname.outputs.datetag }}.zip jou
run: unzip nested-zip-file.zip

- if: ${{ steps.tagname.outputs.datetag != '' }}
run: mv jou.zip jou_windows_64bit_${{ steps.tagname.outputs.datetag }}.zip

- if: ${{ steps.tagname.outputs.datetag != '' }}
name: Create release
Expand Down
32 changes: 22 additions & 10 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,14 @@ jobs:
# Using gcc instead of clang, because gcc "just works".
- run: sudo apt install -y llvm-13-dev gcc-mingw-w64-x86-64-win32
- run: CC=x86_64-w64-mingw32-gcc LDFLAGS=lib/LLVM-C.lib make
- run: mkdir exe-and-dlls
- run: cp -rv jou.exe mingw64 bin/*.dll exe-and-dlls/
- run: mkdir jou
# Please keep this list of files in sync with update.ps1
- run: cp -rv jou.exe bin/*.dll stdlib mingw64 update.ps1 jou
- run: zip -r jou.zip jou
- uses: actions/upload-artifact@v3
with:
name: exe-and-dlls
path: exe-and-dlls
name: windows-zip
path: jou.zip

codeblocks-project:
# Ensure that the codeblocks project contains all source files.
Expand All @@ -110,20 +112,30 @@ jobs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
path: repo
- uses: actions/download-artifact@v3
with:
name: exe-and-dlls
name: windows-zip
- run: unzip jou.zip
- run: mv jou/* repo/tests repo/runtests.sh repo/examples .
shell: bash
- run: .\jou.exe --verbose examples/hello.jou
- shell: bash
run: ./runtests.sh
- run: ./runtests.sh
shell: bash

fuzzer:
needs: build
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
path: repo
- uses: actions/download-artifact@v3
with:
name: exe-and-dlls
- shell: bash
run: ./fuzzer.sh
name: windows-zip
- run: unzip jou.zip
- run: mv jou/* repo/tests repo/fuzzer.sh .
shell: bash
- run: ./fuzzer.sh
shell: bash
12 changes: 8 additions & 4 deletions fuzzer.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#!/bin/bash
set -e -o pipefail

if ! [[ "$OS" =~ Windows ]]; then
if [[ "$OS" =~ Windows ]]; then
jouexe="./jou.exe"
else
make
jouexe="./jou"
fi

rm -rf tmp/fuzzer
Expand All @@ -22,7 +25,7 @@ while [ $(date +%s) -lt $end ]; do
#cat tests/*/*.jou | shuf -n 10 | rev > tmp/fuzzer/input3.jou

for file in tmp/fuzzer/input*.jou; do
(bash -c "./jou $file 2>&1" || true) | tr -d '\r' > tmp/fuzzer/log.txt
(bash -c "$jouexe $file 2>&1" || true) | tr -d '\r' > tmp/fuzzer/log.txt

# One-line compiler error message made up of printable ASCII chars = good
# https://unix.stackexchange.com/a/194538
Expand All @@ -35,11 +38,12 @@ while [ $(date +%s) -lt $end ]; do
echo ""
echo "*** found a possible bug ***"
echo ""
echo "To reproduce, run: ./jou $file"
echo "To reproduce, run: $jouexe $file"
if [ "$CI" = "true" ]; then
echo ""
echo "For CI environments and such, here's a hexdump of $file:"
hexdump -C $file
# git bash on windows doesn't have hexdump, but has od which can also output hex
od -t x1 $file | cut -s -d' ' -f2-
fi
exit 1
fi
Expand Down

0 comments on commit e092ac2

Please sign in to comment.