diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cb61a26..d6d10b5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,6 +13,31 @@ concurrency: cancel-in-progress: true jobs: + analyze: + name: Analyze + if: github.event_name != 'workflow_dispatch' + uses: SwiftyLab/ci/.github/workflows/analyze.yml@swift-codeql + permissions: + actions: read + contents: read + security-events: write + with: + source-root: node_modules/SwiftCollections + matrix: > + { + "include": [ + { + "os": "ubuntu-latest", + "language": "swift", + "swift": "5.7" + }, + { + "os": "macos-latest", + "language": "swift" + } + ] + } + cocoapods-test: name: CocoaPods uses: SwiftyLab/ci/.github/workflows/cocoapods.yml@main diff --git a/package.json b/package.json index 2b2bcfc..7d3c785 100644 --- a/package.json +++ b/package.json @@ -16,12 +16,19 @@ }, "private": true, "dependencies": { - "fs-extra": "^11.1.0", - "swiftylab-ci": "github:SwiftyLab/ci" + "swiftylab-ci": "github:SwiftyLab/ci#swift-codeql" }, "scripts": { - "prepare": "node utils/setup.js", - "push": "node utils/push.js", + "prepare": "npm exec --package=swiftylab-ci -- setup.js", + "prepod-push": "npm exec --package=swiftylab-ci -- setup.js", + "pod-push": "npm exec --package=swiftylab-ci -- pod-push.js", "pod-lint": "npm exec --package=swiftylab-ci -- pod-lint.js" - } + }, + "podspecs": [ + "_CollectionsTestSupport.podspec", + "DequeModule.podspec", + "OrderedCollections.podspec", + "CollectionsLib.podspec", + "SwiftyCollections.podspec" + ] } diff --git a/utils/push.js b/utils/push.js deleted file mode 100755 index 4ed687e..0000000 --- a/utils/push.js +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env node -const { execSync } = require('child_process'); -const core = require('@actions/core'); - -core.startGroup(`Preparing push to CocoapPods trunk`); -execSync('npm install', { - stdio: ['inherit', 'inherit', 'inherit'], - encoding: 'utf-8' - } -); -core.endGroup(); - -[ - '_CollectionsTestSupport.podspec', - 'DequeModule.podspec', - 'OrderedCollections.podspec', - 'CollectionsLib.podspec', - 'SwiftyCollections.podspec', -].forEach((spec) => { - core.startGroup(`Pushing ${spec} to CocoapPods trunk`); - execSync(`pod trunk push --allow-warnings --synchronous --skip-tests --verbose ${spec}`, { - stdio: ['inherit', 'inherit', 'inherit'], - encoding: 'utf-8' - } - ); - core.endGroup(); -}); \ No newline at end of file diff --git a/utils/setup.js b/utils/setup.js deleted file mode 100755 index 0e307a3..0000000 --- a/utils/setup.js +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env node -const { execSync } = require('child_process'); -const fs = require('fs-extra'); -const core = require('@actions/core'); - -const destDir = 'node_modules/swift-collections'; -const package = JSON.parse(fs.readFileSync('package.json', 'utf8')); -const command = `git clone \ - "https://github.com/apple/swift-collections.git" \ - "${destDir}" \ - --branch "${package.version}" --single-branch`; -core.startGroup(`Cloning official swift-collections repo`); -fs.removeSync(destDir); -execSync(command, { - stdio: ['inherit', 'inherit', 'inherit'], - encoding: 'utf-8' - } -); -core.endGroup(); - -core.startGroup(`Copy source files for swift-collections`); -['Sources', 'Tests'].forEach((dir) => { - const source = `${destDir}/${dir}`; - fs.emptyDirSync(dir); - fs.copySync(source, dir); -}); -core.endGroup();