Skip to content

Commit

Permalink
Merge branch 'master' of github.com:dfinity/motoko into joachim/multi…
Browse files Browse the repository at this point in the history
…-value
  • Loading branch information
nomeata committed Dec 12, 2021
2 parents 3fdb00b + ec0d504 commit 1b4a4f7
Show file tree
Hide file tree
Showing 221 changed files with 3,994 additions and 1,126 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/niv-updater-rare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
uses: knl/niv-updater-action@60f23607814cf4f2e80a1e32ee74f8323897d09e
with:
# might be too noisy
whitelist: 'ic-ref,musl-wasi,niv'
whitelist: 'ic-ref,musl-wasi'
labels: |
automerge-squash
keep_updating: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/niv-updater.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
uses: knl/niv-updater-action@60f23607814cf4f2e80a1e32ee74f8323897d09e
with:
# might be too noisy
blacklist: 'nixpkgs,ic-ref,musl-wasi,niv'
blacklist: 'nixpkgs,ic-ref,musl-wasi'
labels: |
automerge-squash
keep_updating: true
Expand Down
39 changes: 27 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
name: release

# We trigger this on all tags. The job will fail for tags that don’t have a
# changelog entry, so that seems good enough
# We trigger this on all tags and on the `master` branch. The job
# `changelog` will fail for tags that don’t have a
# changelog entry, so that seems good enough.
# For `master` this check is skipped as well as uploads.

on:
push:
tags:
- '*'
branches:
- 'master'

jobs:
# first check that the changelog is in good order and extract the changelog
Expand All @@ -15,16 +20,16 @@ jobs:
steps:
- uses: actions/checkout@v2

