updated calitp-data-analysis package date #183
Workflow file for this run
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 and test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
lint: | |
name: "lint" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.9' | |
- name: Run pre-commit | |
uses: pre-commit/[email protected] | |
test: | |
name: "test" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.9' | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- uses: google-github-actions/setup-gcloud@v0 | |
with: | |
service_account_key: ${{ secrets.GCP_SA_KEY }} | |
export_default_credentials: true | |
- name: Install dependencies | |
run: pip install -r requirements.txt | |
- name: Run data tests | |
working-directory: ./tests | |
run: python test_report_data.py | |
- name: Prepare website build | |
run: cp -r tests/outputs/2022 reports/outputs/. && cp tests/fixtures/* reports/outputs/. | |
- name: Run website build | |
working-directory: ./website | |
run: npm install && npm run build && cat build/index.html | grep "Monthly GTFS Quality Reports" | |
# if tests succeed and we're on a PR, publish just the test data to Netlify | |
- name: Deploy site with test data to Netlify | |
if: ${{ github.event_name == 'pull_request' }} | |
run: | | |
npm install -g netlify-cli | |
netlify deploy --site=cal-itp-reports --dir=./website/build --alias=PR-${PR_NUMBER} | |
env: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
PR_NUMBER: ${{ github.event.number }} | |
- uses: peter-evans/find-comment@v2 | |
if: ${{ github.event_name == 'pull_request' }} | |
id: fc | |
with: | |
issue-number: ${{ github.event.number }} | |
comment-author: 'github-actions[bot]' | |
body-includes: --cal-itp-reports.netlify.app | |
- uses: peter-evans/create-or-update-comment@v2 | |
if: ${{ github.event_name == 'pull_request' }} | |
with: | |
comment-id: ${{ steps.fc.outputs.comment-id }} | |
issue-number: ${{ github.event.number }} | |
body: "Preview url: https://PR-${{ github.event.number }}--cal-itp-reports.netlify.app" | |
edit-mode: replace |