verify-templates #1714
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: verify-templates | |
on: | |
push: | |
pull_request: | |
schedule: | |
- cron: '0 14 * * *' | |
jobs: | |
build: | |
name: Test generated project | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
db: [mongo, mysql, postgres] | |
frontend: [angular, vue, react] | |
steps: | |
- name: Checkout project | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- name: Generate application | |
run: go run main.go init --db ${{ matrix.db }} --frontend ${{ matrix.frontend }} app | |
- name: Start the application | |
run: cd app && docker-compose up -d | |
- name: Check availability of backend | |
run: timeout 60 bash -c 'until curl -s localhost:8080/api/technologies | grep Go > /dev/null; do sleep 1; done' | |
- name: Check availability of frontend | |
run: | | |
npm i puppeteer | |
cat > index.js << EOF | |
const puppeteer = require('puppeteer'); | |
(async () => { | |
try { | |
const browser = await puppeteer.launch({headless: "new"}); | |
const page = await browser.newPage(); | |
await page.goto('http://localhost:8080'); | |
page.on('console', (message) => { | |
console.log('Console ' + message.type().toUpperCase() + ': ' + message.text()); | |
}); | |
await page.waitForSelector('.technologies', { timeout: 60000 }); | |
const content = await page.content(); | |
console.log(content); | |
await browser.close(); | |
} catch (error) { | |
console.error('Error:', error); | |
throw error; | |
} | |
})(); | |
EOF | |
node index.js | |
- name: Stop application | |
run: cd app && docker-compose down | |
if: always() |