53 lines
1.4 KiB
YAML
53 lines
1.4 KiB
YAML
name: test
|
|
|
|
on: [push, pull_request, workflow_dispatch]
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
python-version: ['3.10', '3.11', '3.12']
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install poetry
|
|
poetry install
|
|
- name: Lint
|
|
run: |
|
|
poetry run flake8
|
|
poetry run mypy .
|
|
poetry run reuse lint
|
|
- name: Test
|
|
run: |
|
|
poetry run pytest
|
|
|
|
deploy:
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
needs: [test]
|
|
runs-on: ubuntu-latest
|
|
if: (github.repository == 'msys2/msys2-web' && github.event_name == 'push' && github.ref == 'refs/heads/main')
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Log in
|
|
run: |
|
|
echo "$TOKEN" | docker login ghcr.io --username "$USERNAME" --password-stdin
|
|
env:
|
|
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
USERNAME: ${{ github.actor }}
|
|
- name: Build image
|
|
run: |
|
|
docker build --tag ghcr.io/msys2/msys2-web:latest .
|
|
- name: Deploy image
|
|
run: |
|
|
docker push ghcr.io/msys2/msys2-web:latest
|