ci: merge end-to-end workflow into ci, permits to reduce amount of built
This commit is contained in:
@@ -1,7 +1,5 @@
|
|||||||
name: CI
|
name: CI
|
||||||
|
|
||||||
# IMPORTANT: using Swatinem/rust-cache@v2 : reuse same cache as playwright.yml (minimize non necessary new compilation)
|
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
@@ -42,8 +40,8 @@ jobs:
|
|||||||
- 'Cargo.toml'
|
- 'Cargo.toml'
|
||||||
- 'Cargo.lock'
|
- 'Cargo.lock'
|
||||||
|
|
||||||
frontend-linter:
|
frontend-check:
|
||||||
name: Frontend — CSS and JS checks (format, lint, rules, etc)
|
name: Frontend — CSS and JS checks (format, lint, rules)
|
||||||
needs: changes
|
needs: changes
|
||||||
if: needs.changes.outputs.frontend == 'true'
|
if: needs.changes.outputs.frontend == 'true'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -98,7 +96,7 @@ jobs:
|
|||||||
- run: cargo clippy --all-targets --all-features -- -D warnings
|
- run: cargo clippy --all-targets --all-features -- -D warnings
|
||||||
|
|
||||||
rust-test:
|
rust-test:
|
||||||
name: Tests
|
name: Server Unit and Functionnal Tests
|
||||||
needs: changes
|
needs: changes
|
||||||
if: needs.changes.outputs.backend == 'true'
|
if: needs.changes.outputs.backend == 'true'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -143,11 +141,96 @@ jobs:
|
|||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
build:
|
build:
|
||||||
name: Build Check
|
name: Build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [frontend-linter, rust-fmt, rust-clippy, rust-test]
|
needs: [rust-fmt, rust-clippy, rust-test]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
- uses: dtolnay/rust-toolchain@stable
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
- run: cargo build --release
|
- run: cargo build --release
|
||||||
|
- uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: oxicloud-release
|
||||||
|
path: target/release/oxicloud
|
||||||
|
retention-days: 1
|
||||||
|
|
||||||
|
api-test:
|
||||||
|
name: API tests (via Hurl)
|
||||||
|
needs: build
|
||||||
|
# if: github.event_name == 'pull_request'
|
||||||
|
timeout-minutes: 30
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: oxicloud-release
|
||||||
|
path: target/release/
|
||||||
|
|
||||||
|
- run: chmod +x target/release/oxicloud
|
||||||
|
|
||||||
|
- name: Install Hurl
|
||||||
|
env:
|
||||||
|
HURL_MAJOR: "8"
|
||||||
|
run: |
|
||||||
|
HURL_VERSION=$(curl -fsSL -H "Authorization: Bearer ${{ github.token }}" \
|
||||||
|
https://api.github.com/repos/Orange-OpenSource/hurl/releases \
|
||||||
|
| jq -r "map(select(.tag_name | startswith(\"${HURL_MAJOR}.\"))) | first | .tag_name")
|
||||||
|
curl -fLO "https://github.com/Orange-OpenSource/hurl/releases/download/${HURL_VERSION}/hurl_${HURL_VERSION}_amd64.deb"
|
||||||
|
sudo apt-get install -y "./hurl_${HURL_VERSION}_amd64.deb"
|
||||||
|
|
||||||
|
- name: Run Hurl API tests
|
||||||
|
run: bash tests/api/run.sh
|
||||||
|
env:
|
||||||
|
BUILD_TARGET: release
|
||||||
|
|
||||||
|
- uses: actions/upload-artifact@v4
|
||||||
|
if: ${{ !cancelled() }}
|
||||||
|
with:
|
||||||
|
name: hurl-report
|
||||||
|
path: tests/api/storage/
|
||||||
|
retention-days: 7
|
||||||
|
|
||||||
|
front-test:
|
||||||
|
name: Frontend end-to-end tests (via Playwright)
|
||||||
|
# ensure that api tests are ok before
|
||||||
|
needs: api-test
|
||||||
|
# if: github.event_name == 'pull_request'
|
||||||
|
timeout-minutes: 60
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: oxicloud-release
|
||||||
|
path: target/release/
|
||||||
|
|
||||||
|
- run: chmod +x target/release/oxicloud
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: lts/*
|
||||||
|
|
||||||
|
- name: Install Node dependencies
|
||||||
|
working-directory: tests/e2e
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Install Playwright browsers
|
||||||
|
working-directory: tests/e2e
|
||||||
|
run: npx playwright install --with-deps
|
||||||
|
|
||||||
|
- name: Run Playwright tests (spawns DB via pretest hook)
|
||||||
|
working-directory: tests/e2e
|
||||||
|
run: npm test
|
||||||
|
env:
|
||||||
|
BUILD_TARGET: release
|
||||||
|
|
||||||
|
- uses: actions/upload-artifact@v4
|
||||||
|
if: ${{ !cancelled() }}
|
||||||
|
with:
|
||||||
|
name: playwright-report
|
||||||
|
path: tests/e2e/playwright-report/
|
||||||
|
retention-days: 30
|
||||||
|
|||||||
@@ -1,110 +0,0 @@
|
|||||||
name: Playwright Test (end-to-end)
|
|
||||||
|
|
||||||
# IMPORTANT: using Swatinem/rust-cache@v2 : reuse same cache as ci.yml (minimize non necessary new compilation)
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ main, dev ]
|
|
||||||
pull_request:
|
|
||||||
branches: [ main, dev ]
|
|
||||||
|
|
||||||
#concurrency:
|
|
||||||
# group: rust-build-${{ github.ref }}
|
|
||||||
# cancel-in-progress: false
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
api-test:
|
|
||||||
name: Hurl API tests
|
|
||||||
timeout-minutes: 30
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Install Rust toolchain
|
|
||||||
uses: dtolnay/rust-toolchain@stable
|
|
||||||
|
|
||||||
- name: Cache compiled binary
|
|
||||||
id: binary-cache
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: ${{ github.workspace }}/target/debug/oxicloud
|
|
||||||
key: ${{ runner.os }}-oxicloud-binary-${{ hashFiles('src/**', 'Cargo.toml', 'Cargo.lock') }}
|
|
||||||
|
|
||||||
- name: Cache Rust dependencies
|
|
||||||
if: steps.binary-cache.outputs.cache-hit != 'true'
|
|
||||||
uses: Swatinem/rust-cache@v2
|
|
||||||
|
|
||||||
- name: Build server
|
|
||||||
if: steps.binary-cache.outputs.cache-hit != 'true'
|
|
||||||
run: cargo build
|
|
||||||
|
|
||||||
- name: Install Hurl
|
|
||||||
env:
|
|
||||||
HURL_MAJOR: "8"
|
|
||||||
run: |
|
|
||||||
HURL_VERSION=$(curl -fsSL -H "Authorization: Bearer ${{ github.token }}" \
|
|
||||||
https://api.github.com/repos/Orange-OpenSource/hurl/releases \
|
|
||||||
| jq -r "map(select(.tag_name | startswith(\"${HURL_MAJOR}.\"))) | first | .tag_name")
|
|
||||||
curl -fLO "https://github.com/Orange-OpenSource/hurl/releases/download/${HURL_VERSION}/hurl_${HURL_VERSION}_amd64.deb"
|
|
||||||
sudo apt-get install -y "./hurl_${HURL_VERSION}_amd64.deb"
|
|
||||||
|
|
||||||
- name: Run Hurl API tests
|
|
||||||
run: bash tests/api/run.sh
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
if: ${{ !cancelled() }}
|
|
||||||
with:
|
|
||||||
name: hurl-report
|
|
||||||
path: tests/api/storage/
|
|
||||||
retention-days: 7
|
|
||||||
|
|
||||||
front-test:
|
|
||||||
# starts api-test first
|
|
||||||
needs: api-test
|
|
||||||
timeout-minutes: 60
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Install Rust toolchain
|
|
||||||
uses: dtolnay/rust-toolchain@stable
|
|
||||||
|
|
||||||
- name: Cache compiled binary
|
|
||||||
id: binary-cache
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: ${{ github.workspace }}/target/debug/oxicloud
|
|
||||||
key: ${{ runner.os }}-oxicloud-binary-${{ hashFiles('src/**', 'Cargo.toml', 'Cargo.lock') }}
|
|
||||||
|
|
||||||
- name: Cache Rust dependencies
|
|
||||||
if: steps.binary-cache.outputs.cache-hit != 'true'
|
|
||||||
uses: Swatinem/rust-cache@v2
|
|
||||||
|
|
||||||
- name: Build server
|
|
||||||
if: steps.binary-cache.outputs.cache-hit != 'true'
|
|
||||||
run: cargo build
|
|
||||||
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: lts/*
|
|
||||||
|
|
||||||
- name: Install Node dependencies
|
|
||||||
working-directory: tests/e2e
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Install Playwright browsers
|
|
||||||
working-directory: tests/e2e
|
|
||||||
run: npx playwright install --with-deps
|
|
||||||
|
|
||||||
- name: Run Playwright tests (spawns DB via pretest hook)
|
|
||||||
working-directory: tests/e2e
|
|
||||||
run: npm test
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
if: ${{ !cancelled() }}
|
|
||||||
with:
|
|
||||||
name: playwright-report
|
|
||||||
path: tests/e2e/playwright-report/
|
|
||||||
retention-days: 30
|
|
||||||
|
|
||||||
|
|
||||||
+11
-3
@@ -66,9 +66,17 @@ mkdir -p "$OXICLOUD_STORAGE_PATH"
|
|||||||
|
|
||||||
# ── 3. Start OxiCloud server ──────────────────────────────────────────────────
|
# ── 3. Start OxiCloud server ──────────────────────────────────────────────────
|
||||||
|
|
||||||
log "Building and starting OxiCloud server on port $SERVER_PORT..."
|
BUILD_TARGET="${BUILD_TARGET:-debug}"
|
||||||
cd "$REPO_ROOT"
|
OXICLOUD_BIN="$REPO_ROOT/target/$BUILD_TARGET/oxicloud"
|
||||||
cargo run &
|
|
||||||
|
if [[ -x "$OXICLOUD_BIN" ]]; then
|
||||||
|
log "Starting pre-built OxiCloud server ($BUILD_TARGET) on port $SERVER_PORT..."
|
||||||
|
"$OXICLOUD_BIN" &
|
||||||
|
else
|
||||||
|
log "Building and starting OxiCloud server on port $SERVER_PORT..."
|
||||||
|
cd "$REPO_ROOT"
|
||||||
|
cargo run &
|
||||||
|
fi
|
||||||
SERVER_PID=$!
|
SERVER_PID=$!
|
||||||
log "Waiting for server at $base_url..."
|
log "Waiting for server at $base_url..."
|
||||||
wait_for_http "$base_url/ready" 120
|
wait_for_http "$base_url/ready" 120
|
||||||
|
|||||||
@@ -48,7 +48,9 @@ export default defineConfig({
|
|||||||
],
|
],
|
||||||
|
|
||||||
webServer: {
|
webServer: {
|
||||||
command: process.env.CI ? `${process.env.GITHUB_WORKSPACE}/target/debug/oxicloud` : 'cargo run',
|
command: process.env.BUILD_TARGET
|
||||||
|
? `${process.env.GITHUB_WORKSPACE}/target/${process.env.BUILD_TARGET}/oxicloud`
|
||||||
|
: 'cargo run',
|
||||||
url: 'http://localhost:8087',
|
url: 'http://localhost:8087',
|
||||||
timeout: 600_000,
|
timeout: 600_000,
|
||||||
reuseExistingServer: false,
|
reuseExistingServer: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user