# from https://github.community/t/how-to-get-just-the-tag-name/16241/7
- name: Get the version
id: get_version
run: echo ::set-output name=version::${GITHUB_REF/refs\/tags\//}
run: echo ::set-output name=version::${{ github.ref_name }}

- name: Extract changelog
id: read_changelog
if: startsWith(github.ref, 'refs/tags/')
run: |
export VERSION='${{ steps.get_version.outputs.VERSION }}'
perl -0777 -ne '/^# Motoko compiler changelog\n\n== (??{quotemeta($ENV{VERSION})}) \(\d\d\d\d-\d\d-\d\d\)\n\n(.*?)^==/sm or die "Changelog does not look right for this version\n" ; print $1' Changelog.md > changelog-extract.md
export VERSION='${{ steps.get_version.outputs.version }}'
perl -0777 -ne '/^# Motoko compiler changelog\n\n## (??{quotemeta($ENV{VERSION})}) \(\d\d\d\d-\d\d-\d\d\)\n\n(.*?)^##/sm or die "Changelog does not look right for this version\n" ; print $1' Changelog.md > changelog-extract.md
cat changelog-extract.md
# need to mangle to use with set-output, see https://github.com/svenstaro/upload-release-action/pull/49/files
r="$(cat changelog-extract.md)"
Expand All @@ -46,29 +51,39 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v12
- uses: cachix/install-nix-action@v16
with:
extra_nix_config: |
experimental-features = nix-command
- uses: cachix/cachix-action@v10
if: startsWith(github.ref, 'refs/heads/')
with:
name: ic-hs-test
# NB: No auth token, we don’t want to push new stuff here
- uses: cachix/cachix-action@v10
if: startsWith(github.ref, 'refs/tags/')
with:
name: ic-hs-test
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: cachix watch-store ic-hs-test &
- name: "nix-build"
env:
GC_DONT_GC: 1 # otherwise `nix` crash on macOS
# these are the dependencies listed in release-files. Sorry for the duplication
run: |
nix-build --max-jobs 1 --argstr releaseVersion ${{needs.changelog.outputs.version}} \
-A moc -A mo-ide -A mo-doc -A js.moc -A js.moc_interpreter
# Finally do the upload. Hopefully the previous job has uploaded the
# build product to the nix cache, as we cannot build the darwin products on
# build product to the cachix cache, as we cannot build the darwin products on
# linux
release:
if: startsWith(github.ref, 'refs/tags/')
runs-on: 'ubuntu-latest'
needs:
- changelog
- build
needs: [ changelog, build ]
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v12
- uses: cachix/install-nix-action@v16
- uses: cachix/cachix-action@v10
with:
name: ic-hs-test
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ jobs:
fetch-depth: 0
# fetch PR commit, not predicted merge commit
ref: ${{ github.event.pull_request.head.sha }}
- uses: cachix/install-nix-action@v13
- uses: cachix/install-nix-action@v16
with:
extra_nix_config: |
experimental-features = nix-command
- run: nix-env -iA nix-build-uncached -f nix/

Expand All @@ -38,7 +41,7 @@ jobs:
- name: Calculate performance delta
if: runner.os == 'Linux' && github.event_name == 'pull_request'
run: |
from="$( git merge-base origin/${{ github.base_ref}} HEAD )"
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 \
Expand All @@ -62,8 +65,10 @@ jobs:
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: runner.os == 'Linux' && github.event_name == 'pull_request'
if: 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@v1
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/update-hash.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Update nix hashes

on:
push:
branches-ignore:
- master
- release
tags-ignore:
- '**'

jobs:
update-hash:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
# This is needed to be able to push and trigger CI with that push
token: ${{ secrets.NIV_UPDATER_TOKEN }}
- uses: cachix/install-nix-action@v16
with:
nix_path: nixpkgs=channel:nixos-21.11
- uses: cachix/cachix-action@v10
with:
name: ic-hs-test
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Update drun cargo hash
run: |
cd nix
nix --extra-experimental-features nix-command shell -f . nix-update -c nix-update --version=skip drun
- name: Commit changes
uses: EndBug/[email protected]
with:
author_name: Nix hash updater
author_email: "<[email protected]>"
message: "Updating nix hashes"
# do not pull: if this branch is behind, then we might as well let
# the pushing fail
pull: "NO-PULL"
11 changes: 8 additions & 3 deletions .mergify.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
queue_rules:
- name: default
conditions:
- "#approved-reviews-by>=1"
- "#changes-requested-reviews-by=0"
- status-success=tests (ubuntu-latest)
- status-success=tests (macos-latest)

Expand All @@ -17,9 +19,12 @@ pull_request_rules:
queue:
name: default
method: squash
commit_message: title+body
commit_message_template: |
{{ title }} (#{{ number }})
{{ body }}
delete_head_branch: {}
- name: Automatic closing succesfull trials
- name: Automatically closing successful trials
conditions:
- status-success=tests (ubuntu-latest)
- status-success=tests (macos-latest)
Expand Down Expand Up @@ -52,4 +57,4 @@ pull_request_rules:
actions:
review:
type: APPROVE
message: A change to Changelog.md? I can handle that!
message: A change to `Changelog.md`? I can handle that!
40 changes: 25 additions & 15 deletions Building.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,47 +53,52 @@ For more details on our CI and CI setup, see `CI.md`.

## Making releases

We make frequent releases, at least weekly. The steps to make a release (say, version 0.6.6) are:
We make frequent releases, at least weekly. The steps to make a release (say, version 0.6.17) are:

* Make sure that the top section of `Changelog.md` has a title like

== 0.6.6 (2021-08-01)
## 0.6.17 (2021-12-03)

with today’s date.

* Look at `git log --first-parent 0.6.5..HEAD` and check
* Define a shell variable `export MOC_MINOR=17`

* Look at `git log --first-parent 0.6.$(expr $MOC_MINOR - 1)..HEAD` and check
that everything relevant is mentioned in the changelog section, and possibly
clean it up a bit, curating the information for the target audience.

* `git commit -a -m "Releasing 0.6.6"`
* `git commit -am "Releasing 0.6.$MOC_MINOR"`
* Create a PR from this commit, and label it `automerge-squash`. Mergify will
merge it into master without additional approval, within 2 or 3 minutes.
* `git switch master; git pull`. The release commit should be your `HEAD`
* `git tag 0.6.6 -m "Motoko 0.6.6"`
* `git branch -f release 0.6.6`
* `git push origin release 0.6.6`
* `git tag 0.6.$MOC_MINOR -m "Motoko 0.6.$MOC_MINOR"`
* `git branch -f release 0.6.$MOC_MINOR`
* `git push origin release 0.6.$MOC_MINOR`

The `release` branch should thus always reference the latest release commit.

Pushing the tag should cause Github Actions to create a “Release” on the github
Pushing the tag should cause GitHub Actions to create a “Release” on the github
project. This will fail if the changelog is not in order (in this case, fix and
force-push the tag). It will also fail if the nix cache did not yet contain
the build artifacts for this revision. In this case, restart the Github Action
on Github’s UI.
the build artifacts for this revision. In this case, restart the GitHub Action
on GitHub’s UI.

After releasing the compiler you can update `motoko-base`'s `master`
branch to the `next-moc` branch.

* Wait ca. 5min after releasing to give the CI/CD pipeline time to upload the release artifacts
* Change into `motoko-base`
* `git switch next-moc; git pull`
* `git switch -c username/update-moc-0.6.6`
* Update the `moc_version` env variable in `.github/workflows/ci.yml`
and `.github/workflows/package-set.yml` to the new released version
* `git add .github/ && git commit -m "Motoko 0.6.6"`
* `git switch -c $USER/update-moc-0.6.$MOC_MINOR`
* Update the `moc_version` env variable in `.github/workflows/{ci, package-set}.yml`
to the new released version:
`perl -pi -e "s/moc_version: \"0\.6\.\\d+\"/moc_version: \"0.6.$MOC_MINOR\"/g" .github/workflows/ci.yml .github/workflows/package-set.yml`
* `git add .github/ && git commit -m "Motoko 0.6.$MOC_MINOR"`
* You can `git push` now

Make a PR off of that branch and merge it using a _normal merge_ (not
squash merge) once CI passes
squash merge) once CI passes. It will eventually be imported into this
repo by a scheduled `niv-updater-action`.

## Profile the compiler

Expand All @@ -118,6 +123,11 @@ build system.)
_pass_ it the path to the binary.)


## Benchmarking the RTS

Specifically some advanced techniques to obtain performance deltas for the
GC can be found in `rts/Benchmarking.md`.

## Updating Haskell Packages

When the `.cabal` file of a Haskell package is changed you need to make sure the
Expand Down
Loading

0 comments on commit 1b4a4f7

Please sign in to comment.