-
Notifications
You must be signed in to change notification settings - Fork 34
151 lines (124 loc) · 3.79 KB
/
ci.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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: CI
on:
push:
branches:
- master
tags:
- "[0-9]+.[0-9]+.[0-9]+*"
pull_request:
branches:
- master
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
jobs:
test:
runs-on: arc-runner
env:
RESOLWE_POSTGRESQL_PORT: 55433
RESOLWE_REDIS_PORT: 56380
RESOLWE_TEST_ONLY_CHANGES_TO: "origin/master"
strategy:
matrix:
toxenv: ["py312"]
services:
postgres:
image: public.ecr.aws/docker/library/postgres:16
ports:
- 55433:5432
env:
POSTGRES_USER: resolwe
POSTGRES_DB: resolwe-bio
POSTGRES_HOST_AUTH_METHOD: trust
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: public.ecr.aws/docker/library/redis:7-alpine
ports:
- 56380:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: true
fetch-depth: 0
# NOTE: If we are building the "master" branch or a pull request against the
# "master" branch, we allow installing pre-releases with the pip command.
- name: Allow pre-releases for master branch
if: github.ref == 'refs/heads/master'
run: echo "PIP_PRE=1" >> $GITHUB_ENV
- name: Assert PR is up-to-date
if: github.event_name == 'pull_request'
run: |
git_change_target_merge_base=$(git merge-base HEAD origin/${{ github.base_ref }})
git_change_target_sha=$(git rev-parse origin/${{ github.base_ref }})
if [[ "${git_change_target_merge_base}" != "${git_change_target_sha}" ]]; then
echo "Pull request is not up-to-date!"
echo "Please, rebase your pull request on top of '${{ github.base_ref }}' (commit: ${git_change_target_sha})."
exit 1
fi
- name: Documentation
run: |
tox -e docs
- name: Linters
run: |
tox -e linters
- name: Packaging
run: |
tox -e packaging
- name: Extras
run: |
tox -e extra
- name: Migrations
run: |
tox -e migrations
- name: List files in the checkout directory
if: always()
run: |
ls -a -R ${{ github.workspace }}/tests/
- name: Run entire test suite
if: github.event_name != 'pull_request'
timeout-minutes: 120
run: |
tox -e ${{ matrix.toxenv }}
- name: Unit partial test suite on pull request
if: github.event_name == 'pull_request'
timeout-minutes: 120
run: |
tox -e ${{ matrix.toxenv }}-partial
- name: List files in the checkout directory
if: always()
run: |
ls -a -R ${{ github.workspace }}/tests/
- name: Upload artifacts
if: always()
uses: actions/upload-artifact@v4
with:
path: ${{ github.workspace }}/tests/.test_data/*
retention-days: 1
name: test_files
include-hidden-files: true
build:
runs-on: arc-runner
needs: test
permissions:
id-token: write
contents: read
if: startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/checkout@v4
- name: Install build
run: python3.12 -m pip install --user build
- name: Build a binary wheel and a source tarball
run: python3.12 -m build --sdist --wheel --outdir dist/ .
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1