Skip to content

Commit

Permalink
Merge pull request #169 from Crypto-TII/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
peacker authored Mar 7, 2024
2 parents 33fcef4 + 6b2bfcc commit 32c6889
Show file tree
Hide file tree
Showing 85 changed files with 7,506 additions and 4,792 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/build-claasp-base-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build and push image for testing
on:
pull_request:
types: [ closed ]
branches:
- main

jobs:
build-image:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: 0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login dockerhub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_REGISTRY_USER }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}

- name: Build & Push
uses: docker/build-push-action@v4
id: built-image
with:
context: .
file: ./docker/Dockerfile
push: true
tags: tiicrc/claasp-base:latest
target: claasp-base
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and push image from develop
name: Build and push image from main
on:
pull_request:
types: [ closed ]
Expand Down Expand Up @@ -49,6 +49,15 @@ jobs:
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
commit-deployment-repo:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: 0

- name: Get current commit information
run: |
git clone ${{ secrets.DEPLOYMENT_REPOSITORY }} deployment-repo
Expand All @@ -58,3 +67,4 @@ jobs:
git add claasp-dev.log
git commit -m "Updating deployment-repo from github"
git push origin master
needs: build-image
72 changes: 72 additions & 0 deletions .github/workflows/build-staging-webapp-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Build and push image from develop
on:
pull_request:
types: [ closed ]
branches:
- develop

jobs:
build-image:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: 0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login dockerhub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_REGISTRY_USER }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}

- name: Build & Push
uses: docker/build-push-action@v4
id: built-image
with:
context: .
file: ./docker/Dockerfile
push: true
tags: tiicrc/claasp-lib-staging:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
commit-deployment-repo:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: 0

- name: Get current commit information
run: |
git clone ${{ secrets.DEPLOYMENT_REPOSITORY }} deployment-staging-repo
git config --global user.name 'Github'
git config --global user.email ${{ secrets.DEPLOYMENT_REPOSITORY_EMAIL }}
cd deployment-staging-repo
git checkout develop
echo "Date: $(date) Commit: $(git rev-parse HEAD)" >> claasp-dev.log
git add claasp-dev.log
git commit -m "Updating deployment-staging-repo from github"
git push origin develop
needs: build-image
31 changes: 31 additions & 0 deletions .github/workflows/fork-run-pytest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Run pytest for Forked projects

on:
push:
branches:
- '**'
pull_request:
types: [opened, synchronize, reopened, edited]
branches:
- develop
- main

concurrency:
group: fork-run-pytest-tests_${{ github.ref }}
cancel-in-progress: true

jobs:
run-pytest:
if: ${{ github.event.repository.fork }}
runs-on: ubuntu-latest

steps:

- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false
fetch-depth: 0

- name: Run tests
run: docker run --rm -v $PWD:/home/sage/tii-claasp tiicrc/claasp-base:latest make github-pytest
3 changes: 2 additions & 1 deletion .github/workflows/run-benchmark-tests.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Run benchmark tests
on:
pull_request:
pull_request_target:
types: [ opened, synchronize, reopened, edited ]
branches:
- main
Expand All @@ -11,6 +11,7 @@ concurrency:

jobs:
run-benchmark-tests:
if: ${{ !github.event.repository.fork }}
runs-on: self-hosted
timeout-minutes: 3600
steps:
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/run-pytest-and-sonarcloud-scan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches:
- '**'
pull_request:
pull_request_target:
types: [opened, synchronize, reopened, edited]
branches:
- develop
Expand All @@ -16,6 +16,7 @@ concurrency:

jobs:
run-pytest:
if: ${{ !github.event.repository.fork }}
runs-on: self-hosted
steps:
- name: Checkout
Expand Down Expand Up @@ -46,6 +47,7 @@ jobs:
path: /home/runner/_work/claasp/coverage.xml

run-code-coverage:
if: ${{ !github.event.repository.fork }}
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -71,4 +73,4 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
needs: run-pytest
needs: run-pytest
39 changes: 29 additions & 10 deletions .github/workflows/update-changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ jobs:
- name: Commit push changes
uses: actions-js/push@master
if: ${{env.should_add_last_changes_to_master == 'true'}}
if: ${{ env.should_add_last_changes_to_master == 'true' }}
with:
github_token: ${{ secrets.AUTHORIZATION_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
message: 'Changelog version updated'
tags: true
force: true

- name: Create tags
if: ${{env.should_add_last_changes_to_master == 'true'}}
if: ${{ env.should_add_last_changes_to_master == 'true' }}
run: |
project_version=$(cat VERSION)
tag_name="$project_version"
Expand All @@ -46,20 +46,39 @@ jobs:
echo "release_message=$release_message" >> $GITHUB_ENV
- name: Create push tag
if: ${{env.should_add_last_changes_to_master == 'true'}}
id: 'tag_create'
if: ${{ env.should_add_last_changes_to_master == 'true' }}
uses: rickstaa/action-create-tag@v1
with:
github_token: ${{ secrets.AUTHORIZATION_TOKEN }}
tag: ${{env.tag_name}}
github_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ env.tag_name }}
tag_exists_error: false
message: ${{env.release_message}}
message: ${{ env.release_message }}

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Extract release notes
run: python3 extract_release_notes.py >> ./docs/release_notes.md

- name: Create release
if: ${{ env.should_add_last_changes_to_master == 'true' }}
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.tag_name }}
release_name: Release ${{ env.tag_name }}
body_path: ./docs/release_notes.md
draft: false
prerelease: false

- name: Update develop branch
if: ${{env.should_add_last_changes_to_master == 'true'}}
if: ${{ env.should_add_last_changes_to_master == 'true' }}
uses: morbalint/git-merge-action@v1
with:
target: 'develop'
source: 'main'
token: ${{ secrets.AUTHORIZATION_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
strategy_options: 'ours'
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ remote-pytest:
pytest:
pytest -v -n=auto --dist loadfile tests/unit/

github-pytest:
pytest -v tests/unit/

pytest-coverage:
pytest -v -n=2 --dist loadfile --cov-report term-missing --cov=$(PACKAGE) tests/unit/

Expand Down
Loading

0 comments on commit 32c6889

Please sign in to comment.