-
Notifications
You must be signed in to change notification settings - Fork 1
128 lines (120 loc) · 3.55 KB
/
mir_workflows.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
name: MiR Connector Workflow
on:
push:
branches:
- main
paths:
- mir_connector/**
pull_request:
branches:
- main
paths:
- mir_connector/**
jobs:
lint:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.11"]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Lint with flake8
uses: py-actions/flake8@v2
with:
path: mir_connector
max-line-length: 100
- name: Check with black
uses: psf/black@stable
with:
version: "~= 23.0"
src: mir_connector
options: "--diff --check --line-length=100"
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
cd mir_connector
python -m pip install --upgrade pip
python -m pip install -e .["test"]
- name: Test with pytest
run: |
cd mir_connector
pytest
publish-pypi:
if: contains(github.event.head_commit.message, 'Bump version')
needs: [test, lint]
runs-on: ubuntu-latest
strategy:
fail-fast: true
environment: release
permissions:
id-token: write
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.11"
- name: Install Dependencies
run: |
cd mir_connector
python -m pip install --upgrade pip
python -m pip install .[dev]
- name: Build Package
run: |
cd mir_connector
python -m build --sdist
twine check dist/*
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
packages-dir: mir_connector/dist/
docker-build:
# ${{ contains(github.event.head_commit.message, 'Bump version') }} # TODO: reenable
# needs: [test, lint] # TODO: reenable
runs-on: ubuntu-latest
strategy:
fail-fast: true
environment: release
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Google Artifact Registry
uses: docker/login-action@v3
with:
registry: us-central1-docker.pkg.dev
username: _json_key
password: ${{ secrets.GAR_JSON_KEY }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: mir_connector/
file: ./docker/Dockerfile
push: false
tags: us-central1-docker.pkg.dev/inorbit-integrations/connectors/mir_connector:latest # ${{ steps.meta.outputs.tags }}
# - name: Generate artifact attestation
# uses: actions/attest-build-provenance@v1
# with:
# subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
# subject-digest: ${{ steps.push.outputs.digest }}
# push-to-registry: true