Add examples-based integration tests #153
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: Check and Test Platform | |
on: | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
# this cancels workflows currently in progress if you start a new one | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
strategy: | |
matrix: | |
os: [ubuntu-24.04, macos-14] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: DeterminateSystems/nix-installer-action@main | |
- uses: DeterminateSystems/magic-nix-cache-action@main | |
- name: prepare nix environment | |
run: nix develop --command zig version | |
- name: run host tests | |
run: nix develop --command zig build test | |
- name: run integration tests | |
run: nix develop --command zig build integration-test | |
build-and-release: | |
runs-on: [ubuntu-24.04] | |
needs: test | |
permissions: | |
contents: write # Used to reate release and upload library | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: DeterminateSystems/nix-installer-action@main | |
- uses: DeterminateSystems/magic-nix-cache-action@main | |
- name: prepare nix environment | |
run: nix develop --command echo done! | |
- name: build host | |
run: nix develop --command zig build -Dtype=release | |
- name: build site | |
run: nix develop --command zig build -Dtype=site | |
- name: type-check platform code | |
run: nix develop --command roc check platform/main.roc | |
- name: run platform tests | |
run: nix develop --command roc test platform/main.roc | |
- name: test example code | |
run: nix develop --command ./examples/blog/build.roc --linker=legacy prod /tmp/output | |
- name: Upload binaries to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
file: 'zig-out/*.tar.br' | |
tag: 'nightly-${{ github.run_number }}' | |
release_name: 'nightly' | |
file_glob: true | |
prerelease: true | |
overwrite: true | |
body: 'An automatic test release of the latest changes on the main branch.' | |
target_commit: ${{ github.ref }} | |
- name: Upload site documentation | |
id: deployment | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: zig-out/site/jay-output | |
deploy-site: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-24.04 | |
needs: build-and-release | |
permissions: | |
pages: write | |
id-token: write | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |