Skip to content

Commit

Permalink
#216 fix build
Browse files Browse the repository at this point in the history
#216 e2e build

lockfile

Update pnpm version

Fix install command

Fix test

linear tests

Artifact folder

Update readme docs, remove e2e_tests folder

Pass front-end URL in ENV for e2e

Rename task=

Update playwright, fix test, fix readme

Improve error handling versions / history

try split action cache

fix order

Checkout

cache order

Fix build

fix cache

Update rust cache

build artifacts

build artifact path

Build js

install pnpm

Moar cache

Fix pnpm install

Fix e2e test artifacts

cache fix

Fix raycast URL #637

Run e2e

Fix init script

init

Fix e2e upload test

Fix e2e snapshot linux
  • Loading branch information
joepio committed Jul 26, 2023
1 parent cf84134 commit 2b11f4d
Show file tree
Hide file tree
Showing 31 changed files with 237 additions and 1,077 deletions.
File renamed without changes.
194 changes: 106 additions & 88 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,121 +2,131 @@ on: [push, workflow_dispatch]

name: "Build, test, clippy"
jobs:
check:
name: Check
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt
- name: Rust Cache
uses: Swatinem/rust-cache@v1.3.0
uses: Swatinem/rust-cache@v2
- uses: actions-rs/cargo@v1
with:
command: check
command: fmt
args: --all -- --check

test:
name: Test Suite
build_js:
name: Build JS assets
runs-on: ubuntu-latest
steps:
- run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev
- uses: actions/checkout@v2
- uses: taiki-e/install-action@nextest
- uses: actions-rs/toolchain@v1

- uses: pnpm/[email protected]
name: Install pnpm
id: pnpm-install
with:
profile: minimal
toolchain: stable
override: true
- name: Rust Cache
uses: Swatinem/[email protected]
- uses: actions-rs/cargo@v1
version: 8
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
- uses: actions/cache@v3
name: Setup pnpm cache
with:
command: nextest
args: run --all-features --retries 3
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install JS deps
working-directory: ./browser/
run: |
pnpm install
pnpm run playwright-install
- name: Lint JS
working-directory: ./browser/
run: |
pnpm run lint
- name: Test JS (no e2e)
working-directory: ./browser/
run: |
pnpm run test
coverage:
name: Code coverage
- name: Build JS
working-directory: ./browser/
run: |
pnpm run build
- name: Save JS Build Artifacts
uses: actions/upload-artifact@v3
with:
name: build-artifact
path: ./browser/data-browser/dist
e2e:
name: End-to-end tests
runs-on: ubuntu-latest
needs: [build_js]
steps:
- run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev
- uses: actions/checkout@v2
- name: Install Rust and llvm-tools-preview
run: rustup component add llvm-tools-preview --toolchain stable-x86_64-unknown-linux-gnu
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate code coverage
run: cargo llvm-cov --all-features --workspace --lcov --locked --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
- uses: actions/checkout@v3
- name: Download JS Build Artifact
uses: actions/download-artifact@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
fail_ci_if_error: true
name: build-artifact
path: ./browser/data-browser/dist

fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: clippy

- name: Rust Cache
uses: Swatinem/[email protected]
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
uses: Swatinem/rust-cache@v2
with:
command: fmt
args: --all -- --check
cache-on-failure: true
cache-all-crates: true

clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
- uses: actions-rs/cargo@v1
name: cargo build
with:
profile: minimal
toolchain: stable
override: true
- name: Rust Cache
uses: Swatinem/[email protected]
- run: rustup component add clippy
command: build
args: --locked

- uses: actions-rs/cargo@v1
name: cargo clippy
with:
command: clippy
args: --no-deps

e2e:
name: End-to-end tests
runs-on: ubuntu-latest
steps:
- run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev
- uses: taiki-e/install-action@nextest
- uses: actions-rs/cargo@v1
name: cargo nextest run
with:
command: nextest
args: run --all-features --retries 3

- uses: pnpm/[email protected]
name: Install pnpm
id: pnpm-install
with:
version: 7
version: 8
run_install: false

- name: Get pnpm store directory
Expand All @@ -132,28 +142,36 @@ jobs:
restore-keys: |
${{ runner.os }}-pnpm-store-
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Rust Cache
uses: Swatinem/[email protected]
- uses: actions-rs/cargo@v1
with:
command: build
args: --locked
- run: nohup ./target/debug/atomic-server &
- name: Setup and run end-to-end tests
working-directory: ./server/e2e_tests/
- name: Install Playwright
working-directory: ./browser/
run: |
pnpm install
pnpm run install-playwright
pnpm run test
pnpm run playwright-install
- name: Run atomic-server in the background
run: nohup ./target/debug/atomic-server --initialize &

- name: Run end-to-end tests
working-directory: ./browser/
env:
FRONTEND_URL: http://localhost:9883
run: pnpm run test-e2e

# Coverage
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate code coverage
run: cargo llvm-cov --all-features --workspace --lcov --locked --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
fail_ci_if_error: true

- name: Upload test artifacts
uses: actions/upload-artifact@v3
if: failure()
with:
name: test-results
path: ./server/e2e_tests/test-results/
path: ./browser/data-browser/test-results/
6 changes: 3 additions & 3 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@
},
{
"type": "npm",
"script": "test",
"script": "test-e2e",
"problemMatcher": [
"$tsc-watch"
],
"label": "test data-browser",
"label": "test data-browser e2e",
"path": "browser",
"detail": "pnpm test",
"detail": "pnpm test-e2e",
"isBackground": true,
"group": "test"
},
Expand Down
2 changes: 1 addition & 1 deletion .vscode/tsdoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
name: Install pnpm
id: pnpm-install
with:
version: 7
version: 8
run_install: false

- name: Get pnpm store directory
Expand Down
56 changes: 51 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,15 @@

**Create, share, fetch and model [Atomic Data](https://docs.atomicdata.dev)!
AtomicServer is a lightweight, yet powerful CMS / Graph Database.
Demo on [atomicdata.dev](https://atomicdata.dev)
This repo also includes the [`atomic_lib`](lib/README.md) Rust library and [`atomic-cli`](cli/README.md).**
Demo on [atomicdata.dev](https://atomicdata.dev)**

This repo also includes:

- [Atomic Data Browser](/browser/data-browser/README.md), the React front-end for Atomic-Server.
- [`@tomic/lib`](/browser/lib/README.md) JS NPM library.
- [`@tomic/react`](/browser/react/README.md) React NPM library.
- [`atomic_lib`](lib/README.md) Rust library.
- [`atomic-cli`](cli/README.md) terminal client.

_Status: alpha. [Breaking changes](CHANGELOG.md) are expected until 1.0._

Expand Down Expand Up @@ -64,11 +71,14 @@ https://user-images.githubusercontent.com/2183313/139728539-d69b899f-6f9b-44cb-a
- [Items are missing in my Collections / Search results](#items-are-missing-in-my-collections--search-results)
- [I get a `failed to retrieve` error when opening](#i-get-a-failed-to-retrieve-error-when-opening)
- [Can I embed AtomicServer in another application?](#can-i-embed-atomicserver-in-another-application)
- [I want to use my own authorization. How do I do that?](#i-want-to-use-my-own-authorization-how-do-i-do-that)
- [I want to use my own authorization. How do I do that?](#i-want-to-use-my-own-authorization-how-do-i-do-that)
- [Where is my data stored on my machine?](#where-is-my-data-stored-on-my-machine)
- [Also in this Repo](#also-in-this-repo)
- [`atomic-cli`](#atomic-cli)
- [`atomic-lib`](#atomic-lib)
- [Atomic Data Browser](#atomic-data-browser)
- [`@tomic/lib`](#tomiclib)
- [`@tomic/react`](#tomicreact)
- [Also check out](#also-check-out)
- [Contribute](#contribute)

Expand Down Expand Up @@ -341,7 +351,7 @@ Try re-initializing atomic server `atomic-server --initialize`.
Yes. This is what I'm doing with the Tauri desktop distribution of AtomicServer.
Check out the [`desktop`](https://github.com/atomicdata-dev/atomic-server/tree/master/desktop) code for an example!

## I want to use my own authorization. How do I do that?
### I want to use my own authorization. How do I do that?

You can disable all authorization using `--public-mode`.
Make sure AtomicServer is not publicly accessible, because this will allow anyone to read any data.
Expand Down Expand Up @@ -372,11 +382,47 @@ Powers both `atomic-cli` and `atomic-server`.

[→ Read more](lib/README.md)

### [Atomic Data Browser](/browser/data-browser/README.md)

Front-end for Atomic-Server, built with React.

### [`@tomic/lib`](/browser/lib/README.md)

<a href="https://www.npmjs.com/package\/@tomic/lib" target="_blank">
<img src="https://img.shields.io/npm/v/@tomic/lib?color=cc3534" />
</a>
<a href="https://www.npmjs.com/package/@tomic/lib" target="_blank">
<img src="https://img.shields.io/npm/dm/@tomic/lib?color=%2344cc10" />
</a>
<a href="https://bundlephobia.com/result?p=@tomic/lib" target="_blank">
<img src="https://img.shields.io/bundlephobia/min/@tomic/lib">
</a>

Library with `Store`, `Commit`, `JSON-AD` parsing, and more.

[**docs**](https://atomicdata-dev.github.io/atomic-data-browser/docs/modules/_tomic_lib.html)

### [`@tomic/react`](browser/react/README.md)

<a href="https://www.npmjs.com/package/@tomic/react" target="_blank">
<img src="https://img.shields.io/npm/v/@tomic/react?color=cc3534" />
</a>
<a href="https://www.npmjs.com/package/@tomic/react" target="_blank">
<img src="https://img.shields.io/npm/dm/@tomic/react?color=%2344cc10" />
</a>
<a href="https://bundlephobia.com/result?p=@tomic/react" target="_blank">
<img src="https://img.shields.io/bundlephobia/min/@tomic/react">
</a>

React library with many useful hooks for rendering and editing Atomic Data.

[**docs**](https://atomicdata-dev.github.io/atomic-data-browser/docs/modules/_tomic_react.html)

## Also check out

- [Atomic-Data-Browser](https://github.com/atomicdata-dev/atomic-data-browser), an in-browser app for viewing and editing atomic data. Also contains a typescript / react front-end library. Will replace most of the html templating in this project.
- [The Docs](https://github.com/ontola/atomic-data-docs), a book containing detailed documentation of Atomic Data.
- [RayCast extension](https://www.raycast.com/atomicdata-dev/atomic-data-browser) for searching stuff
- [RayCast extension](https://www.raycast.com/joepio/atomic) for searching stuff
- [Newsletter](http://eepurl.com/hHcRA1)
- [Discord][discord-url]

Expand Down
2 changes: 1 addition & 1 deletion browser/.github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
name: Install pnpm
id: pnpm-install
with:
version: 7
version: 8
run_install: false

- name: Get pnpm store directory
Expand Down
4 changes: 0 additions & 4 deletions browser/.vscode/tasks.json

This file was deleted.

Loading

0 comments on commit 2b11f4d

Please sign in to comment.