Disable wasm-opt stuff temporarily to get CI working #123
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: CI | |
on: | |
push: | |
branches: | |
- main | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: wasm32-unknown-unknown, x86_64-unknown-linux-gnu | |
toolchain: nightly | |
- name: Install Trunk | |
uses: jetli/[email protected] | |
with: | |
version: 'latest' | |
# - name: Install wasm-opt | |
# run: "curl -L -o binaryen.tar.gz https://github.com/WebAssembly/binaryen/releases/download/version_119/binaryen-version_119-x86_64-linux.tar.gz && tar -xzvf ./binaryen.tar.gz" | |
- name: Install cargo-leptos | |
run: curl --proto '=https' --tlsv1.2 -LsSf https://leptos-rs.artifacts.axodotdev.host/cargo-leptos/v0.2.21/cargo-leptos-installer.sh | sh | |
- name: Build backend | |
run: cargo leptos build --release | |
# - name: Optimise backend wasm | |
# run: "./binaryen-version_119/bin/wasm-opt -Oz -o target/site/pkg/backend.wasm target/site/pkg/backend.wasm" | |
- name: Build frontend | |
run: "cd frontend && trunk build --release" | |
# - name: Optimise wasm | |
# run: "cd frontend/dist && ../../binaryen-version_119/bin/wasm-opt -Oz -o $(ls frontend*.wasm) $(ls frontend*.wasm)" | |
- name: Stop currently-running backend | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
key: ${{ secrets.SERVER_SSH_KEY }} | |
script: | | |
sudo /usr/bin/systemctl stop itsjunetime.service | |
rm /home/junkie/server_files/frontend* 2>/dev/null || : | |
- name: SCP files | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
key: ${{ secrets.SERVER_SSH_KEY }} | |
source: "target/production/backend,frontend/dist/*,target/site/pkg/*" | |
target: /home/junkie/server_files/ | |
strip_components: 2 | |
overwrite: true | |
- name: Restart server | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
key: ${{ secrets.SERVER_SSH_KEY }} | |
script: | | |
sudo /usr/bin/systemctl daemon-reload | |
sudo /usr/bin/systemctl start itsjunetime.service | |
sudo /usr/sbin/nginx -s reload |