Bump the next group across 1 directory with 2 updates #1301
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: CI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
env: | |
APP_IMAGE_NAME: ymyzk/mypy-playground | |
SANDBOX_IMAGE_NAME: ymyzk/mypy-playground-sandbox | |
DOCKER_BUILDKIT: 1 | |
jobs: | |
test_app: | |
needs: | |
- test_frontend | |
name: Test app | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ['3.12'] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: frontend | |
path: app/static | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Upgrade packaging tools | |
run: | | |
python -m pip install --upgrade pip setuptools wheel | |
python -m pip install tox-gh-actions | |
- name: Run tox | |
run: tox | |
working-directory: ./app | |
test_frontend: | |
name: Test frontend | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [20.x] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install dependencies | |
run: npm ci | |
working-directory: ./app/frontend | |
- name: Build, lint, and test frontend | |
run: | | |
npm run build | |
npm run format:ci | |
npm run lint | |
npm run test:ci | |
working-directory: ./app/frontend | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: frontend | |
path: app/frontend/out | |
build_docker_images: | |
name: Build and push Docker images | |
needs: | |
- test_app | |
- test_frontend | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' | |
steps: | |
- uses: actions/checkout@v4 | |
- run: docker version | |
- name: Build app image for development | |
run: docker build --pull -t app:dev ./app | |
- name: Build app image for production | |
run: docker build --pull -t app:latest -f ./app/Dockerfile-prod ./app | |
- name: Build latest Docker sandbox image | |
run: docker build -t sandbox:latest ./sandbox/docker/latest | |
- name: Build Docker sandbox images | |
run: ./sandbox/docker/build.sh $SANDBOX_IMAGE_NAME | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
- name: Push app image | |
run: | | |
docker tag app:latest $APP_IMAGE_NAME:latest | |
docker push $APP_IMAGE_NAME:latest | |
- name: Push Docker sandbox images | |
run: ./sandbox/docker/push.sh $SANDBOX_IMAGE_NAME | |
dependabot: | |
runs-on: ubuntu-latest | |
needs: | |
- test_app | |
- test_frontend | |
permissions: | |
contents: write | |
pull-requests: write | |
if: github.event_name == 'pull_request' && github.actor == 'dependabot[bot]' | |
name: Automatically merge Dependabot PRs | |
steps: | |
- name: Fetch Dependabot metadata | |
id: metadata | |
uses: dependabot/fetch-metadata@v2 | |
with: | |
github-token: "${{ secrets.GITHUB_TOKEN }}" | |
- name: Enable auto-merge for Dependabot PRs (patch) | |
if: steps.metadata.outputs.update-type == 'version-update:semver-patch' | |
run: gh pr merge --auto --merge "$PR_URL" | |
env: | |
PR_URL: ${{ github.event.pull_request.html_url }} | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Enable auto-merge for Dependabot PRs (minor) | |
if: steps.metadata.outputs.update-type == 'version-update:semver-minor' && (contains(steps.metadata.outputs.dependency-names, '@types/')) | |
run: gh pr merge --auto --merge "$PR_URL" | |
env: | |
PR_URL: ${{ github.event.pull_request.html_url }} | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |