name: test and deploy on: [push, pull_request] jobs: build: strategy: fail-fast: false matrix: python-version: [3.8] poetry-version: [1.1.4] node: [14] os: [ubuntu-20.04, windows-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 # get source # PYTHON - name: Install Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} # PYTHON dependency management - name: Install Poetry ${{ matrix.poetry-version }} uses: abatilo/actions-poetry@v2.1.0 with: poetry-version: ${{ matrix.poetry-version }} # PYTHON install dependencies - name: Install Python Dependencies run: poetry install # PYTHON for authentication when testing - name: Set up Cloud SDK uses: google-github-actions/setup-gcloud@master with: project_id: ${{ secrets.GCP_PROJECT_ID }} service_account_key: ${{ secrets.GCP_SA_KEY }} export_default_credentials: true # <=== # PYTHON run unit tests - name: Run Python Tests run: poetry run python -m unittest discover -s tests # JS setup for testing - name: Install Node ${{ matrix.node }} uses: actions/setup-node@v2 with: node-version: ${{ matrix.node }} # JS install from lock.json - name: Install Node Packages run: npm ci # JS build for checking errors - name: Compile Front-end run: npm run build --if-present # JS tests # - name: Run JavaScript Tests # run: npm test deploy: runs-on: ubuntu-20.04 needs: build # for ignoring bad builds if: github.event_name == 'push' && github.ref == 'refs/heads/master' steps: - uses: actions/checkout@v2 # get source # PYTHON - name: Install Python 3.8 uses: actions/setup-python@v2 with: python-version: 3.8 # PYTHON for dependency export only, not installing - name: Install Poetry 1.1.4 uses: abatilo/actions-poetry@v2.1.0 with: poetry-version: 1.1.4 # PYTHON Export Poetry dependencies as requirements.txt - name: Export Poetry Dependencies run: python admin.py pydepend # JS setup - name: Install Node 14 uses: actions/setup-node@v2 with: node-version: 14 # JS install from lock.json - name: Install Node Packages run: npm ci # JS will be built again, for flagging errors - name: Compile Front-end run: npm run build --if-present # JS for compiling scss - name: Compile Sass uses: gha-utilities/sass-build@v0.3.5 with: source: src/scss/style.scss destination: build/style.css # DEPLOY for setting up cloud API - name: Set up Cloud SDK uses: google-github-actions/setup-gcloud@master with: project_id: ${{ secrets.GCP_PROJECT_ID }} service_account_key: ${{ secrets.GCP_SA_KEY }} export_default_credentials: true # DEPLOY set project - name: Set GCP Project run: python admin.py set_project # DEPLOY app engine service, -nb for skipping compile - name: Deploy App Engine Service run: python admin.py app -nb ### MAIN FUNCTIONS # DEPLOY update_tag function - name: Deploy update_tag Function run: python admin.py tag # DEPLOY run_user_playlist function - name: Deploy run_user_playlist Function run: python admin.py playlist ### CRON FUNCTIONS # DEPLOY run_all_playlists function - name: Deploy run_all_playlists Function run: python admin.py playlist_cron # DEPLOY run_all_playlist_stats function - name: Deploy run_all_playlist_stats Function run: python admin.py playlist_stats_cron # DEPLOY run_all_tags function - name: Deploy run_all_tags Function run: python admin.py tags_cron