File tree 3 files changed +155
-0
lines changed
3 files changed +155
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Publish Docker image
2
+ on :
3
+ release :
4
+ types : [published]
5
+ workflow_run :
6
+ workflows : [CI]
7
+ types : [completed]
8
+ branches : [main]
9
+ jobs :
10
+ push_to_registries :
11
+ name : Push Docker image to multiple registries
12
+ runs-on : ubuntu-latest
13
+ if : ${{ github.event.workflow_run.conclusion == 'success' }}
14
+ permissions :
15
+ packages : write
16
+ contents : read
17
+ steps :
18
+ - name : Check out the repo
19
+ uses : actions/checkout@v4
20
+
21
+ # - name: Log in to Docker Hub
22
+ # uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
23
+ # with:
24
+ # username: ${{ secrets.DOCKER_USERNAME }}
25
+ # password: ${{ secrets.DOCKER_PASSWORD }}
26
+
27
+ - name : Log in to the Container registry
28
+ uses : docker/login-action@v3
29
+ with :
30
+ registry : ghcr.io
31
+ username : ${{ github.actor }}
32
+ password : ${{ secrets.GITHUB_TOKEN }}
33
+
34
+ - name : Extract metadata (tags, labels) for Docker
35
+ id : meta
36
+ uses : docker/metadata-action@v5
37
+ with :
38
+ # Enable Docker Hub by adding:
39
+ # my-docker-hub-namespace/my-docker-hub-repository
40
+ images : |
41
+ ghcr.io/${{ github.repository }}
42
+
43
+ - name : Build and push Docker images
44
+ uses : docker/build-push-action@v6
45
+ with :
46
+ context : .
47
+ push : true
48
+ tags : ${{ steps.meta.outputs.tags }}
49
+ labels : ${{ steps.meta.outputs.labels }}
Original file line number Diff line number Diff line change
1
+ name : Publish PyPI package
2
+ on :
3
+ release :
4
+ types : [published, created, edited]
5
+ workflow_dispatch :
6
+ jobs :
7
+ deploy-pypi :
8
+ runs-on : ubuntu-latest
9
+ timeout-minutes : 5
10
+ # https://github.com/marketplace/actions/pypi-publish
11
+ environment :
12
+ name : pypi
13
+ url : https://pypi.org/p/ptplot-gw
14
+ permissions :
15
+ id-token : write
16
+ steps :
17
+ - name : Setup Python
18
+ uses : actions/setup-python@v5
19
+ - name : Print Python version
20
+ run : python -V
21
+ - name : Checkout
22
+ uses : actions/checkout@v4
23
+ - name : Load pip cache
24
+ uses : actions/cache@v4
25
+ with :
26
+ path : .pip
27
+ key : pip-${{ runner.os }}-${{ hashFiles('requirements.txt') }}
28
+ restore-keys : |
29
+ pip-${{ runner.os }}-
30
+ pip-
31
+ - name : Install requirements
32
+ run : |
33
+ pip --cache-dir=.pip install --upgrade pip
34
+ pip --cache-dir=.pip install build twine
35
+ - name : Build
36
+ run : python -m build
37
+ - name : Run Twine checks
38
+ run : twine check dist/*
39
+ - name : Upload built artifacts
40
+ uses : actions/upload-artifact@v4
41
+ with :
42
+ name : pip packages
43
+ path : dist
44
+ if-no-files-found : error
45
+ - name : Publish to PyPI
46
+ uses : pypa/gh-action-pypi-publish@release/v1
47
+ # An API token is not needed with trusted publishing (OpenID Connect)
48
+ # with:
49
+ # user: __token__
50
+ # password: ${{ secrets.PYPI_API_TOKEN }}
Original file line number Diff line number Diff line change
1
+ name : CI
2
+ on : push
3
+ env :
4
+ PRIMARY_PYTHON_VERSION : ' 3.12'
5
+ jobs :
6
+ test :
7
+ runs-on : ubuntu-latest
8
+ steps :
9
+ - name : Setup Python
10
+ uses : actions/setup-python@v5
11
+ with :
12
+ python-version : ${{ env.PRIMARY_PYTHON_VERSION }}
13
+ - name : Print Python version
14
+ run : python -V
15
+ - name : Checkout
16
+ uses : actions/checkout@v4
17
+ - name : Load pip cache
18
+ uses : actions/cache@v4
19
+ with :
20
+ path : .pip
21
+ key : pip-${{ runner.os }}-${{ hashFiles('requirements.txt') }}
22
+ restore-keys : |
23
+ pip-${{ runner.os }}-
24
+ pip-
25
+ - name : Install requirements
26
+ run : |
27
+ pip --cache-dir=.pip install --upgrade pip
28
+ pip --cache-dir=.pip install --upgrade wheel
29
+ pip --cache-dir=.pip install -r requirements.txt -r requirements-dev.txt
30
+ - name : Migrate database
31
+ run : python manage.py migrate
32
+ - name : Check configuration
33
+ run : python manage.py check --fail-level WARNING
34
+ - name : Run tests with coverage
35
+ run : coverage run
36
+ - name : Create coverage reports
37
+ run : |
38
+ coverage combine
39
+ coverage report | tee coverage.txt
40
+ coverage html
41
+ coverage xml
42
+ coverage json
43
+ - name : Upload results
44
+ uses : actions/upload-artifact@v4
45
+ with :
46
+ name : Coverage
47
+ path : |
48
+ ${{ github.workspace }}/coverage.txt
49
+ ${{ github.workspace }}/coverage.xml
50
+ ${{ github.workspace }}/coverage.json
51
+ ${{ github.workspace }}/htmlcov
52
+ if-no-files-found : error
53
+ # - name: Upload results to Codecov
54
+ # uses: codecov/codecov-action@v5
55
+ # with:
56
+ # token: ${{ secrets.CODECOV_TOKEN }}
You can’t perform that action at this time.
0 commit comments