Skip to content

Commit

Permalink
build: reorganise apollo and remove unused modules (#106)
Browse files Browse the repository at this point in the history
Co-authored-by: Anton Baliasnikov <anton.baliasnikov@iohk.io>
Co-authored-by: Ahmed Moussa <ahmed.moussa@iohk.io>
Signed-off-by: Goncalo Frade <goncalo.frade@iohk.io>
  • Loading branch information
3 people committed May 20, 2024
1 parent 68d354b commit d8498cf
Show file tree
Hide file tree
Showing 238 changed files with 27,834 additions and 22,919 deletions.
98 changes: 22 additions & 76 deletions .github/workflows/Deployment.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
# kics-scan ignore
name: Deployment
name: Release Apollo

defaults:
run:
Expand All @@ -12,45 +12,25 @@ concurrency:

env:
JAVA_VERSION: 11
NODEJS_VERSION: 16.17.0
ATALA_GITHUB_ACTOR: ${{ secrets.ATALA_GITHUB_ACTOR }}
GITHUB_ACTOR: ${{ secrets.ATALA_GITHUB_ACTOR }}
ATALA_GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

on:
workflow_dispatch:
inputs:
tag:
description: 'Create release with tag'
required: true
type: string

jobs:
deployment:
strategy:
matrix:
include:
- os: macos-latest
os-type: macos
runs-on: ${{ matrix.os }}
release:
runs-on: macos-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v3
with:
submodules: recursive

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1

- name: Cache gradle
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
~/.konan
key: "${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}"
restore-keys: |
${{ runner.os }}-gradle-
token: ${{ secrets.ATALA_GITHUB_TOKEN }}
fetch-depth: 0

- name: "Install Java ${{ env.JAVA_VERSION }}"
uses: actions/setup-java@v3
Expand All @@ -59,66 +39,32 @@ jobs:
distribution: zulu

- name: "Install NodeJS ${{ env.NODEJS_VERSION }}"
if: matrix.os-type == 'linux'
uses: actions/setup-node@v3
with:
node-version: "${{ env.NODEJS_VERSION }}"
node-version: "lts/*"

- name: Install Homebrew
if: matrix.os-type == 'macos'
run: >
/bin/bash -c "$(curl -fsSL
https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- name: "Install autoconf, automake, libtool"
if: matrix.os-type == 'macos'
run: |
brew install autoconf automake libtool
- name: Create Swift Package
run: |
./gradlew :base-asymmetric-encryption:createSwiftPackage
- name: Zip framework
run: |
target_dir_name="Apollo.xcframework"
source_dir="./base-asymmetric-encryption/build/packages/ApolloSwift/"
zip_name="Apollo.xcframework.zip"
(cd $source_dir && zip -r "$zip_name" $target_dir_name)
- name: Prepare release package
run: |
checksum=$(swift package compute-checksum 'base-asymmetric-encryption/build/packages/ApolloSwift/Apollo.xcframework.zip')
echo "CHECKSUM: $checksum"
rm -f Package.swift || true
./.scripts/updatePackage.swift ${{github.event.inputs.tag}} $checksum './.scripts/TemplatePackage.swift' 'Package.swift'
- name: Commit package
uses: stefanzweifel/git-auto-commit-action@v5
env:
GITHUB_ACTOR: ${{ secrets.ATALA_GITHUB_ACTOR }}
GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }}
with:
commit_message: "chore: prepare release ${{github.event.inputs.tag}}"
tagging_message: ${{github.event.inputs.tag}}

- name: Upload swift package artifacts
uses: actions/upload-artifact@v3
with:
name: Apollo.xcframework.zip
path: base-asymmetric-encryption/build/packages/ApolloSwift/Apollo.xcframework.zip

- name: Add swift package artifacts to release
uses: svenstaro/upload-release-action@v2
- uses: crazy-max/ghaction-import-gpg@v5
id: import_gpg
with:
tag: ${{github.event.inputs.tag}}
file: base-asymmetric-encryption/build/packages/ApolloSwift/Apollo.xcframework.zip
asset_name: "Apollo.xcframework.zip"
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
git_user_signingkey: true
git_commit_gpgsign: true

- name: Publish Maven artifacts to Github Packages
id: publish
- name: Release
env:
GIT_AUTHOR_EMAIL: ${{ steps.import_gpg.outputs.email }}
GIT_COMMITTER_EMAIL: ${{ steps.import_gpg.outputs.email }}
GIT_AUTHOR_NAME: ${{ steps.import_gpg.outputs.name }}
GIT_COMMITTER_NAME: ${{ steps.import_gpg.outputs.name }}
run: |
./gradlew publishAllPublicationsToGitHubPackagesRepository :base-asymmetric-encryption:publishJsPackageToGithubRegistry
npm install
npx semantic-release
48 changes: 3 additions & 45 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,37 +19,6 @@ env:
on: [pull_request]

