RyanHUNGry activated ci/cd pipeline #7
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: lint, test, build, and deploy containerized dataflow API to ec2 | |
run-name: ${{ github.actor }} activated ci/cd pipeline | |
on: | |
push: | |
branches: [ main ] | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./backend # Only applies to run steps | |
steps: | |
- name: Checkout repository | |
uses: actions/[email protected] | |
- name: Install dependencies | |
run: npm i eslint | |
- name: Run linting script with eslint | |
run: npx eslint . | |
# After linting, containerize application on a test environment and run tests | |
test: | |
needs: lint | |
environment: test | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./backend # Only applies to run steps | |
steps: | |
- name: Checkout repository | |
uses: actions/[email protected] | |
- name: Create image | |
run: docker build -t docker.io/fishy3legs/dataflow-api:1.0 . | |
- name: Start container with proper test environment variables | |
run: docker run -d --name test-container -e AWS_PUBLIC_KEY=${{ secrets.AWS_PUBLIC_KEY }} - AWS_SECRET_KEY=${{ secrets.AWS_SECRET_KEY }} -e AWS_RDS_TEST=${{ secrets.AWS_RDS_TEST }} -e JWT_SECRET=${{ secrets.JWT_SECRET }} docker.io/fishy3legs/dataflow-api:1.0 | |
- name: Run tests with application inside test container | |
run: docker exec test-container npm run integration-tests | |