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: Run Tests (and deploy to staging if not a pull request) | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
run-tests: | |
runs-on: [ubuntu-latest] | |
steps: | |
- name: checkout repo | |
uses: actions/[email protected] | |
- name: build and test | |
run: | | |
cd ops/testing | |
DOCKER_BUILDKIT=1 COMPOSE_DOCKER_CLI_BUILD=1 docker-compose build --parallel --pull | |
docker-compose up -d | |
docker-compose exec -T api_test dotnet test api-tests | |
docker-compose exec -T web_test npm run test | |
docker-compose exec -T web_test npm run lint -- --max-warnings 0 | |
docker-compose down | |
deploy-staging: | |
runs-on: [self-hosted, primary] | |
needs: [run-tests] | |
if: github.event_name != 'pull_request' | |
steps: | |
- name: checkout repo | |
uses: actions/checkout@v2 | |
- name: Update secrets in .env | |
run: | | |
cd ops/staging | |
touch .env | |
echo "STRIPE_SECRET_KEY=${{secrets.STRIPE__SECRETKEY}}" > .env | |
echo "STRIPE_WEBHOOK_SECRET=${{secrets.WEBHOOK_SECRET}}" >> .env | |
cat .env | |
- name: update staging containers | |
run: | | |
cd ops/staging | |
DOCKER_BUILDKIT=1 COMPOSE_DOCKER_CLI_BUILD=1 docker-compose build --parallel --pull | |
docker-compose up -d |