feat: init API system with new crate metassr-api-handler with only GET & POST support for javascript
#126
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Integration Test | |
| on: | |
| push: | |
| branches: ["master"] | |
| pull_request: | |
| branches: ["master"] | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| test: | |
| name: Test | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| steps: | |
| - name: Check out the repo | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install MetaCall Unix (Debug) | |
| if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' | |
| run: curl -sL https://raw.githubusercontent.com/metacall/install/master/install.sh | sh -s -- --debug | |
| - name: Install MetaCall Windows | |
| if: matrix.os == 'windows-latest' | |
| run: powershell -NoProfile -ExecutionPolicy Unrestricted -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; &([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://raw.githubusercontent.com/metacall/install/master/install.ps1')))" | |
| - name: Install Rust | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| override: true | |
| - name: Build | |
| run: cargo build | |
| - name: Integration Testing | |
| working-directory: ./tests/web-app | |
| shell: bash | |
| env: | |
| npm_config_script_shell: bash | |
| run: | | |
| npm install | |
| npm run build:debug | |
| npm run start:debug & | |
| sleep 10 | |
| response=$(curl --write-out "%{http_code}" --silent --output /dev/null http://localhost:8080) | |
| if [ "$response" -ne 200 ]; then | |
| echo "Server did not respond with status 200" | |
| exit 1 | |
| fi | |
| exit 0 | |
| # TODO: Improve testing by checking if resulting HTML is correct | |
| # - name: Install Playwright | |
| # run: npm install -g playwright | |
| # - name: Run Playwright test | |
| # run: | | |
| # node -e " | |
| # const { chromium } = require('playwright'); | |
| # (async () => { | |
| # const browser = await chromium.launch(); | |
| # const page = await browser.newPage(); | |
| # await page.goto('http://localhost:3000'); | |
| # const html = await page.content(); | |
| # if (!html.includes('<title>My Node App</title>')) { | |
| # console.error('HTML content did not match expected value'); | |
| # process.exit(1); | |
| # } | |
| # await browser.close(); | |
| # })(); | |
| # " |