Skip to content

Commit

Permalink
Preparation for github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
sudilav committed Nov 8, 2024
1 parent c382081 commit 16c78a8
Show file tree
Hide file tree
Showing 8 changed files with 155 additions and 141 deletions.
132 changes: 0 additions & 132 deletions .github/workflows/main.yml

This file was deleted.

56 changes: 56 additions & 0 deletions .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.

name: Publish Docker image

on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
attestations: write
id-token: write
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: my-docker-hub-namespace/my-docker-hub-repository

- name: Build and push Docker image
id: push
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
51 changes: 51 additions & 0 deletions .github/workflows/publish-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#
name: Deploy sphinx site to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: [$default-branch]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:

build:
runs-on: ubuntu-latest
container:
image: sudilav1/martepy:latest
steps:
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
- name: Build with sphinx
run: cd docs && make html
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./docs/build/html

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: docs
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
2 changes: 0 additions & 2 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ permissions:

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/test-and-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

name: Test & Linting

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest
name: Run Tests
container:
image: sudilav1/martepy:latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Run pytest
run: |
pytest --cov=martepy --cov-report=term --cov-report=html:cov_html --cov-fail-under=90
- name: Upload Coverage Report
uses: actions/upload-artifact@v2
with:
name: coverage-report
path: cov_html/
retention-days: 30

linting:
runs-on: ubuntu-latest
name: Code Linting
container:
image: sudilav1/martepy:latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Run pylint
run: pylint martepy

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ codeclimate.json
log.txt
tests/marte2/new_headers/*
**/*.xmt
dist/*
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,14 @@ When you require support please open an issue, if you would like to make adjustm

**Note: You must comply with our guidelines as per the below.**

[Repository Guidelines](./Guidelines.md)
[Repository Guidelines](https://github.com/ukaea/MARTe2-python/blob/main/Guidelines.md)

## Installation

This repo has few dependencies and should auto install these when needed. To install the repo simply clone and install with pip:

``` bash
git clone https://git.ccfe.ac.uk/marte21/public/marte2_python.git
cd marte2_python
pip install ./
pip install martepy
```

## Examples
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ build-backend = "setuptools.build_meta"

[project]
name = "martepy"
version = "0.1.0"
description = "Python modules for testing data processing codes"
version = "1.0.0"
description = """Python modules that wrap MARTe2 classes and objects into python classes for automation and simplification purposes of developing MARTe2 applications. This also provides tools that are useful for working with MARTe2."""
readme = "README.md"
authors = [
{ name = "Edward Jones", email = "edward.jones1@ukaea.uk" }
Expand All @@ -23,7 +23,7 @@ dependencies = [
]

[project.urls]
"Homepage" = "https://git.ccfe.ac.uk/POGDeveloper/martepy"
"Homepage" = "https://github.com/ukaea/MARTe2-python"

[tool.setuptools.packages.find]
include = ["martepy", "martepy.*"]
Expand Down

0 comments on commit 16c78a8

Please sign in to comment.