ci(api-tests): add API test to CI
This commit is contained in:
@@ -6,9 +6,9 @@ on:
|
||||
pull_request:
|
||||
branches: [ "main", "dev" ]
|
||||
|
||||
concurrency:
|
||||
group: rust-build-${{ github.ref }}
|
||||
cancel-in-progress: false
|
||||
#concurrency:
|
||||
# group: rust-build-${{ github.ref }}
|
||||
# cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
build-and-test:
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
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
|
||||
|
||||
|
||||
@@ -1,61 +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:
|
||||
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
|
||||
Reference in New Issue
Block a user