CI: deploy to gh-pages (#2)
This commit is contained in:
parent
056471c0eb
commit
0377efebed
9 changed files with 5939 additions and 5 deletions
30
.github/workflows/ci.yml
vendored
30
.github/workflows/ci.yml
vendored
|
@ -10,11 +10,33 @@ env:
|
||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: build
|
- name: install wasm-pack
|
||||||
run: cargo build --verbose
|
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
||||||
|
- name: check
|
||||||
|
run: cargo check
|
||||||
- name: test
|
- name: test
|
||||||
run: cargo test --verbose
|
run: wasm-pack test --node
|
||||||
|
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: test
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: install wasm-pack
|
||||||
|
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
||||||
|
- name: build
|
||||||
|
run: |
|
||||||
|
wasm-pack build
|
||||||
|
cd www
|
||||||
|
npm install
|
||||||
|
npm run build
|
||||||
|
- name: deploy
|
||||||
|
uses: peaceiris/actions-gh-pages@v3
|
||||||
|
if: github.ref == 'refs/heads/main'
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
publish_dir: www/dist
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "gpx-web-utils"
|
name = "gpx-web-utils"
|
||||||
version = "0.1.0"
|
version = "0.0.1"
|
||||||
authors = ["Matthew Dillon <matthewrdillon@gmail.com>"]
|
authors = ["Matthew Dillon <matthewrdillon@gmail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
|
2
www/.gitignore
vendored
Normal file
2
www/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
node_modules
|
||||||
|
dist
|
5
www/bootstrap.js
vendored
Normal file
5
www/bootstrap.js
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
// A dependency graph that contains any wasm must all be imported
|
||||||
|
// asynchronously. This `bootstrap.js` file does the single async import, so
|
||||||
|
// that no one else needs to worry about it again.
|
||||||
|
import("./index.js")
|
||||||
|
.catch(e => console.error("Error importing `index.js`:", e));
|
11
www/index.html
Normal file
11
www/index.html
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>gpx web utils</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<noscript>This page contains webassembly and javascript content, please enable javascript in your browser.</noscript>
|
||||||
|
<script src="./bootstrap.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
3
www/index.js
Normal file
3
www/index.js
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
import * as wasm from "gpx-web-utils";
|
||||||
|
|
||||||
|
wasm.greet();
|
5842
www/package-lock.json
generated
Normal file
5842
www/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
35
www/package.json
Normal file
35
www/package.json
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
{
|
||||||
|
"name": "gpx-web-utils",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"description": "just some gpx-related tools that i want to use.",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"build": "webpack --config webpack.config.js",
|
||||||
|
"start": "webpack-dev-server"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/thermokarst/gpx-web-utils.git"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"webassembly",
|
||||||
|
"wasm",
|
||||||
|
"rust",
|
||||||
|
"webpack"
|
||||||
|
],
|
||||||
|
"author": "Matthew Ryan Dillon <matthewrdillon@gmail.com>",
|
||||||
|
"license": "MIT",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/thermokarst/gpx-web-utils/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/thermokarst/gpx-web-util#readme",
|
||||||
|
"dependencies": {
|
||||||
|
"gpx-web-utils": "file:../pkg"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"webpack": "^4.29.3",
|
||||||
|
"webpack-cli": "^3.1.0",
|
||||||
|
"webpack-dev-server": "^3.1.5",
|
||||||
|
"copy-webpack-plugin": "^5.0.0"
|
||||||
|
}
|
||||||
|
}
|
14
www/webpack.config.js
Normal file
14
www/webpack.config.js
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
const CopyWebpackPlugin = require("copy-webpack-plugin");
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
entry: "./bootstrap.js",
|
||||||
|
output: {
|
||||||
|
path: path.resolve(__dirname, "dist"),
|
||||||
|
filename: "bootstrap.js",
|
||||||
|
},
|
||||||
|
mode: "development",
|
||||||
|
plugins: [
|
||||||
|
new CopyWebpackPlugin(['index.html'])
|
||||||
|
],
|
||||||
|
};
|
Loading…
Add table
Reference in a new issue