add ci for example #8
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: Docker Actions | |
on: | |
push: | |
paths: | |
- '**.js' | |
- '**.json' | |
- '**.yml' | |
branches: | |
- main | |
jobs: | |
setup-and-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Docker Compose | |
run: | | |
sudo rm /usr/local/bin/docker-compose | |
curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /tmp/docker-compose | |
chmod +x /tmp/docker-compose | |
sudo mv /tmp/docker-compose /usr/local/bin/docker-compose | |
- name: Start localstack | |
run: docker-compose up -d mongodb | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Restore dependencies | |
run: | | |
cd ./app | |
npm ci | |
- name: Run tests | |
run: | | |
cd ./test-runner | |
npm test | |
- name: Run tests | |
run: | | |
cd ./app | |
npm test | |
- name: Clean up | |
run: docker-compose down --volumes |