Feature/better print #548
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: Azure Static Web Apps CI/CD | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened, closed] | |
branches: | |
- main | |
jobs: | |
api_test: | |
runs-on: ubuntu-latest | |
name: API Unit Tests | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Install Python dependencies | |
run: | | |
cd api | |
python -m pip install --upgrade pip | |
pip install pytest | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Test with pytest | |
run: | | |
cd api | |
pytest | |
build_and_deploy_job: | |
if: github.event_name == 'pull_request' && github.event.action != 'closed' | |
runs-on: ubuntu-latest | |
name: Build and Deploy Job | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- name: SonarCloud Scan | |
uses: SonarSource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/setup@v0.9.7 | |
with: | |
versionSpec: '5.x' | |
- name: Determine Version | |
id: gitversion | |
uses: gittools/actions/gitversion/execute@v0.9.7 | |
with: | |
useConfigFile: true | |
- name: Set Version number in .env | |
uses: datamonsters/replace-action@v2 | |
with: | |
files: '.env' | |
replacements: 'DEV=${{ steps.gitversion.outputs.majorMinorPatch }}' | |
- name: Build And Deploy | |
id: builddeploy | |
uses: Azure/static-web-apps-deploy@v1 | |
with: | |
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_DELIGHTFUL_FLOWER_0C3EDD710 }} | |
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments) | |
action: "upload" | |
app_location: "/" # App source code path | |
api_location: "api" # Api source code path - optional | |
output_location: "dist" # Built app content directory - optional | |
test: | |
needs: [build_and_deploy_job] | |
if: github.event_name == 'pull_request' && github.event.action != 'closed' | |
name: E2E Tests | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
container: mcr.microsoft.com/playwright:v1.29.1-focal | |
env: | |
BASEURL: https://delightful-flower-0c3edd710-${{github.event.number}}.centralus.2.azurestaticapps.net # sets value for URL to test | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: "16.x" | |
- name: Install dependencies | |
run: yarn | |
- name: Run Playwright tests | |
run: | | |
npx playwright install chromium firefox webkit | |
HOME=/root npx playwright test | |
- name: Create test summary | |
uses: test-summary/action@dist | |
if: always() | |
with: | |
paths: test-results/junit.xml | |
- name: Upload HTML report | |
uses: actions/upload-artifact@v2 | |
if: always() | |
with: | |
name: playwright-report | |
path: playwright-report/ | |
retention-days: 30 | |
close_pull_request_job: | |
if: github.event_name == 'pull_request' && github.event.action == 'closed' | |
runs-on: ubuntu-latest | |
name: Close Pull Request Job | |
steps: | |
- name: Close Pull Request | |
id: closepullrequest | |
uses: Azure/static-web-apps-deploy@v1 | |
with: | |
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_DELIGHTFUL_FLOWER_0C3EDD710 }} | |
action: "close" |