Skip to content

Commit

Permalink
CI updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ypopovych committed Aug 30, 2023
1 parent 0db2ce7 commit f72180d
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 16 deletions.
32 changes: 28 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: Publish CocoaPods package
on:
release:
types: [created]
env:
NODE_FILENAME: node-template-x86_64-apple-darwin.tar.gz
NODE_BIN: node-template
jobs:
publish:
runs-on: macOS-13
Expand All @@ -14,17 +17,38 @@ jobs:
run: sed -i '' "s|[[:blank:]]*s\.version[[:blank:]].*|s.version = '${VERSION}'|g" *.podspec
env:
VERSION: ${{ github.event.release.tag_name }}
- name: Get node version
id: node-version
run: echo "VERSION=$(cat Tests/node-version.txt)" >> "$GITHUB_OUTPUT"
- name: Download Substrate Node
uses: dsaltares/[email protected]
with:
repo: 'substrate-developer-hub/substrate-node-template'
version: 'tags/${{ steps.node-version.outputs.VERSION }}'
file: ${{ env.NODE_FILENAME }}
- name: Unpack Substrate Node
run: tar -xvzf ${{ env.NODE_FILENAME }}
- name: Update CocoaPods repo
run: pod repo update
- name: Publish Substrate Pod
run: pod trunk push --allow-warnings --synchronous Substrate.podspec
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
- name: Publish RPC Pod
run: pod trunk push --allow-warnings --synchronous Substrate-RPC.podspec
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
- name: Publish Keychain Pod
run: pod trunk push --allow-warnings --synchronous Substrate-Keychain.podspec
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
- name: Publish RPC Pod
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
run: |
Tests/with-node.sh './${{ env.NODE_BIN }}' \
'pod trunk push --allow-warnings --synchronous Substrate-RPC.podspec' \
'node_log.txt'
- name: Upload node log
uses: actions/upload-artifact@v3
with:
name: test_node_full_log.txt
path: node_log.txt


50 changes: 38 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: Build & Tests
on: [push, pull_request]
env:
SUBSTRATE_NODE_VERSION: 'v0.9.40'
NODE_FILENAME_MAC: node-template-x86_64-apple-darwin.tar.gz
NODE_FILENAME_LINUX: node-template-x86_64-unknown-linux-gnu.tar.gz
NODE_BIN: node-template
jobs:
apple:
strategy:
Expand All @@ -20,27 +22,48 @@ jobs:
uses: actions/checkout@v3
- name: Select Xcode
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.tests.xcode }}.app
- name: Get node version
id: node-version
run: echo "VERSION=$(cat Tests/node-version.txt)" >> "$GITHUB_OUTPUT"
- name: Download Substrate Node
uses: dsaltares/[email protected]
with:
repo: 'substrate-developer-hub/substrate-node-template'
version: 'tags/${{ env.SUBSTRATE_NODE_VERSION }}'
file: 'node-template-x86_64-apple-darwin.tar.gz'
version: 'tags/${{ steps.node-version.outputs.VERSION }}'
file: ${{ env.NODE_FILENAME_MAC }}
- name: Unpack Substrate Node
run: tar -xvzf *.tar.gz
run: tar -xvzf ${{ env.NODE_FILENAME_MAC }}
- name: Build & Test SPM
run: ./run_with_node.sh './node-template' 'xcrun swift test' 'node_log.txt'
run: Tests/with-node.sh './${{env.NODE_BIN}}' 'xcrun swift test' 'node_log.txt'
- name: Upload swift test node log
uses: actions/upload-artifact@v3
with:
name: swift_test_node_full_log.txt
path: node_log.txt
- name: Cocoapods Repo Update
run: pod repo update
- name: Substrate Build & Test Cocoapods
run: pod repo update && pod lib lint --allow-warnings --fail-fast Substrate.podspec
run: |
pod lib lint --allow-warnings --fail-fast Substrate.podspec
# save podspec to env
echo "LINTED_PODS=Substrate.podspec" >> "$GITHUB_ENV"
- name: Keychain Build & Test Cocoapods
run: pod lib lint --allow-warnings --fail-fast --include-podspecs=Substrate.podspec Substrate-Keychain.podspec
run: |
pod lib lint --allow-warnings --fail-fast \
--include-podspecs="{${LINTED_PODS}}" Substrate-Keychain.podspec
# save podspec to env
echo "LINTED_PODS=${LINTED_PODS},Substrate-Keychain.podspec" >> "$GITHUB_ENV"
- name: RPC Build & Test Cocoapods
run: pod lib lint --allow-warnings --fail-fast --include-podspecs=Substrate.podspec Substrate-RPC.podspec
run: |
Tests/with-node.sh './${{env.NODE_BIN}}' \
'pod lib lint --allow-warnings --fail-fast \
--include-podspecs="{${LINTED_PODS}}" Substrate-RPC.podspec' \
'cp_node_log.txt'
- name: Upload swift test node log
uses: actions/upload-artifact@v3
with:
name: cocoapods_node_full_log.txt
path: cp_node_log.txt
linux:
strategy:
matrix:
Expand All @@ -55,16 +78,19 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get node version
id: node-version
run: echo "VERSION=$(cat Tests/node-version.txt)" >> "$GITHUB_OUTPUT"
- name: Download Substrate Node
uses: dsaltares/[email protected]
with:
repo: 'substrate-developer-hub/substrate-node-template'
version: 'tags/${{ env.SUBSTRATE_NODE_VERSION }}'
file: 'node-template-x86_64-unknown-linux-gnu.tar.gz '
version: 'tags/${{ steps.node-version.outputs.VERSION }}'
file: ${{ env.NODE_FILENAME_LINUX }}
- name: Unpack Substrate Node
run: tar -xvzf *.tar.gz
run: tar -xvzf ${{ env.NODE_FILENAME_LINUX }}
- name: Build and Test
run: ./run_with_node.sh './node-template' 'swift test' 'node_log.txt'
run: Tests/with-node.sh './${{env.NODE_BIN}}' 'swift test' 'node_log.txt'
- name: Upload node log
uses: actions/upload-artifact@v3
with:
Expand Down
6 changes: 6 additions & 0 deletions Substrate-RPC.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,10 @@ Pod::Spec.new do |s|
s.dependency 'Substrate', "#{s.version}"
s.dependency 'JsonRPC.swift', '~> 0.2.3'
s.dependency 'Serializable.swift', '~> 0.3.1'

s.test_spec 'IntegrationTests' do |ts|
ts.platforms = base_platforms
ts.depencency 'Substrate-Keychain', "#{s.version}"
ts.source_files = 'Tests/IntegrationTests/**/*.swift'
end
end
1 change: 1 addition & 0 deletions Tests/node-version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v0.9.40
File renamed without changes.

0 comments on commit f72180d

Please sign in to comment.