Skip to content

Nightly

Nightly #133

Workflow file for this run

name: Nightly
on:
schedule:
# Run at 2 AM UTC every day
- cron: '0 2 * * *'
workflow_dispatch:
env:
SJASMPLUS_VERSION: v1.20.3
jobs:
nightly-test:
name: Nightly Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
cache: true
cache-dependency-path: minzc/go.sum
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
- name: Cache sjasmplus
id: cache-sjasmplus
uses: actions/cache@v4
with:
path: ~/sjasmplus
key: ${{ runner.os }}-sjasmplus-${{ env.SJASMPLUS_VERSION }}
- name: Install sjasmplus
if: steps.cache-sjasmplus.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake
git clone --branch ${{ env.SJASMPLUS_VERSION }} https://github.com/z00m128/sjasmplus.git ~/sjasmplus-src
cd ~/sjasmplus-src
mkdir build && cd build
cmake ..
make -j$(nproc)
mkdir -p ~/sjasmplus/bin
cp sjasmplus ~/sjasmplus/bin/
echo "$HOME/sjasmplus/bin" >> $GITHUB_PATH
- name: Add cached sjasmplus to PATH
if: steps.cache-sjasmplus.outputs.cache-hit == 'true'
run: echo "$HOME/sjasmplus/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
npm install
cd minzc && make deps
- name: Generate tree-sitter parser
run: npm run generate
- name: Build MinZ compiler
working-directory: minzc
run: make build
- name: Run all tests with coverage
working-directory: minzc
run: |
go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
- name: Run extended E2E tests
working-directory: minzc
run: |
go test -v -timeout 1h ./pkg/z80testing -run TestE2E
env:
MINZC_TEST_VERBOSE: "1"
MINZC_TEST_EXTENDED: "1"
- name: Run TSMC benchmarks
working-directory: minzc
run: |
go test -v -timeout 1h ./pkg/z80testing -run TestTSMCBenchmark
env:
MINZC_TEST_VERBOSE: "1"
- name: Run corpus tests
working-directory: minzc
run: |
go test -v -timeout 1h ./pkg/z80testing -run TestCorpus
env:
MINZC_TEST_VERBOSE: "1"
MINZC_TEST_EXTENDED: "1"
- name: Compile all examples
run: |
cd minzc
for example in ../examples/*.minz; do
echo "Compiling $example..."
./minzc "$example" -o "$(basename "$example" .minz).a80"
./minzc "$example" -O --enable-smc -o "$(basename "$example" .minz)_opt.a80"
./minzc "$example" -O --enable-true-smc -o "$(basename "$example" .minz)_tsmc.a80"
done
- name: Generate nightly report
working-directory: minzc
run: |
echo "# MinZ Compiler Nightly Report" > nightly_report.md
echo "## Date: $(date)" >> nightly_report.md
echo "## Commit: ${{ github.sha }}" >> nightly_report.md
echo "" >> nightly_report.md
echo "### Test Summary" >> nightly_report.md
go test -v ./... 2>&1 | grep -E "(PASS|FAIL|ok|SKIP)" >> nightly_report.md || true
echo "" >> nightly_report.md
echo "### Performance Metrics" >> nightly_report.md
if [ -f tsmc_benchmark_report.md ]; then
cat tsmc_benchmark_report.md >> nightly_report.md
fi
echo "" >> nightly_report.md
echo "### Corpus Test Results" >> nightly_report.md
if [ -f corpus_test_report.json ]; then
jq -r '.summary' corpus_test_report.json >> nightly_report.md || true
fi
- name: Upload nightly artifacts
uses: actions/upload-artifact@v4
with:
name: nightly-${{ github.run_number }}
path: |
minzc/nightly_report.md
minzc/tsmc_benchmark_report.md
minzc/corpus_test_report.json
minzc/coverage.txt
minzc/*.a80
retention-days: 30
- name: Create issue on failure
if: failure()
uses: actions/github-script@v7
with:
script: |
const issue = await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: `Nightly build failed - ${new Date().toISOString().split('T')[0]}`,
body: `The nightly build failed. Please check the [workflow run](${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}) for details.`,
labels: ['bug', 'ci']
});
console.log(`Created issue #${issue.data.number}`);