Check package setup on real project #21
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: Check package setup on real project | |
on: | |
schedule: | |
- cron: '0 0 * * 0' | |
workflow_dispatch: | |
jobs: | |
test-setup: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: repository | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Setup test project | |
run: | | |
npx --yes create-adonisjs --kit web --auth-guard session --db sqlite app | |
- name: Install package | |
run: npm install adonisjsx | |
working-directory: ./app | |
- name: Configure package | |
run: node ace configure adonisjsx | |
working-directory: ./app | |
- name: Setup app code | |
run: | | |
cp -f repository/.github/stubs/tsconfig.stub app/tsconfig.json | |
cp -f repository/.github/stubs/routes.stub app/start/routes.ts | |
- uses: JarvusInnovations/background-action@v1 | |
name: Setup test server | |
with: | |
run: npm run dev | |
wait-on: | | |
http://localhost:3333 | |
wait-for: 2m | |
log-output-if: failure | |
working-directory: app | |
- name: Check if app responds | |
run: | | |
response=$(curl -o /dev/null -s -w "%{http_code}\n" -X GET http://localhost:3333) | |
if [ "$response" -eq 200 ]; then | |
echo "Success!" | |
exit 0 | |
else | |
echo "Failed with status $response." | |
exit 1 | |
fi |