diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e56e15b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,83 @@ +name: CI + +on: [push, pull_request] + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@master + + - name: Install latest stable Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + default: true + override: true + + - name: Install minimal stable with clippy and rustfmt + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + components: rustfmt, clippy + + - name: Run rustfmt + uses: actions-rs/cargo@v1 + with: + command: fmt + args: -- --check + + - name: Run clippy + uses: actions-rs/cargo@v1 + with: + command: clippy + + - name: Run test + uses: actions-rs/cargo@v1 + with: + command: test + args: --all-features + + build-wasm: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Install + run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh + + - name: Build + run: wasm-pack build -t web -d ./wasm/dist --out-name orgize ./wasm/ + + - uses: actions/upload-artifact@master + with: + name: page + path: ./wasm + if-no-files-found: error + + deploy: + if: github.ref == 'refs/heads/v0.10' + runs-on: ubuntu-latest + needs: build-wasm + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + steps: + - uses: actions/download-artifact@master + with: + name: page + path: . + + - uses: actions/configure-pages@v1 + + - uses: actions/upload-pages-artifact@v1 + with: + path: . + + - id: deployment + uses: actions/deploy-pages@main diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml deleted file mode 100644 index 0901545..0000000 --- a/.github/workflows/gh-pages.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Github Pages - -on: [push] - -jobs: - test: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Install - run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh - - - name: Build - run: wasm-pack build -t web -d ./wasm/dist --out-name orgize ./wasm/ - - - name: Deploy - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./wasm diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml deleted file mode 100644 index d383ad2..0000000 --- a/.github/workflows/rust.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Rust - -on: [push, pull_request] - -jobs: - format: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Run rustfmt - run: cargo fmt -- --check - - test: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - profile: minimal - override: true - - - name: Cache target/ - uses: actions/cache@v1 - with: - path: target - key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} - - - name: Run Test - run: cargo test --all-features