generated from tweag/project
-
Notifications
You must be signed in to change notification settings - Fork 33
129 lines (104 loc) · 4.4 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
on:
push:
branches: main
pull_request:
branches: main
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Install Nix
uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixpkgs-unstable
- name: Set up Nix cache
uses: cachix/cachix-action@v12
with:
name: tweag-topiary
authToken: "${{ secrets.CACHIX_TWEAG_TOPIARY_AUTH_TOKEN }}"
- name: Set up frontend cache
uses: actions/cache@v4
with:
path: |
**/node_modules
~/.cache/puppeteer
key: frontend_${{ matrix.os }}_${{ hashFiles('**/package-lock.json') }}
- name: Clippy, test, and benchmark
if: matrix.os == 'ubuntu-latest'
run: export GC_DONT_GC=1; nix -L flake check
- name: Build and test executable
run: 'echo \{ \"foo\": \"bar\" \} | nix run . -- fmt -l json'
- name: Build the topiary-cli and test those tests that cannot be performed in Nix
run: nix develop --command bash -c "cargo test -p topiary-cli -F experimental"
- name: Build client-app example
run: nix build .#client-app
- name: Verify that usage in README.md matches CLI output
run: nix run .#verify-documented-usage
- name: Build web playground Wasm app
if: success() && matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/playground'
run: nix build .#topiary-playground
- name: Copy web playground Wasm app into playground frontend
if: success() && matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/playground'
run: |
mkdir -p web-playground/src/wasm-app
cp -r result/* web-playground/src/wasm-app/
- name: Move sample input and queries into playground frontend
if: success() && matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/playground'
run: |
mkdir -p web-playground/src/samples
mv web-playground/src/wasm-app/languages_export.ts web-playground/src/samples/
- name: Install web playground frontend dependencies
if: success() && matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/playground'
run: npm install --prefix web-playground
- name: Start web playground frontend
if: success() && matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/playground'
run: |
npm run dev --prefix web-playground &
# Loop until there's a response
while [[ "$(curl --silent --output /dev/null --write-out "%{http_code}" http://localhost:5173/playground)" != "200" ]]; do
sleep 2
done
- name: Test web playground frontend
if: success() && matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/playground'
run: npm run e2e --prefix web-playground
- name: Make web playground frontend release build
if: success() && matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/playground'
run: npm run build --prefix web-playground
- name: Copy playground into website
if: success() && matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/playground'
run: |
rm -rf website/playground
cp -r web-playground/dist website/playground
- name: Upload GitHub Pages artifact
uses: actions/[email protected]
if: success() && matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/playground'
with:
path: 'website'
build-windows:
# Note: GitHub's Windows runners have a Rust toolchain installed
# https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run test suite
run: cargo test --all-features
deploy:
needs: build
if: github.ref == 'refs/heads/playground'
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4