Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate IOGX #44

Merged
merged 26 commits into from
Aug 30, 2023
Merged
41 changes: 24 additions & 17 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ on:
jobs:
publish:
runs-on: ubuntu-latest
strategy:
matrix:
image: [marlowe-playground-server, marlowe-playground-client]
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -32,23 +29,33 @@ jobs:

- name: Build image and copy to local Docker registry
run: |
nix develop --command std //marlowe-playground/oci-images/${{ matrix.image }}:load
nix build .#oci-images.x86_64-linux.all.copyToDockerDaemon
shlevy marked this conversation as resolved.
Show resolved Hide resolved
./result/bin/copy-to-docker-daemon

- name: Authenticate with container registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: Tag and push images
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
TAG=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Use Docker `latest` tag convention
[ "$TAG" == "main" ] && TAG=latest
# Use date + short hash for production releases
[ "$TAG" == "production" ] && TAG="$(date +'%Y-%m-%d')-$(git rev-parse --short "${{ github.ref }}")"
echo IMAGE_ID=$IMAGE_ID
echo TAG=$TAG
docker tag ${{ matrix.image }} $IMAGE_ID:$TAG
docker push $IMAGE_ID:$TAG
tagAndPush() {
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$1
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
TAG=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "runtime@v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && TAG=$(echo $TAG | sed -e 's/^runtime@v//')

# Use Docker `latest` tag convention
[ "$TAG" == "main" ] && TAG=latest

# Use date + short hash for production releases
[ "$TAG" == "production" ] && TAG="$(date +'%Y-%m-%d')-$(git rev-parse --short "${{ github.ref }}")"

echo IMAGE_ID=$IMAGE_ID
echo TAG=$TAG
docker tag $1:latest $IMAGE_ID:$TAG
docker push $IMAGE_ID:$TAG
}
tagAndPush "marlowe-playground-server"
tagAndPush "marlowe-playground-client"
16 changes: 9 additions & 7 deletions CONTRIBUTING.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ Please do make use of this, since problems due to mismatched versions of tools a

The shell comes with some tools for fixing various simple problems that the CI will complain about. Specifically:

- `fix-nixfmt` will re-format nix files
- `fix-prettier` will re-format JS, CSS and HTML files.
- `fix-stylish-haskell` will re-format all the Haskell sources correctly.
- `fix-purs-tidy` will re-format all the Purescript sources correctly.
- `fix-png-optimization` will optimize all PNGs in the repository.

If you're not inside the nix shell all the time and you want to run one of these, you can use `nix run .#fix-purs-tidy` instead.
For example you can run the formatters via `pre-commit`, like so:

```
pre-commit run shellcheck
pre-commit run stylish-haskell
pre-commit run nixpkgs-fmt
pre-commit run prettier
pre-commit run purs-tidy
```

=== How to build the code during development

Expand Down
23 changes: 5 additions & 18 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -73,24 +73,11 @@ If you use Nix, these tools are provided for you via `shell.nix`, and you do *no
* If you want to build our Haskell packages with https://haskellstack.org/[`stack`], then install it.

[[building-with-nix]]
==== Using Std

This project is managed by https://github.com/divnix/std[`std`]. It provides a
CLI and TUI for navigating all buildable artifacts in the project. To use it,
you must enter the project dev shell. You can do this by running the command
`nix develop` from the repo root, or if you are a direnv user, run `direnv
allow` in the repo root and direnv will automatically load the dev shell for
you when you `cd` into the repo and refresh it when it changes.

Upon entering the dev shell, you will be shown a MOD (message of the day) that
lists the available commands. You can also launch the std TUI with the `std`
command. It will display a navigable menu of all build actions defined for this
project. You can invoke any of the commands from the TUI, or directly using the
`std` CLI. For instance, to build the `marlowe-playground-server`, run the
command `std //marlowe-playground/packages/marlowe-playground-server:build`.

You can get tab-completion for the `std` CLI by running the command
`source <(std _carapace)`.
==== Using Nix

Run `nix develop` to enter the shell.

From there, you can type `info` to get a list of available commands.

==== How to build the Haskell packages with `cabal`

Expand Down
Loading