Skip to content

Remove ambiguous 'environment' metadata attribute #39

Remove ambiguous 'environment' metadata attribute

Remove ambiguous 'environment' metadata attribute #39

Workflow file for this run

name: PR CI
on:
pull_request:
workflow_dispatch:
# Cancel in-progress runs for the same PR
concurrency:
group: pr-ci-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
permissions:
contents: write
pull-requests: write
jobs:
build-measure:
name: Build Measure Executable
runs-on: ubuntu-latest
steps:
- name: Nothing but Nix - Optimize disk space
uses: wimpysworld/nothing-but-nix@main
- name: Checkout
uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v31
with:
extra_nix_config: |
accept-flake-config = true
- name: Use Cachix (pull/push if token provided)
uses: cachix/cachix-action@v15
with:
name: uplc-cape
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
- name: Build measure executable
run: nix build .#measure --accept-flake-config -o result
- name: Upload measure executable
uses: actions/upload-artifact@v4
with:
name: measure-executable
path: result/bin/measure
retention-days: 1
validate:
name: Build and Test
needs: build-measure
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v31
with:
extra_nix_config: |
accept-flake-config = true
- name: Use Cachix (pull/push if token provided)
uses: cachix/cachix-action@v15
with:
name: uplc-cape
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
- name: Download measure executable
uses: actions/download-artifact@v4
with:
name: measure-executable
path: result/bin
- name: Make measure executable
run: chmod +x result/bin/measure
- name: Build plinth-submissions executable
run: nix build .#plinth-submissions --accept-flake-config -o result-plinth
- name: Run Haskell test suite
run: nix flake check --accept-flake-config
- name: Verify all submissions
run: nix develop --accept-flake-config --command bash -c "echo 'Checking result/bin:' && ls -lh result/bin/ && export PATH=\"\$PWD/result/bin:\$PATH\" && cape submission verify --all --verbose"
preview:
name: Deploy PR Preview
needs: [build-measure, validate]
runs-on: ubuntu-latest
# Only run on PRs (not workflow_dispatch)
if: github.event_name == 'pull_request'
steps:
- name: Checkout PR branch
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check if submission data changed
id: check_changes
run: |
# Check if .uplc or metadata.json files changed compared to main
if git diff --name-only origin/main...HEAD | grep -qE 'submissions/.*\.(uplc|metadata\.json)$'; then
echo "Submission data files changed, proceeding with report generation"
echo "has_changes=true" >> $GITHUB_OUTPUT
else
echo "No submission data changes detected (only docs/README), skipping deployment"
echo "has_changes=false" >> $GITHUB_OUTPUT
fi
- name: Install Nix
if: steps.check_changes.outputs.has_changes == 'true'
uses: cachix/install-nix-action@v31
with:
extra_nix_config: |
accept-flake-config = true
- name: Use Cachix (pull/push if token provided)
if: steps.check_changes.outputs.has_changes == 'true'
uses: cachix/cachix-action@v15
with:
name: uplc-cape
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
- name: Download measure executable
if: steps.check_changes.outputs.has_changes == 'true'
uses: actions/download-artifact@v4
with:
name: measure-executable
path: result/bin
- name: Make measure executable
if: steps.check_changes.outputs.has_changes == 'true'
run: chmod +x result/bin/measure
- name: Measure all submissions
if: steps.check_changes.outputs.has_changes == 'true'
run: |
nix develop --accept-flake-config --command bash -c "export PATH=\"\$PWD/result/bin:\$PATH\" && cape submission measure --all"
- name: Generate HTML reports
if: steps.check_changes.outputs.has_changes == 'true'
run: |
nix develop --accept-flake-config --command bash -c "export PATH=\"\$PWD/result/bin:\$PATH\" && cape submission report --all"
- name: Deploy to GitHub Pages
if: steps.check_changes.outputs.has_changes == 'true'
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./report
destination_dir: pr-${{ github.event.pull_request.number }}
keep_files: true
- name: Post preview link comment
if: steps.check_changes.outputs.has_changes == 'true'
uses: marocchino/sticky-pull-request-comment@v2
with:
header: pr-preview
message: |
## 🚀 PR Preview Deployed
Preview URL: https://intersectmbo.github.io/UPLC-CAPE/pr-${{ github.event.pull_request.number }}/
The preview site is automatically updated on every push to this PR and will be removed when the PR is closed.
- name: Skip message
if: steps.check_changes.outputs.has_changes == 'false'
run: |
echo "ℹ️ No submission data changes detected. Skipping report generation."
echo "Only documentation or README files were modified in the submissions/ directory."