try harder to clean #115
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- | |
name: tests | |
if: "!contains(github.event.head_commit.message, 'skip tests')" | |
run: | | |
pytest-3 |