Skip to content

Commit 1e00096

Browse files
committed
ci: add tests workflow
1 parent f7d4a31 commit 1e00096

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed

.github/workflows/tests.yml

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Python unit tests
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
env:
8+
HAS_SECRETS: ${{ secrets.HAS_SECRETS }}
9+
10+
jobs:
11+
tests:
12+
name: Execute unit tests
13+
strategy:
14+
matrix:
15+
python-version: [3.12]
16+
os: [ubuntu-latest]
17+
runs-on: ${{ matrix.os }}
18+
timeout-minutes: 60
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Initialise gopass
27+
uses: camptocamp/initialise-gopass-summon-action@v2
28+
with:
29+
ci-gpg-private-key: ${{secrets.CI_GPG_PRIVATE_KEY}}
30+
github-gopass-ci-token: ${{secrets.GOPASS_CI_GITHUB_TOKEN}}
31+
if: env.HAS_SECRETS == 'HAS_SECRETS'
32+
33+
- name: Set up Python ${{ matrix.python-version }}
34+
uses: actions/setup-python@v5
35+
with:
36+
python-version: ${{ matrix.python-version }}
37+
38+
- name: Upgrade pip version
39+
run: |
40+
python -m pip install -U pip
41+
42+
- run: echo "${HOME}/.local/bin" >> ${GITHUB_PATH}
43+
44+
- name: Install CI dependencies
45+
run: python3 -m pip install --user --requirement=ci/requirements.txt
46+
47+
- name: Environment information
48+
run: c2cciutils-env
49+
env:
50+
GITHUB_EVENT: ${{ toJson(github) }}
51+
52+
- name: Copy .env file
53+
run: cp .env.sample .env
54+
55+
- name: Prepare Docker images and start Compose environment
56+
run: make prepare_env
57+
58+
- name: Run tests
59+
run: make tests
60+
61+
- name: Docker logs
62+
run: c2cciutils-docker-logs
63+
64+
- name: Stop Compose environment
65+
run: make destroy_env

ci/requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
c2cciutils[checks,publish]==1.6.21

0 commit comments

Comments
 (0)