jobs:
lint:
name: Lint changes
runs-on: ubuntu-latest
env:
APPLY_FIXES: none
APPLY_FIXES_EVENT: pull_request
APPLY_FIXES_MODE: commit
VALIDATE_ALL_CODEBASE: ${{ github.ref_name == 'main' }}
DISABLE: COPYPASTE,SPELL
DISABLE_LINTERS: REPOSITORY_CHECKOV,BASH_SHELLCHECK,C_CPPLINT,CPP_CPPLINT
GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }}
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
token: ${{ secrets.ATALA_GITHUB_TOKEN }}
fetch-depth: 0

- name: Mega-Linter
id: ml
uses: oxsecurity/megalinter@v7.4.0

- name: Archive production artifacts
if: ${{ success() || failure() }}
uses: actions/upload-artifact@v3
with:
name: Mega-Linter reports
path: |
report
mega-linter.log
build:
strategy:
matrix:
Expand All @@ -69,26 +38,15 @@ jobs:
with:
submodules: recursive

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1

- name: Cache gradle
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
~/.konan
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Install Java ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v3
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: "zulu"

- name: Gradle Build Action
uses: gradle/gradle-build-action@v2

- name: Install NodeJS ${{ env.NODEJS_VERSION }}
uses: actions/setup-node@v3
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ Pods/
*.jks
*yarn.lock
JSLibs/iohk-crypto/node_modules
node_modules/
51 changes: 51 additions & 0 deletions .releaserc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
branches:
- name: "main"
- name: "release/*"
prerelease: "snapshot"

plugins:
- "@semantic-release/commit-analyzer"
- "@semantic-release/release-notes-generator"
- ["@semantic-release/changelog", {changelogFile: "CHANGELOG.md"}]
- "gradle-semantic-release-plugin"
- [ '@semantic-release/exec', {
prepareCmd: './gradlew :apollo:createSwiftPackage' } ]
- [ '@semantic-release/exec', {
prepareCmd: '(cd ./apollo/build/packages/ApolloSwift && zip -r "Apollo.xcframework.zip" Apollo.xcframework)' } ]
- [ '@semantic-release/exec', {
prepareCmd: "rm -f Package.swift && ./.scripts/updatePackage.swift ${nextRelease.version} \"$(swift package compute-checksum 'apollo/build/packages/ApolloSwift/Apollo.xcframework.zip')\" ./.scripts/TemplatePackage.swift Package.swift" } ]
- [
"@semantic-release/git",
{
assets: [
"CHANGELOG.md",
"gradle.properties",
],
message: "chore(release): cut apollo version ${nextRelease.version}
${nextRelease.notes}",
},
]
- [
"@semantic-release/github",
{
"assets": [
{ "path": "apollo/build/packages/ApolloSwift/Apollo.xcframework.zip", "label": "Apollo.xcframework.zip" },
]
}
]
- [
"semantic-release-slack-bot",
{
notifyOnSuccess: true,
notifyOnFail: true,
markdownReleaseNotes: true,
onSuccessTemplate:
{text: "A new version of `$package_name` successfully released!\n
Version: `v$npm_package_version`\n
Tag: $repo_url/releases/tag/v$npm_package_version\n
\n
Release notes:\n
$release_notes"},
},
]
Empty file added CHANGELOG.md
Empty file.
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ let package = Package(
// RELEASE
.binaryTarget(
name: "ApolloBinary",
url: "https://github.com/input-output-hk/atala-prism-apollo/releases/download/testSwift2/Apollo.xcframework.zip",
checksum: "817420e940206f912c5dcf92acb3b38bd2b87caef6caebc707ff1ff98c5778b8"
url: "https://github.com/input-output-hk/atala-prism-apollo/releases/download/1.0.15/Apollo.xcframework.zip",
checksum: "ef5242b354dfa922576061da1830ae3037c9ba4a26aeed1c84ce13380bd49fb7"
)
]
)
59 changes: 0 additions & 59 deletions aes/README.md

This file was deleted.

43 changes: 0 additions & 43 deletions aes/aes.podspec

This file was deleted.

9 changes: 0 additions & 9 deletions aes/karma.config.d/karma.config.js

This file was deleted.

2 changes: 0 additions & 2 deletions aes/src/androidMain/AndroidManifest.xml

This file was deleted.

Loading

0 comments on commit d8498cf

Please sign in to comment.