Update Windows script #94
Workflow file for this run
This file contains 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: CI | |
on: | |
push: | |
pull_request: | |
branches: | |
- main | |
paths: | |
- '.github/workflows/ci.yml' | |
- 'src/**' | |
- 'run.sh' | |
env: | |
APP_NAME: ${{ vars.APP_NAME }} | |
TEST_ENDPOINT: 'http://localhost:${{ vars.APP_HOST_PORT }}${{ vars.TEST_ROUTE }}' | |
jobs: | |
build-and-test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
steps: | |
- name: Set up build and runtime deps (Ubuntu) | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y docker-compose | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Run ${{ env.APP_NAME }} with Docker Compose (Ubuntu) | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
chmod +x run.sh | |
./run.sh | |
- name: Run ${{ env.APP_NAME }} with Docker Compose (Windows) | |
if: matrix.os == 'windows-latest' | |
run: | | |
.\run.ps1 | |
- name: Run basic test (workshop scenario, Ubuntu) | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
RESPONSE_CODE=$(curl -s -o /dev/null -w "%{http_code}" ${{ env.TEST_ENDPOINT }}) | |
if [ $RESPONSE_CODE -eq 200 ]; then | |
echo "Basic health check PASSED!" | |
else | |
echo " Basic health check FAILED!" | |
exit 1 | |
fi | |
- name: Run basic test (workshop scenario, Windows) | |
if: matrix.os == 'windows-latest' | |
run: | | |
$RESPONSE_CODE = (Invoke-WebRequest -Uri ${{ env.TEST_ENDPOINT }}).StatusCode | |
if ($RESPONSE_CODE -eq 200) { | |
Write-Output "Basic health check PASSED!" | |
} else { | |
Write-Output "Basic health check FAILED!" | |
exit 1 | |
} | |
- name: Tear down Docker Compose | |
run: | | |
docker-compose -f docker-compose.yml down | |
- name: Run unit/integration tests | |
run: | | |
npm ci | |
npm run test | |
- name: Report coverage to Coveralls | |
if: matrix.os == 'ubuntu-latest' | |
uses: coverallsapp/github-action@v2 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
path-to-lcov: ./coverage/lcov.info |