-
Notifications
You must be signed in to change notification settings - Fork 7
82 lines (82 loc) · 3.86 KB
/
build.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
name: Build & Tests
on: [push, pull_request]
jobs:
macos:
runs-on: macOS-12
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Select Xcode
run: sudo xcode-select -s /Applications/Xcode_13.1.app
- name: Setup | Rust
uses: ATiltedTree/setup-rust@v1
with:
rust-version: stable
targets: aarch64-apple-ios aarch64-apple-ios-sim x86_64-apple-ios aarch64-apple-darwin x86_64-apple-darwin
- name: Building XCFramework and binary zip
run: bash rust/scripts/compressed_binary_macos.sh release
env:
CARGO_NET_GIT_FETCH_WITH_CLI: true
- name: Patching Package.swift for testing
run: sed -i '' 's|let[[:blank:]]useLocalBinary[[:blank:]]=[[:blank:]]false|let useLocalBinary = true|g' Package.swift
- name: Build and Test SPM
run: swift test
env:
CARDANO_TEST_MNEMONIC: ${{ secrets.CARDANO_TEST_MNEMONIC }}
CARDANO_TEST_BLOCKFROST_PROJECT_ID: ${{ secrets.CARDANO_TEST_BLOCKFROST_PROJECT_ID }}
CARDANO_TEST_PUBLIC_KEY: ${{ secrets.CARDANO_TEST_PUBLIC_KEY }}
- name: Configure CocoaPods repos
run: |
COCOAPODS_LOCAL_DIR=$(mktemp -d)
git init --bare -b main "$COCOAPODS_LOCAL_DIR"
git clone "$COCOAPODS_LOCAL_DIR" git_temp_dir
cd git_temp_dir
touch .gitignore && git add .gitignore && git commit -a -m "repo init" && git push
cd ../ && rm -r git_temp_dir
pod repo add local $COCOAPODS_LOCAL_DIR
pod repo update
- name: Patching Cardano-Binaries podspec and pushing it to the local repo
run: |
ZIP_PATH="$(pwd)/rust/binaries/CCardano.binaries.zip"
VERSION=$(sed -n "s|[[:blank:]]*s\.version[[:blank:]]*=[[:blank:]]*[\"']\([0-9\.]*\)[\"']|\1|p" Cardano-Binaries.podspec)
NEXT_VERSION=$(echo "${VERSION}" | awk -F. -v OFS=. '{$NF=$NF+1;print}')
sed -i '' "s|[[:blank:]]*s\.source.*|s.source = { :http => 'file://${ZIP_PATH}' \}|g" Cardano-Binaries.podspec
sed -i '' "s|[[:blank:]]*s\.version.*|s.version = '${NEXT_VERSION}'|g" Cardano-Binaries.podspec
pod repo push local Cardano-Binaries.podspec
pod repo update
- name: Build and Test CocoaPods
run: pod lib lint --allow-warnings --fail-fast --sources="local,https://cdn.cocoapods.org" Cardano.swift.podspec
env:
CARDANO_TEST_MNEMONIC: ${{ secrets.CARDANO_TEST_MNEMONIC }}
CARDANO_TEST_BLOCKFROST_PROJECT_ID: ${{ secrets.CARDANO_TEST_BLOCKFROST_PROJECT_ID }}
CARDANO_TEST_PUBLIC_KEY: ${{ secrets.CARDANO_TEST_PUBLIC_KEY }}
linux:
runs-on: ubuntu-latest
container:
image: swift:5.4
options: --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --security-opt apparmor=unconfined
steps:
- name: Ubuntu Packages
run: apt-get update && apt-get install -y software-properties-common && add-apt-repository -y ppa:git-core/ppa && apt-get update && apt-get upgrade -y git && apt-get install -y wget curl
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Setup | Rust
uses: ATiltedTree/setup-rust@v1
with:
rust-version: stable
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
- name: Building Rust
run: mkdir -p rust/binaries && bash rust/scripts/build_binary_linux.sh rust/binaries
env:
CARGO_NET_GIT_FETCH_WITH_CLI: true
- name: Build and Test
run: swift test -Xlinker -Lrust/binaries/lib -Xcc -Irust/binaries/include
env:
CARDANO_TEST_MNEMONIC: ${{ secrets.CARDANO_TEST_MNEMONIC }}
CARDANO_TEST_BLOCKFROST_PROJECT_ID: ${{ secrets.CARDANO_TEST_BLOCKFROST_PROJECT_ID }}
CARDANO_TEST_PUBLIC_KEY: ${{ secrets.CARDANO_TEST_PUBLIC_KEY }}