mirror of
https://github.com/tsolomko/SWCompression.git
synced 2026-06-23 14:56:41 +00:00
Merge branch 'hotfix-4.5.11'
This commit is contained in:
+3
-3
@@ -1,13 +1,13 @@
|
||||
# Run: sourcekitten doc --spm --module-name SWCompression > docs.json
|
||||
sourcekitten_sourcefile: docs.json
|
||||
clean: true
|
||||
clean: false
|
||||
author: Timofey Solomko
|
||||
module: SWCompression
|
||||
module_version: 4.5.10
|
||||
module_version: 4.5.11
|
||||
copyright: '© 2021 Timofey Solomko'
|
||||
readme: README.md
|
||||
github_url: https://github.com/tsolomko/SWCompression
|
||||
github_file_prefix: https://github.com/tsolomko/SWCompression/tree/4.5.10
|
||||
github_file_prefix: https://github.com/tsolomko/SWCompression/tree/4.5.11
|
||||
theme: fullwidth
|
||||
|
||||
custom_categories:
|
||||
|
||||
-192
@@ -3,112 +3,7 @@ git:
|
||||
depth: 1
|
||||
submodules: false
|
||||
jobs:
|
||||
allow_failures:
|
||||
# There is an issue with Swift 5.4 on Linux which fails the build. See https://bugs.swift.org/browse/SR-14594.
|
||||
env:
|
||||
- SWIFT_VERSION=5.4
|
||||
include:
|
||||
# We test only building using SPM with Swift 4.2 on macos since Carthage doesn't support multiple Swift language versions.
|
||||
- stage: test
|
||||
language: swift
|
||||
os: osx
|
||||
osx_image: xcode10.1 # Swift 4.2
|
||||
script:
|
||||
- swift --version
|
||||
- swift build
|
||||
- swift build -c release
|
||||
- stage: test
|
||||
language: swift
|
||||
os: osx
|
||||
osx_image: xcode10.3 # Swift 5.0
|
||||
env:
|
||||
- HOMEBREW_NO_INSTALL_CLEANUP=1
|
||||
- WATCHOS_ACTIONS='clean build'
|
||||
- WATCHOS_SIMULATOR='Apple Watch Series 4 - 44mm'
|
||||
before_install:
|
||||
- brew update
|
||||
install:
|
||||
- ./utils.py ci install-macos
|
||||
before_script:
|
||||
- ./utils.py prepare-workspace macos
|
||||
script:
|
||||
- ./utils.py ci script-macos
|
||||
- stage: test
|
||||
language: swift
|
||||
os: osx
|
||||
osx_image: xcode11.3 # Swift 5.1
|
||||
env:
|
||||
- HOMEBREW_NO_INSTALL_CLEANUP=1
|
||||
- WATCHOS_ACTIONS='clean build'
|
||||
- WATCHOS_SIMULATOR='Apple Watch Series 4 - 44mm'
|
||||
before_install:
|
||||
- brew update
|
||||
install:
|
||||
- ./utils.py ci install-macos
|
||||
before_script:
|
||||
- ./utils.py prepare-workspace macos
|
||||
script:
|
||||
- ./utils.py ci script-macos
|
||||
- stage: test
|
||||
language: swift
|
||||
os: osx
|
||||
osx_image: xcode11.4 # Swift 5.2
|
||||
env:
|
||||
- HOMEBREW_NO_INSTALL_CLEANUP=1
|
||||
- WATCHOS_ACTIONS='clean build'
|
||||
- WATCHOS_SIMULATOR='Apple Watch Series 4 - 44mm'
|
||||
before_install:
|
||||
- brew update
|
||||
install:
|
||||
- ./utils.py ci install-macos
|
||||
before_script:
|
||||
- ./utils.py prepare-workspace macos
|
||||
script:
|
||||
- ./utils.py ci script-macos
|
||||
- stage: test
|
||||
# TODO: Remove this stage when the non-xcf installation method with Carthage is no longer supported.
|
||||
language: swift
|
||||
os: osx
|
||||
osx_image: xcode12 # Swift 5.3
|
||||
env:
|
||||
- HOMEBREW_NO_INSTALL_CLEANUP=1
|
||||
- WATCHOS_ACTIONS='clean build'
|
||||
- WATCHOS_SIMULATOR='Apple Watch Series 6 - 44mm'
|
||||
before_install:
|
||||
- brew update
|
||||
install:
|
||||
- ./utils.py ci install-macos
|
||||
before_script:
|
||||
- xcconfig=$(mktemp /tmp/static.xcconfig.XXXXXX)
|
||||
- trap 'rm -f "$xcconfig"' INT TERM HUP EXIT
|
||||
- echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200 = arm64 arm64e armv7 armv7s armv6 armv8' >> $xcconfig
|
||||
- echo 'EXCLUDED_ARCHS = $(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT)__XCODE_$(XCODE_VERSION_MAJOR))' >> $xcconfig
|
||||
- export XCODE_XCCONFIG_FILE="$xcconfig"
|
||||
- carthage bootstrap
|
||||
- git submodule update --init --recursive
|
||||
- cp "Tests/Test Files/gitattributes-copy" "Tests/Test Files/.gitattributes"
|
||||
- cd "Tests/Test Files/"
|
||||
- git lfs pull
|
||||
- git lfs checkout
|
||||
- cd -
|
||||
script:
|
||||
- ./utils.py ci script-macos
|
||||
- stage: test
|
||||
language: swift
|
||||
os: osx
|
||||
osx_image: xcode12.4 # Swift 5.3.2
|
||||
env:
|
||||
- HOMEBREW_NO_INSTALL_CLEANUP=1
|
||||
- WATCHOS_ACTIONS='clean build'
|
||||
- WATCHOS_SIMULATOR='Apple Watch Series 6 - 44mm'
|
||||
before_install:
|
||||
- brew update
|
||||
install:
|
||||
- ./utils.py ci install-macos
|
||||
before_script:
|
||||
- ./utils.py prepare-workspace macos --xcf
|
||||
script:
|
||||
- ./utils.py ci script-macos
|
||||
- stage: test
|
||||
language: swift
|
||||
os: osx
|
||||
@@ -125,90 +20,3 @@ jobs:
|
||||
- ./utils.py prepare-workspace macos --xcf
|
||||
script:
|
||||
- ./utils.py ci script-macos
|
||||
- stage: test
|
||||
language: generic
|
||||
os: linux
|
||||
dist: bionic
|
||||
env:
|
||||
- SWIFT_VERSION=4.2.3
|
||||
install:
|
||||
- ./utils.py ci install-linux
|
||||
script:
|
||||
- ./utils.py ci script-linux
|
||||
- stage: test
|
||||
language: generic
|
||||
os: linux
|
||||
dist: bionic
|
||||
env:
|
||||
- SWIFT_VERSION=5.0.3
|
||||
install:
|
||||
- ./utils.py ci install-linux
|
||||
script:
|
||||
- ./utils.py ci script-linux
|
||||
- stage: test
|
||||
language: generic
|
||||
os: linux
|
||||
dist: bionic
|
||||
env:
|
||||
- SWIFT_VERSION=5.1.5
|
||||
install:
|
||||
- ./utils.py ci install-linux
|
||||
script:
|
||||
- ./utils.py ci script-linux
|
||||
- stage: test
|
||||
language: generic
|
||||
os: linux
|
||||
dist: bionic
|
||||
env:
|
||||
- SWIFT_VERSION=5.2.5
|
||||
install:
|
||||
- ./utils.py ci install-linux
|
||||
script:
|
||||
- ./utils.py ci script-linux
|
||||
- stage: test
|
||||
language: generic
|
||||
os: linux
|
||||
dist: bionic
|
||||
env:
|
||||
- SWIFT_VERSION=5.3.3
|
||||
install:
|
||||
- ./utils.py ci install-linux
|
||||
script:
|
||||
- ./utils.py ci script-linux
|
||||
- stage: test
|
||||
language: generic
|
||||
os: linux
|
||||
dist: bionic
|
||||
env:
|
||||
- SWIFT_VERSION=5.4
|
||||
install:
|
||||
- ./utils.py ci install-linux
|
||||
script:
|
||||
- ./utils.py ci script-linux
|
||||
- stage: deploy
|
||||
# Don't deploy if it is a test release.
|
||||
if: (tag IS present) AND (tag =~ /^\d+\.\d+\.\d+$/)
|
||||
language: generic
|
||||
os: osx
|
||||
osx_image: xcode12
|
||||
env:
|
||||
- HOMEBREW_NO_INSTALL_CLEANUP=1
|
||||
env:
|
||||
secure: iavIkrus2Xd3b086nz2srMGl52yqzLuCdhyEAhMODVqkzqMQ17s10y1TNb+vkepd0HgxI9j57d5X7tfChjWuWDwE2hZKjr/Kx2DfiUr1AKQD6ymuGrq/0Vv6yL9dfPU8goFArcrsBcyVKczLtTuLCKL498ZqokkQc/3kGvzW74lv+z410MfHS9/tvToO/yXJckL6qJ2XBAiElfOO0rEkllTeCo6N3bjcHZ2o7PE0K+CHYxwNKj0TmPmuNWZ3U4fzoWzkk01re1C1l5cpSb20g+2aGyi0yYX+PomX7fIIqNq9vmmyoeNdr35yqoQv/0zFeFnps83NKmZLAjSUhiUdhlbuBLBE+w8544LOaZnMDlFmpDjgyaVnRrOh0NrBB1FwU48aGfX5ljRQmk/07FTEUjvwvGGoOpz8lrLZi148FMHEospL3Sf7d8K+Q9WdtLTGk7HCnbOVcxS6oB/SWF/Cj6n5wu+EI1floBaZEsNPR40Gd4eM/Ik/E3lDrZThGDCWQsao981wm7IfEDBR1nuMME8gpZINFANNS1+5miFaGdTnDTp4Yd5MGEFZm+K8x+TG1891NwNH1ZmKXlypJXiUzvSjbh2ViNJGekdQj9q2gj2ZFlCfHJ05adwJ4w9qRuF00HpAOD6At6EnsjDXFJeTZS5dj8fi2YsU9or8KfTFoNY=
|
||||
addons:
|
||||
homebrew:
|
||||
packages:
|
||||
- sourcekitten
|
||||
update: true
|
||||
install:
|
||||
- gem install -N jazzy
|
||||
- gem update -N cocoapods
|
||||
before_deploy:
|
||||
- ./utils.py ci before-deploy
|
||||
deploy:
|
||||
- provider: pages
|
||||
github_token: $GITHUB_TOKEN
|
||||
local_dir: docs
|
||||
skip_cleanup: true
|
||||
on:
|
||||
tags: true
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# Changelog
|
||||
|
||||
## 4.5.11
|
||||
|
||||
- Fixed a crash when processing a truncated TAR file.
|
||||
- Added missing documentation for `LZMAProperties.init()`.
|
||||
- Windows is now supported.
|
||||
|
||||
## 4.5.10
|
||||
|
||||
- Fixed compilation issues on Windows (PR #22 by @trametheka).
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
[](https://developer.apple.com/swift/)
|
||||
[](https://raw.githubusercontent.com/tsolomko/SWCompression/master/LICENSE)
|
||||
[](https://travis-ci.com/tsolomko/SWCompression)
|
||||
[](https://dev.azure.com/tsolomko/SWCompression/_build/latest?definitionId=3&branchName=develop)
|
||||
|
||||
A framework with (de)compression algorithms and functions for working with various archives and containers.
|
||||
|
||||
@@ -15,7 +16,7 @@ SWCompression — is a framework with a collection of functions for:
|
||||
2. Reading (and sometimes writing) archives of different formats.
|
||||
3. Reading (and sometimes writing) containers such as ZIP, TAR and 7-Zip.
|
||||
|
||||
It also works both on Apple platforms and __Linux__.
|
||||
It also works on Apple platforms, Linux, __and Windows__.
|
||||
|
||||
All features are listed in the tables below. "TBD" means that feature is planned but not implemented (yet).
|
||||
|
||||
@@ -192,14 +193,12 @@ If you want to run tests on your computer, you need to do an additional step aft
|
||||
```
|
||||
|
||||
The argument of this function is an operating system that you're using. This command will download files used in tests,
|
||||
and on macOS it will also try to download BitByteData dependency, which requires having Carthage installed.
|
||||
|
||||
Currently, the Carthage part of this procedure may fail when using Xcode 12 or later. In that case you should manually
|
||||
run `carthage update --use-xcframeworks --no-use-binaries` or use
|
||||
[xconfig workaround](https://github.com/Carthage/Carthage/blob/master/Documentation/Xcode12Workaround.md). Please also
|
||||
note that when on working on SWCompression in Xcode when building the project you may see ld warnings about a directory
|
||||
not being found. These are expected and harmless. Finally, you should keep in mind that support for non-xcframework method
|
||||
of installing dependencies is likely to be dropped in the future major update.
|
||||
and on macOS it will also try to download BitByteData dependency, which requires having Carthage installed. When using
|
||||
Xcode 12 or later, you should also pass the `--xcf` option, or use the
|
||||
[xconfig workaround](https://github.com/Carthage/Carthage/blob/master/Documentation/Xcode12Workaround.md).
|
||||
Please also note that when working on SWCompression in Xcode when building the project you may see ld warnings about a
|
||||
directory not being found. These are expected and harmless. Finally, you should keep in mind that support for non-xcframework
|
||||
method of installing dependencies is likely to be dropped in the future major update.
|
||||
|
||||
Test files are stored in a [separate repository](https://github.com/tsolomko/SWCompression-Test-Files), using Git LFS.
|
||||
There are two reasons for this complicated setup. Firstly, some of these files can be quite big, and it would be
|
||||
@@ -232,9 +231,6 @@ completely in Swift without Objective-C, it can also be used on __Linux__.
|
||||
|
||||
## Future plans
|
||||
|
||||
See [5.0 Update](https://github.com/tsolomko/SWCompression/projects/2) Project for the list of planned API changes and
|
||||
new features.
|
||||
|
||||
- Performance...
|
||||
- Better Deflate compression.
|
||||
- Something else...
|
||||
@@ -248,7 +244,7 @@ new features.
|
||||
- [pyflate](http://www.paul.sladen.org/projects/pyflate/)
|
||||
- [Deflate specification](https://www.ietf.org/rfc/rfc1951.txt)
|
||||
- [GZip specification](https://www.ietf.org/rfc/rfc1952.txt)
|
||||
- [Zlib specfication](https://www.ietf.org/rfc/rfc1950.txt)
|
||||
- [Zlib specification](https://www.ietf.org/rfc/rfc1950.txt)
|
||||
- [LZMA SDK and specification](http://www.7-zip.org/sdk.html)
|
||||
- [XZ specification](http://tukaani.org/xz/xz-file-format-1.0.4.txt)
|
||||
- [Wikipedia article about LZMA](https://en.wikipedia.org/wiki/Lempel–Ziv–Markov_chain_algorithm)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Pod::Spec.new do |s|
|
||||
|
||||
s.name = "SWCompression"
|
||||
s.version = "4.5.10"
|
||||
s.version = "4.5.11"
|
||||
s.summary = "A framework with functions for working with compression, archives and containers."
|
||||
|
||||
s.description = "A framework with (de)compression algorithms and functions for processing various archives and containers."
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>4.5.10</string>
|
||||
<string>4.5.11</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>77</string>
|
||||
<string>78</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2021 Timofey Solomko</string>
|
||||
</dict>
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>4.5.10</string>
|
||||
<string>4.5.11</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>77</string>
|
||||
<string>78</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -1258,7 +1258,7 @@
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CURRENT_PROJECT_VERSION = 77;
|
||||
CURRENT_PROJECT_VERSION = 78;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
@@ -1339,7 +1339,7 @@
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CURRENT_PROJECT_VERSION = 77;
|
||||
CURRENT_PROJECT_VERSION = 78;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
"FRAMEWORK_SEARCH_PATHS[sdk=appletvos*]" = (
|
||||
@@ -1400,7 +1400,7 @@
|
||||
APPLICATION_EXTENSION_API_ONLY = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 77;
|
||||
DYLIB_CURRENT_VERSION = 78;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
INFOPLIST_FILE = SWCompression.xcodeproj/SWCompression.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
@@ -1427,7 +1427,7 @@
|
||||
APPLICATION_EXTENSION_API_ONLY = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 77;
|
||||
DYLIB_CURRENT_VERSION = 78;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
INFOPLIST_FILE = SWCompression.xcodeproj/SWCompression.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
|
||||
@@ -43,6 +43,7 @@ public struct LZMAProperties {
|
||||
self.dictionarySize = dictionarySize
|
||||
}
|
||||
|
||||
/// Initializes LZMA properties with default values of lc, lp, pb, and dictionary size.
|
||||
public init() { }
|
||||
|
||||
init(lzmaByte: UInt8, _ dictSize: Int) throws {
|
||||
|
||||
@@ -36,7 +36,8 @@ public class TarContainer: Container {
|
||||
*/
|
||||
public static func formatOf(container data: Data) throws -> Format {
|
||||
// TAR container should be at least 512 bytes long (when it contains only one header).
|
||||
guard data.count >= 512 else { throw TarError.tooSmallFileIsPassed }
|
||||
guard data.count >= 512
|
||||
else { throw TarError.tooSmallFileIsPassed }
|
||||
|
||||
/// Object with input data which supports convenient work with bit shifts.
|
||||
var infoProvider = TarEntryInfoProvider(data)
|
||||
@@ -126,6 +127,12 @@ public class TarContainer: Container {
|
||||
} else {
|
||||
let dataStartIndex = entryInfo.blockStartIndex + 512
|
||||
let dataEndIndex = dataStartIndex + entryInfo.size!
|
||||
// Verify that data is not truncated.
|
||||
// The data.startIndex inequality is strict since by this point at least one header (i.e. 512 bytes)
|
||||
// has been processed. The data.endIndex inequality is strict since there must be a 1024 bytes-long EOF
|
||||
// marker block which isn't included into any entry.
|
||||
guard dataStartIndex > data.startIndex && dataEndIndex < data.endIndex
|
||||
else { throw TarError.wrongField }
|
||||
let entryData = data.subdata(in: dataStartIndex..<dataEndIndex)
|
||||
entries.append(TarEntry(info: entryInfo, data: entryData))
|
||||
}
|
||||
@@ -148,9 +155,9 @@ public class TarContainer: Container {
|
||||
- Returns: Array of `TarEntryInfo`.
|
||||
*/
|
||||
public static func info(container data: Data) throws -> [TarEntryInfo] {
|
||||
// First, if the TAR container contains only header, it should be at least 512 bytes long.
|
||||
// So we have to check this.
|
||||
guard data.count >= 512 else { throw TarError.tooSmallFileIsPassed }
|
||||
// TAR container should be at least 512 bytes long (when it contains only one header).
|
||||
guard data.count >= 512
|
||||
else { throw TarError.tooSmallFileIsPassed }
|
||||
|
||||
/// Object with input data which supports convenient work with bit shifts.
|
||||
var infoProvider = TarEntryInfoProvider(data)
|
||||
|
||||
@@ -7,7 +7,7 @@ import Foundation
|
||||
import SWCompression
|
||||
import SwiftCLI
|
||||
|
||||
let cli = CLI(name: "swcomp", version: "4.5.10",
|
||||
let cli = CLI(name: "swcomp", version: "4.5.11",
|
||||
description: """
|
||||
swcomp - small command-line client for SWCompression framework.
|
||||
Serves as an example of SWCompression usage.
|
||||
|
||||
+1
-1
Submodule Tests/Test Files updated: 25a663fdbe...b11a309030
@@ -0,0 +1,183 @@
|
||||
trigger:
|
||||
branches:
|
||||
exclude:
|
||||
- master
|
||||
tags:
|
||||
include:
|
||||
- '*'
|
||||
exclude:
|
||||
- '*-test*'
|
||||
|
||||
stages:
|
||||
- stage: test
|
||||
displayName: 'Build & Test'
|
||||
jobs:
|
||||
- job: macosSwift42
|
||||
pool:
|
||||
vmImage: 'macOS-10.14'
|
||||
variables:
|
||||
DEVELOPER_DIR: '/Applications/Xcode_10.1.app'
|
||||
steps:
|
||||
- script: |
|
||||
set -e -o xtrace
|
||||
swift --version
|
||||
swift build
|
||||
swift build -c release
|
||||
displayName: 'Build SPM Debug & Release'
|
||||
- job: macos
|
||||
# TODO: Add Xcode 12.5/Swift 5.4. It requires macOS 11 which is currently unavailable on AZP. For Xcode 12.5 we can also enable testing on watchos.
|
||||
strategy:
|
||||
matrix:
|
||||
macosSwift50:
|
||||
imageName: 'macOS-10.14'
|
||||
DEVELOPER_DIR: '/Applications/Xcode_10.3.app'
|
||||
WATCHOS_ACTIONS: 'clean build'
|
||||
WATCHOS_SIMULATOR: 'Apple Watch Series 4 - 44mm'
|
||||
macosSwift51:
|
||||
imageName: 'macOS-10.15'
|
||||
DEVELOPER_DIR: '/Applications/Xcode_11.3.1.app'
|
||||
WATCHOS_ACTIONS: 'clean build'
|
||||
WATCHOS_SIMULATOR: 'Apple Watch Series 4 - 44mm'
|
||||
macosSwift52:
|
||||
imageName: 'macOS-10.15'
|
||||
DEVELOPER_DIR: '/Applications/Xcode_11.4.1.app'
|
||||
WATCHOS_ACTIONS: 'clean build'
|
||||
WATCHOS_SIMULATOR: 'Apple Watch Series 4 - 44mm'
|
||||
macosSwift53:
|
||||
imageName: 'macOS-10.15'
|
||||
DEVELOPER_DIR: '/Applications/Xcode_12.4.app'
|
||||
WATCHOS_ACTIONS: 'clean build'
|
||||
WATCHOS_SIMULATOR: 'Apple Watch Series 4 - 44mm'
|
||||
UTILS_PW_XCF_FLAG: '--xcf'
|
||||
# macosSwift54:
|
||||
# imageName: 'macOS-11.3'
|
||||
# DEVELOPER_DIR: '/Applications/Xcode_12.5.app'
|
||||
# WATCHOS_ACTIONS: 'clean test'
|
||||
# WATCHOS_SIMULATOR: 'Apple Watch Series 6 - 44mm'
|
||||
# UTILS_PW_XCF_FLAG: '--xcf'
|
||||
pool:
|
||||
vmImage: $(imageName)
|
||||
steps:
|
||||
- script: |
|
||||
set -e -o xtrace
|
||||
brew update
|
||||
./utils.py ci install-macos
|
||||
displayName: 'Install'
|
||||
- script: ./utils.py prepare-workspace macos $UTILS_PW_XCF_FLAG
|
||||
displayName: 'Prepare Workspace'
|
||||
- script: ./utils.py ci script-macos
|
||||
displayName: 'Build & Test'
|
||||
- script: swift build -c release
|
||||
displayName: 'Build SPM Release'
|
||||
- job: linux
|
||||
strategy:
|
||||
matrix:
|
||||
linuxSwift42:
|
||||
imageName: 'ubuntu-18.04'
|
||||
containerImage: 'swift:4.2.4'
|
||||
linuxSwift50:
|
||||
imageName: 'ubuntu-18.04'
|
||||
containerImage: 'swift:5.0.3-bionic'
|
||||
linuxSwift51:
|
||||
imageName: 'ubuntu-18.04'
|
||||
containerImage: 'swift:5.1.5-bionic'
|
||||
linuxSwift52:
|
||||
imageName: 'ubuntu-18.04'
|
||||
containerImage: 'swift:5.2.5-bionic'
|
||||
linuxSwift53:
|
||||
imageName: 'ubuntu-18.04'
|
||||
containerImage: 'swift:5.3.3-bionic'
|
||||
linuxSwift54:
|
||||
imageName: 'ubuntu-18.04'
|
||||
containerImage: 'swift:5.4.1-bionic'
|
||||
pool:
|
||||
vmImage: $(imageName)
|
||||
container: $[ variables['containerImage'] ]
|
||||
steps:
|
||||
- script: |
|
||||
set -e -o xtrace
|
||||
swift --version
|
||||
swift build
|
||||
swift build -c release # Check Release build just in case.
|
||||
displayName: 'Build SPM Debug & Release'
|
||||
- job: windows
|
||||
strategy:
|
||||
matrix:
|
||||
windowsSwift54:
|
||||
imageName: 'windows-2019'
|
||||
SWIFT_VERSION: '5.4.1'
|
||||
pool:
|
||||
vmImage: $(imageName)
|
||||
variables:
|
||||
DEVELOPER_DIR: 'C:\Library\Developer'
|
||||
SDKROOT: 'C:\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk'
|
||||
XCTEST_DIR: 'C:\Library\Developer\Platforms\Windows.platform\Developer\Library\XCTest-development'
|
||||
SWIFTFLAGS: '--sdk $(SDKROOT)'
|
||||
SWIFTTESTFLAGS: '-Xswiftc -I -Xswiftc $(XCTEST_DIR)\usr\lib\swift\windows\x86_64 -Xswiftc -L -Xswiftc $(XCTEST_DIR)\usr\lib\swift\windows -Xswiftc -sdk -Xswiftc $(SDKROOT)'
|
||||
steps:
|
||||
- task: BatchScript@1
|
||||
inputs:
|
||||
filename: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/Tools/VsDevCmd.bat
|
||||
arguments: -no_logo -arch=x64 -host_arch=x64
|
||||
modifyEnvironment: true
|
||||
displayName: 'vsvarsall.bat'
|
||||
- pwsh: Invoke-WebRequest -Uri https://swift.org/builds/swift-$(SWIFT_VERSION)-release/windows10/swift-$(SWIFT_VERSION)-RELEASE/swift-$(SWIFT_VERSION)-RELEASE-windows10.exe -OutFile swift-install.exe
|
||||
displayName: 'Download Swift'
|
||||
- task: BatchScript@1
|
||||
inputs:
|
||||
filename: .\swift-install.exe
|
||||
arguments: /install /quiet
|
||||
modifyEnvironment: true
|
||||
displayName: 'Install Swift'
|
||||
- script: |
|
||||
copy %SDKROOT%\usr\share\ucrt.modulemap "%UniversalCRTSdkDir%\Include\%UCRTVersion%\ucrt\module.modulemap"
|
||||
copy %SDKROOT%\usr\share\visualc.modulemap "%VCToolsInstallDir%\include\module.modulemap"
|
||||
copy %SDKROOT%\usr\share\visualc.apinotes "%VCToolsInstallDir%\include\visualc.apinotes"
|
||||
copy %SDKROOT%\usr\share\winsdk.modulemap "%UniversalCRTSdkDir%\Include\%UCRTVersion%\um\module.modulemap"
|
||||
displayName: 'Configure SDK'
|
||||
- script: |
|
||||
set PATH=C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin;C:\Library\Swift-development\bin;C:\Library\icu-67\usr\bin;%PATH%
|
||||
swift.exe --version
|
||||
swift.exe build %SWIFTFLAGS%
|
||||
swift.exe build -c release %SWIFTFLAGS%
|
||||
displayName: 'Build SPM Debug & Release'
|
||||
- stage: deploy
|
||||
displayName: Deploy
|
||||
dependsOn: test
|
||||
# Deploy on tags only; test tags are excluded in trigger section.
|
||||
condition: and(not(eq(variables['Build.Reason'], 'PullRequest')), startsWith(variables['Build.SourceBranch'], 'refs/tags'))
|
||||
jobs:
|
||||
- job: ghPages
|
||||
displayName: 'Publish API docs to GH Pages'
|
||||
pool:
|
||||
vmImage: 'macOS-10.15'
|
||||
variables:
|
||||
DEVELOPER_DIR: '/Applications/Xcode_12.4.app'
|
||||
steps:
|
||||
- script: |
|
||||
set -e -o xtrace
|
||||
brew update
|
||||
brew install sourcekitten
|
||||
gem install -N jazzy
|
||||
displayName: 'Install Tools'
|
||||
- task: InstallSSHKey@0
|
||||
inputs:
|
||||
knownHostsEntry: 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ=='
|
||||
sshPublicKey: '$(swcPubDeployKey)'
|
||||
sshKeySecureFile: 'swc_deploy_key'
|
||||
displayName: 'Install an SSH key'
|
||||
- script: git worktree add docs gh-pages
|
||||
displayName: 'Prepare Worktree'
|
||||
- script: ./utils.py ci before-deploy
|
||||
displayName: 'Before Deploy'
|
||||
- script: |
|
||||
set -e -o xtrace
|
||||
git config --local user.name "Azure Pipelines"
|
||||
git config --local user.email "azuredevops@microsoft.com"
|
||||
cd docs
|
||||
git add --all
|
||||
git commit -m "Deploy to GH Pages [skip ci]" --amend
|
||||
cd ..
|
||||
git remote set-url --push origin git@github.com:tsolomko/SWCompression.git
|
||||
git push --force origin gh-pages:gh-pages
|
||||
displayName: 'Deploy to GH Pages'
|
||||
@@ -28,9 +28,6 @@ def _ci_install_macos():
|
||||
_sprun_shell(script)
|
||||
_sprun(["git", "lfs", "install"])
|
||||
|
||||
def _ci_install_linux():
|
||||
_sprun_shell("eval \"$(curl -sL https://swiftenv.fuller.li/install.sh)\"")
|
||||
|
||||
def _ci_script_macos():
|
||||
_sprun_shell("xcodebuild -version")
|
||||
_sprun(["swift", "--version"])
|
||||
@@ -45,25 +42,13 @@ def _ci_script_macos():
|
||||
# If xcodebuild is not run inside shell, then destination parameters are ignored for some reason.
|
||||
_sprun_shell(" ".join(xcodebuild_command))
|
||||
|
||||
def _ci_script_linux():
|
||||
env = os.environ.copy()
|
||||
env["SWIFTENV_ROOT"] = env["HOME"] +"/.swiftenv"
|
||||
env["PATH"] = env["SWIFTENV_ROOT"] + "/bin:" + env["SWIFTENV_ROOT"] + "/shims:"+ env["PATH"]
|
||||
_sprun(["swift", "--version"], env=env)
|
||||
_sprun(["swift", "build"], env=env)
|
||||
_sprun(["swift", "build", "-c", "release"], env=env)
|
||||
|
||||
def action_ci(args):
|
||||
if args.cmd == "before-deploy":
|
||||
_ci_before_deploy()
|
||||
elif args.cmd == "install-macos":
|
||||
_ci_install_macos()
|
||||
elif args.cmd == "install-linux":
|
||||
_ci_install_linux()
|
||||
elif args.cmd == "script-macos":
|
||||
_ci_script_macos()
|
||||
elif args.cmd == "script-linux":
|
||||
_ci_script_linux()
|
||||
else:
|
||||
raise Exception("Unknown CI command")
|
||||
|
||||
@@ -107,7 +92,7 @@ subparsers = parser.add_subparsers(title="commands", help="a command to perform"
|
||||
# Parser for 'ci' command.
|
||||
parser_ci = subparsers.add_parser("ci", help="a subset of commands used by CI",
|
||||
description="a subset of commands used by CI")
|
||||
parser_ci.add_argument("cmd", choices=["before-deploy", "install-macos", "install-linux", "script-macos", "script-linux"],
|
||||
parser_ci.add_argument("cmd", choices=["before-deploy", "install-macos", "script-macos"],
|
||||
help="a command to perform on CI", metavar="CI_CMD")
|
||||
parser_ci.set_defaults(func=action_ci)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user