motoko-san: add locations of pre/post conditions to the source mapper #149
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
name: "build" | |
on: | |
push: | |
branches: [ master ] | |
pull_request: {} | |
jobs: | |
tests: | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, macos-latest ] | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# fetch full history so that git merge-base works | |
fetch-depth: 0 | |
# fetch PR commit, not predicted merge commit | |
ref: ${{ github.event.pull_request.head.sha }} | |
- uses: cachix/install-nix-action@v26 | |
# We are using the ic-hs-test cachix cache that is also used by | |
# dfinity/ic-hs. This is partly laziness (on need to set up a separate | |
# cache), but also to get the ic-ref-test binary without rebuilding | |
- uses: cachix/cachix-action@v14 | |
with: | |
name: ic-hs-test | |
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' | |
# Free up disk space on Ubuntu | |
- name: Free Disk Space (Ubuntu) | |
uses: insightsengineering/disk-space-reclaimer@v1 | |
if: startsWith(matrix.os, 'ubuntu-') | |
with: | |
# this might remove tools that are actually needed, | |
# if set to "true" but frees about 6 GB | |
tools-cache: false | |
# all of these default to true, but feel free to set to | |
# "false" if necessary for your workflow | |
android: true | |
dotnet: true | |
haskell: true | |
large-packages: true | |
docker-images: true | |
swap-storage: false | |
# until https://github.com/cachix/cachix-action/issues/86 is fixed: | |
- run: cachix watch-store ic-hs-test & | |
- run: nix-env -iA nix-build-uncached -f nix/ | |
- name: "pre-build `drun`" | |
if: startsWith(github.head_ref, 'update/ic-') | |
run: | | |
nix-build --max-jobs 1 -A drun | |
nix-store --gc --print-roots | grep /motoko/ | |
- name: "nix-build" | |
run: nix-build-uncached --max-jobs 4 -A all-systems-go -build-flags -L | |
- name: Calculate performance delta | |
if: github.actor != 'dependabot[bot]' && runner.os == 'Linux' && github.event_name == 'pull_request' | |
run: | | |
from="$(git merge-base origin/${{ github.base_ref }} HEAD)" | |
to="${{ github.event.pull_request.head.sha }}" | |
echo "Comparing changes from $from to $to" | |
nix-build --max-jobs 4 perf-delta.nix -o perf-delta.txt \ | |
--argstr ref HEAD \ | |
--argstr from "$from" \ | |
--argstr to "$to" | |
- name: Read performance delta | |
if: github.actor != 'dependabot[bot]' && runner.os == 'Linux' && github.event_name == 'pull_request' | |
id: perf | |
uses: juliangruber/read-file-action@v1 | |
with: | |
path: ./perf-delta.txt | |
- name: Find performance comment | |
if: github.actor != 'dependabot[bot]' && runner.os == 'Linux' && github.event_name == 'pull_request' | |
uses: peter-evans/find-comment@v3 | |
id: fc | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
comment-author: 'github-actions[bot]' | |
body-includes: '<!-- perf comment -->' | |
# Forks can't add comments so this job does not run on forks, see | |
# motoko#2864. | |
- name: Create or update performance comment | |
if: github.actor != 'dependabot[bot]' && runner.os == 'Linux' && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository | |
uses: peter-evans/create-or-update-comment@v4 | |
with: | |
comment-id: ${{ steps.fc.outputs.comment-id }} | |
issue-number: ${{ github.event.pull_request.number }} | |
body: | | |
<!-- perf comment --> | |
${{ steps.perf.outputs.content }} | |
edit-mode: replace | |
reports: | |
if: github.ref == 'refs/heads/master' | |
needs: tests | |
concurrency: ci-${{ github.ref }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cachix/install-nix-action@v26 | |
- uses: cachix/cachix-action@v14 | |
with: | |
name: ic-hs-test | |
- name: Fetch report | |
run: nix-build -A report-site -o report-site | |
- name: Resolve symlinks | |
run: cp -rL report-site report-site-copy | |
- name: Push report to GitHub pages | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
branch: gh-pages | |
folder: report-site-copy | |
single-commit: true | |
artifacts: | |
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && contains(github.event.pull_request.labels.*.name, 'build_artifacts') | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, macos-latest ] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cachix/install-nix-action@v26 | |
- uses: cachix/cachix-action@v14 | |
with: | |
name: ic-hs-test | |
- name: nix-build | |
run: | | |
nix-build --arg officialRelease true -A moc | |
# upload-artifact doesn't work for symlink dir | |
# https://github.com/actions/upload-artifact/issues/92 | |
- run: echo "UPLOAD_PATH=$(readlink -f result)" >> $GITHUB_ENV | |
- name: upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: moc-${{ matrix.os }} | |
path: ${{ env.UPLOAD_PATH }} | |
retention-days: 5 |