forked from UdK-VPT/BIM2Modelica
-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (106 loc) · 3.7 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
name: ci
on:
push:
paths-ignore:
- 'dockerfiles/Dockerfile-env'
- '.github/workflows/docker-env.yml'
- 'docs/**'
jobs:
activate:
outputs:
branch: ${{ env.BRANCH }}
runs-on: self-ubuntu-22.04
if: |
github.repository == 'feelpp/BIM2Modelica' &&
!startsWith(github.event.head_commit.message, 'Release ') &&
!contains(github.event.head_commit.message, 'ci skip')
steps:
- run: echo ready
-
name: What
run: echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
build:
needs: activate
runs-on: self-ubuntu-22.04
container:
image: ghcr.io/feelpp/bim2modelica/bim2modelica-env:1.0
options: --user root
steps:
- name: Cleaning up the $GITHUB_WORKSPACE as root from a Docker image
run: find /__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}/. -name . -o -prune -exec rm -rf -- {} + || true
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Installs and upgrades necessary packages
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: tests
if: "!contains(github.event.head_commit.message, 'skip tests')"
run: |
echo "PYTHONPATH=/usr/local/lib/python3/dist-packages/:${{ github.workspace }}/CoTeTo/" >> $GITHUB_ENV
pytest-3
- name: Cleaning up the $GITHUB_WORKSPACE as root from a Docker image
run: find /__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}/. -name . -o -prune -exec rm -rf -- {} + || true
deliver:
needs: [activate,build]
runs-on: self-ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
lfs: true
submodules: recursive
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/feelpp/bim2modelica/bim2modelica
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
- name: Build Docker
uses: docker/build-push-action@v3
with:
context: .
file: dockerfiles/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: TAG=1.0
secrets: |
GIT_AUTH_TOKEN=${{ secrets.CR_PAT }}
check:
needs: [ activate, build, deliver ]
runs-on: self-ubuntu-22.04
container:
image: ${{ needs.deliver.steps.meta.outputs.tags }}
options: --user root
steps:
- name: Cleaning up the $GITHUB_WORKSPACE as root from a Docker image
run: find /__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}/. -name . -o -prune -exec rm -rf -- {} + || true
-
name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
-
name: tests
if: "!contains(github.event.head_commit.message, 'skip tests')"
run: |
pytest-3
- name: Cleaning up the $GITHUB_WORKSPACE as root from a Docker image
run: find /__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}/. -name . -o -prune -exec rm -rf -- {} + || true