From 57566a2b7f569b11c16a9df00ff73927087b1a24 Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 17 Oct 2020 18:14:56 -0400 Subject: [PATCH 01/48] Update Dangerfile with comments and to perform more tests --- Dangerfile.swift | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/Dangerfile.swift b/Dangerfile.swift index 4c9ef297..beb9ee63 100644 --- a/Dangerfile.swift +++ b/Dangerfile.swift @@ -3,7 +3,9 @@ import Foundation let danger = Danger() let editedFiles = danger.git.modifiedFiles + danger.git.createdFiles +// MARK: - PR to master if danger.github.pullRequest.base.ref == "master" { + // MARK: New version (PR title) let newVersion: String if let range = danger.github.pullRequest.title.range(of: #"(?<=Version )\d+\.\d+\.\d+(?=: .+)"#, options: .regularExpression) { newVersion = String(danger.github.pullRequest.title[range]) @@ -12,11 +14,36 @@ if danger.github.pullRequest.base.ref == "master" { fail("There is no version in the pull request title!") newVersion = "0.0.0" } + //MARK: New version (.jazzy.yaml) + let jazzyVersion = String(danger.utils.readFile(".jazzy.yaml").split(separator: "\n")[4].dropFirst(17)) + let jazzyVersionUpdated: Bool + if editedFiles.contains(".jazzy.yaml") { + jazzyVersionUpdated = true + } else { + fail("Version was not updated in .jazzy.yaml!") + fail(message: "Version was not updated in .jazzy.yaml!", file: ".jazzy.yaml", line: 5) + jazzyVersionUpdated = false + } + switch (newVersion, jazzyVersionUpdated) { + case ("0.0.0", false): + fail("No new version was indicated!") + case ("0.0.0", true): + message("PR title should be amended to \"Version \(jazzyVersion): \(danger.github.pullRequest.title)\"") + case (_, false): + suggestion(code: "module_version: \(newVersion)", file: ".jazzy.yaml", line: 5) + case (_, true): + message("Version was updated in both locations!") + } if danger.github.pullRequest.title.contains("$DESCRIPTION") { fail("$DESCRIPTION placeholder has not been filled in!") } + if danger.github.pullRequest.body?.split(separator: "\n").suffix(3).map(String.init) != ["1. Wait for CI", "1. Merge", "1. Run `release.sh`"] { + warn("Remember to run `release.sh` after merging!") + } + + //MARK: Changelog edited containsChangelog: if editedFiles.contains("CHANGELOG.md") { let lineNumber = danger.utils.lines(for: "## ", inFile: "CHANGELOG.md")[1] let line = danger.utils.readFile("CHANGELOG.md").split(separator: "\n").filter { $0.hasPrefix("## ") }[1] @@ -56,6 +83,7 @@ if danger.github.pullRequest.base.ref == "master" { } } +// MARK: - Updated tests // Make sure source changes have their tests updated for file in editedFiles where file.hasPrefix("Sources/") { let dir = file.dropFirst("Sources/".count).split(separator: "/")[0] @@ -72,6 +100,7 @@ for file in editedFiles where file.hasPrefix("Sources/") { } } +//MARK: - Updated test manifests // If tests are added, ensure that they're in XCTestManifest / LinuxMain if danger.git.createdFiles.contains(where: { $0.hasPrefix("Tests/") }) { // LinuxMain doesn't need to change anymore, unless a new XCTestManifests file is added @@ -100,6 +129,7 @@ if danger.git.createdFiles.contains(where: { $0.hasPrefix("Tests/") }) { } } +// MARK: - Tasks in PR body // Check for incomplete tasks in the PR body // Note the difference between the first regex and the later two ("\n" vs "^"). // That's the "start of string" character, which I only want to match after I've split From e0de1a57e52aaba126c7acb77eb46f6c8124b7ee Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 17 Oct 2020 18:15:11 -0400 Subject: [PATCH 02/48] Make PR template easier to follow --- .github/PULL_REQUEST_TEMPLATE.md | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 4458f7c3..49350c31 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,11 +1,14 @@ ---- -name: PR to master -about: Merging development into master -title: 'Version $VERSION: $DESCRIPTION' -labels: needs-labeling -assignees: '' - ---- +If you are merging to `master`, please follow these instructions: +1. Your PR title should be "Version $VERSION: $DESCRIPTION", where $VERSION is the next version, and $DESCRIPTION is a description of your changes, in command form (i.e., "add", not "added"). + 1. Given version X.Y.Z + 1. If your change is internal/a bug fix, the next version should increment Z + 1. If your change adds a small/related new feature, the next version should increment Y and set Z to 0 + 1. If your change is breaking/major/adds a large/unrelated new feature, increment X and set Y and Z to 0. +1. Fill in the list below with your changes, referring to issues when appropriate (https://docs.github.com/articles/closing-issues-using-keywords). +1. Fill in any information you want to share, if you have any. Otherwise, remove that line. +1. Replace the first four checkboxes with any tasks that need to be completed before merging. Leave the changelog and bump version tasks in place, checking them off once you have completed them. +1. Ensure you leave the last three items alone, and at the bottom of your PR body. +1. You can now delete these instructions, so that "Here's what's new" is the first line of your PR body. Here's what's new: - A @@ -13,6 +16,8 @@ Here's what's new: - Of - Items +Any other information you want to share here + Here's what has to happen: - [ ] Anything - [ ] Specific From be7169b62d549485b5706bb1f78858b6eaf801eb Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 17 Oct 2020 18:15:54 -0400 Subject: [PATCH 03/48] Rework CI tests are now run on GitHub Actions, for PRs and pushes Travis CI now runs only Danger and documentation deployment --- .github/workflows/main.yml | 24 +++++++++++++ .github/workflows/pr.yml | 53 ---------------------------- .github/workflows/push-master.yml | 46 ------------------------ .github/workflows/push-nonmaster.yml | 25 ------------- .travis.yml | 53 +++------------------------- 5 files changed, 28 insertions(+), 173 deletions(-) create mode 100644 .github/workflows/main.yml delete mode 100644 .github/workflows/pr.yml delete mode 100644 .github/workflows/push-master.yml delete mode 100644 .github/workflows/push-nonmaster.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..fe9955b1 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,24 @@ +name: Main + +# Controls when the action will run. Since this action runs only tests, and Danger/deploy is run via Travis, run on pushes and PRs +on: [push, pull-request] + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + test: + name: Test Swift ${{ matrix.swift }}.x on ${{ matrix.os }} + strategy: + matrix: + os: [macos-latest, ubuntu-16.04, ubuntu-latest] + swift: ["4.2", "5.0", "5.1", "5.2", "5.3"] #setup-swift finds the latest bug fix version + exclude: + - os: macos-latest + swift: "4.2" #Swift 4.2 is no longer supported on macOS 10.15 (macOS-latest) + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + - uses: fwal/setup-swift@v1 + with: + swift-version: ${{ matrix.swift }} + - run: swift --version #make sure we have the version of swift we want, and that it can be seen in the logs + - run: swift test \ No newline at end of file diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml deleted file mode 100644 index 1e13df35..00000000 --- a/.github/workflows/pr.yml +++ /dev/null @@ -1,53 +0,0 @@ -# This is a basic workflow to help you get started with Actions - -name: PR - -# Controls when the action will run. Triggers the workflow on push or pull request -# events but only for the master branch -on: - pull_request: - branches: - - master - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - test: - name: Test Swift ${{ matrix.swift }}.x on ${{ matrix.os }} - strategy: - matrix: - os: [macos-latest, ubuntu-16.04, ubuntu-latest] - swift: ["4.2", "5.0", "5.1", "5.2", "5.3"] - exclude: - - os: macos-latest - swift: "5.2" - - os: macos-latest - swift: "4.2" - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v2 - - uses: fwal/setup-swift@v1 - with: - swift-version: ${{ matrix.swift }} - - run: swift --version - - run: swift test - danger: - name: Danger - runs-on: macos-latest - needs: [test] - steps: - - uses: actions/checkout@v2 - - uses: fwal/setup-swift@v1 - with: - swift-version: "5.2" - - run: swift --version - - name: Install Danger - run: | - python3 scripts/include_dev_dependencies.py - npm install -g danger - swift build - - name: Run Danger - run: swift run danger-swift ci - env: - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} - - name: Rehide dev dependencies - run: python3 scripts/remove_dev_dependencies.py diff --git a/.github/workflows/push-master.yml b/.github/workflows/push-master.yml deleted file mode 100644 index ee96f515..00000000 --- a/.github/workflows/push-master.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Push (master) - -on: - push: - branches: - - master - -jobs: - test: - name: Test Swift ${{ matrix.swift }}.x on ${{ matrix.os }} - strategy: - matrix: - os: [macos-latest, ubuntu-16.04, ubuntu-latest] - swift: ["4.2", "5.0", "5.1", "5.2"] - exclude: - - os: macos-latest - swift: "5.2" - - os: macos-latest - swift: "4.2" - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v2 - - uses: fwal/setup-swift@v1 - with: - swift-version: ${{ matrix.swift }} - - run: swift --version - - run: swift test - deploy: - name: Deploy - runs-on: macos-latest - needs: [test] - steps: - - uses: actions/checkout@v2 - - uses: fwal/setup-swift@v1 - with: - swift-version: "5" - - run: swift --version - - name: Install Danger - run: | - python3 scripts/include_dev_dependencies.py - npm install -g danger - swift build - - name: Deploy Docs - run: bash .deploy-docs.sh - env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} diff --git a/.github/workflows/push-nonmaster.yml b/.github/workflows/push-nonmaster.yml deleted file mode 100644 index b5140e4a..00000000 --- a/.github/workflows/push-nonmaster.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Push (non-master) - -on: - push: - branches-ignore: - - master - -jobs: - test: - name: Test Swift ${{ matrix.swift }}.x on ${{ matrix.os }} - strategy: - matrix: - os: [macos-latest, ubuntu-16.04, ubuntu-latest] - swift: ["4.2", "5.0", "5.1", "5.2"] - exclude: - - os: macos-latest - swift: "4.2" - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v2 - - uses: fwal/setup-swift@v1 - with: - swift-version: ${{ matrix.swift }} - - run: swift --version - - run: swift test diff --git a/.travis.yml b/.travis.yml index 89f7cd36..17c7397f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,58 +2,20 @@ language: generic dist: xenial stages: -- test - name: danger if: type = pull_request - name: deploy - if: branch = master AND type = push + if: tag IS present -os: -- osx -- linux +os: osx -osx_image: -- xcode10 -- xcode10.3 -- xcode11.3 - -env: -- SWIFT_VERSION= -- SWIFT_VERSION=4.2.4 -- SWIFT_VERSION=5.0.3 -- SWIFT_VERSION=5.1.5 -- SWIFT_VERSION=5.2.4 +osx_image: xcode11.5 jobs: - exclude: - - os: linux - osx_image: xcode10.3 - - os: linux - osx_image: xcode11.3 - - os: linux - env: SWIFT_VERSION= - - os: osx - env: SWIFT_VERSION=4.2.4 - - os: osx - env: SWIFT_VERSION=5.0.3 - - os: osx - env: SWIFT_VERSION=5.1.5 - - os: osx - env: SWIFT_VERSION=5.2.4 include: - - stage: test - if: branch != master OR type = pull_request - os: osx - osx_image: xcode11.5 - script: swift test - stage: deploy - if: branch = master AND type = push - os: osx - osx_image: xcode11.5 script: bash .deploy-docs.sh - stage: danger - os: osx - osx_image: xcode11.5 script: swift run danger-swift ci install: - python3 scripts/include_dev_dependencies.py @@ -64,11 +26,4 @@ jobs: cache: directories: - .build - - ~/.danger-swift - -install: -- eval "$(curl -sL https://swiftenv.fuller.li/install.sh || curl -sL https://raw.githubusercontent.com/kylef/swiftenv/master/docs/install.sh)" -- swift --version - -script: -- swift test + - ~/.danger-swift \ No newline at end of file From f9721e6e84f612b8430f53776035c1daee5a95c6 Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 17 Oct 2020 18:16:23 -0400 Subject: [PATCH 04/48] Add Package.resolved.danger --- Package.resolved.danger | 88 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 Package.resolved.danger diff --git a/Package.resolved.danger b/Package.resolved.danger new file mode 100644 index 00000000..ec9788a9 --- /dev/null +++ b/Package.resolved.danger @@ -0,0 +1,88 @@ +{ + "object": { + "pins": [ + { + "package": "Files", + "repositoryURL": "https://github.com/JohnSundell/Files.git", + "state": { + "branch": null, + "revision": "a84615f4558151fab52ac38df697ce2442991f93", + "version": "2.3.0" + } + }, + { + "package": "Logger", + "repositoryURL": "https://github.com/shibapm/Logger", + "state": { + "branch": null, + "revision": "53c3ecca5abe8cf46697e33901ee774236d94cce", + "version": "0.2.3" + } + }, + { + "package": "Marathon", + "repositoryURL": "https://github.com/JohnSundell/Marathon", + "state": { + "branch": null, + "revision": "35b672e05ac411fb104e462fbfd6541f995abc17", + "version": "3.3.0" + } + }, + { + "package": "OctoKit", + "repositoryURL": "https://github.com/nerdishbynature/octokit.swift", + "state": { + "branch": null, + "revision": "c391cfba4d33f3f4c7d7d8fa6708970f7d30af82", + "version": "0.10.1" + } + }, + { + "package": "Releases", + "repositoryURL": "https://github.com/JohnSundell/Releases.git", + "state": { + "branch": null, + "revision": "ea62f33a429185b0ed21344c2355862c5bc4fcce", + "version": "4.0.0" + } + }, + { + "package": "RequestKit", + "repositoryURL": "https://github.com/nerdishbynature/RequestKit.git", + "state": { + "branch": null, + "revision": "fd5e9e99aada7432170366c9e95967011ce13bad", + "version": "2.4.0" + } + }, + { + "package": "Require", + "repositoryURL": "https://github.com/JohnSundell/Require.git", + "state": { + "branch": null, + "revision": "7cfbd0d8a2dede0e01f6f0d8ab2c7acef1df112e", + "version": "2.0.1" + } + }, + { + "package": "ShellOut", + "repositoryURL": "https://github.com/JohnSundell/ShellOut.git", + "state": { + "branch": null, + "revision": "e1577acf2b6e90086d01a6d5e2b8efdaae033568", + "version": "2.3.0" + } + }, + { + "package": "danger-swift", + "repositoryURL": "https://github.com/danger/swift.git", + "state": { + "branch": null, + "revision": "33d35bf94f54155be505ffecfca745e4cc1cd0cc", + "version": "1.6.5" + } + } + ] + }, + "version": 1 +} From 6edd65b59a44743f424107290bd9a784b35d550d Mon Sep 17 00:00:00 2001 From: Sam <30577766+Samasaur1@users.noreply.github.com> Date: Sat, 17 Oct 2020 18:17:40 -0400 Subject: [PATCH 05/48] Fix GitHub Actions PR trigger --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fe9955b1..27553198 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,7 +1,7 @@ name: Main # Controls when the action will run. Since this action runs only tests, and Danger/deploy is run via Travis, run on pushes and PRs -on: [push, pull-request] +on: [push, pull_request] # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: @@ -21,4 +21,4 @@ jobs: with: swift-version: ${{ matrix.swift }} - run: swift --version #make sure we have the version of swift we want, and that it can be seen in the logs - - run: swift test \ No newline at end of file + - run: swift test From b09d1f32a015e162d9ba100e91f747ace75307ef Mon Sep 17 00:00:00 2001 From: Sam <30577766+Samasaur1@users.noreply.github.com> Date: Sat, 17 Oct 2020 18:38:02 -0400 Subject: [PATCH 06/48] Don't test 5.3 on ubuntu-latest I don't know why, but this is taking like 15 minutes and counting to install --- .github/workflows/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 27553198..5978896e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,6 +14,8 @@ jobs: exclude: - os: macos-latest swift: "4.2" #Swift 4.2 is no longer supported on macOS 10.15 (macOS-latest) + - os: ubunut-latest + swift: "5.3" #Not sure why, but this isn't working runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 From ad2a0972fcc02ea22f0e60181e4354e1eb036a04 Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 31 Oct 2020 13:30:08 -0400 Subject: [PATCH 07/48] Skip Swift 5.2 on macOS and fix Hound complaints --- .github/workflows/main.yml | 4 ++-- Dangerfile.swift | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5978896e..9c1b1cb4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,8 +14,8 @@ jobs: exclude: - os: macos-latest swift: "4.2" #Swift 4.2 is no longer supported on macOS 10.15 (macOS-latest) - - os: ubunut-latest - swift: "5.3" #Not sure why, but this isn't working + - os: macos-latest + swift: "5.2" #Not sure why, but this isn't working runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 diff --git a/Dangerfile.swift b/Dangerfile.swift index beb9ee63..4816c3bf 100644 --- a/Dangerfile.swift +++ b/Dangerfile.swift @@ -14,7 +14,7 @@ if danger.github.pullRequest.base.ref == "master" { fail("There is no version in the pull request title!") newVersion = "0.0.0" } - //MARK: New version (.jazzy.yaml) + // MARK: New version (.jazzy.yaml) let jazzyVersion = String(danger.utils.readFile(".jazzy.yaml").split(separator: "\n")[4].dropFirst(17)) let jazzyVersionUpdated: Bool if editedFiles.contains(".jazzy.yaml") { @@ -43,7 +43,7 @@ if danger.github.pullRequest.base.ref == "master" { warn("Remember to run `release.sh` after merging!") } - //MARK: Changelog edited + // MARK: Changelog edited containsChangelog: if editedFiles.contains("CHANGELOG.md") { let lineNumber = danger.utils.lines(for: "## ", inFile: "CHANGELOG.md")[1] let line = danger.utils.readFile("CHANGELOG.md").split(separator: "\n").filter { $0.hasPrefix("## ") }[1] @@ -100,7 +100,7 @@ for file in editedFiles where file.hasPrefix("Sources/") { } } -//MARK: - Updated test manifests +// MARK: - Updated test manifests // If tests are added, ensure that they're in XCTestManifest / LinuxMain if danger.git.createdFiles.contains(where: { $0.hasPrefix("Tests/") }) { // LinuxMain doesn't need to change anymore, unless a new XCTestManifests file is added From 0d6580d922a9fe288e3a8b3fa6d0bdd34dffcde3 Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 31 Oct 2020 14:45:32 -0400 Subject: [PATCH 08/48] Update Dangerfile for new behavior The idea is that all PRs will be to master, but that only some PRs will be a 'new version'. --- Dangerfile.swift | 124 +++++++++++++++++++++------------------- Package.resolved.danger | 88 ---------------------------- 2 files changed, 66 insertions(+), 146 deletions(-) delete mode 100644 Package.resolved.danger diff --git a/Dangerfile.swift b/Dangerfile.swift index 4816c3bf..2e9312a0 100644 --- a/Dangerfile.swift +++ b/Dangerfile.swift @@ -3,87 +3,95 @@ import Foundation let danger = Danger() let editedFiles = danger.git.modifiedFiles + danger.git.createdFiles -// MARK: - PR to master -if danger.github.pullRequest.base.ref == "master" { - // MARK: New version (PR title) - let newVersion: String - if let range = danger.github.pullRequest.title.range(of: #"(?<=Version )\d+\.\d+\.\d+(?=: .+)"#, options: .regularExpression) { - newVersion = String(danger.github.pullRequest.title[range]) - message("The new version is v\(newVersion)") +// MARK: - New Version PR +if let range = danger.github.pullRequest.title.range(of: #"(?<=Version )\d+\.\d+\.\d+(?=: .+)"#, options: .regularExpression) { + if danger.github.pullRequest.base.ref != "master" { + fail("PRs to non-`master` branches should not have \"Version X.Y.Z\" in the PR title") } else { - fail("There is no version in the pull request title!") - newVersion = "0.0.0" + message("Pull request to `master` for new version detected") } + // MARK: New version (PR title) + let newVersion = String(danger.github.pullRequest.title[range]) + message("The new version is v\(newVersion)") // MARK: New version (.jazzy.yaml) let jazzyVersion = String(danger.utils.readFile(".jazzy.yaml").split(separator: "\n")[4].dropFirst(17)) - let jazzyVersionUpdated: Bool if editedFiles.contains(".jazzy.yaml") { - jazzyVersionUpdated = true + message("Version in .jazzy.yaml agrees with PR title") } else { fail("Version was not updated in .jazzy.yaml!") fail(message: "Version was not updated in .jazzy.yaml!", file: ".jazzy.yaml", line: 5) - jazzyVersionUpdated = false } - switch (newVersion, jazzyVersionUpdated) { - case ("0.0.0", false): - fail("No new version was indicated!") - case ("0.0.0", true): - message("PR title should be amended to \"Version \(jazzyVersion): \(danger.github.pullRequest.title)\"") - case (_, false): + if newVersion == jazzyVersion { + message("PR title and .jazzy.yaml agree") + } else { + fail("PR title specifies version \(newVersion), while .jazzy.yaml specifies \(jazzyVersion)") suggestion(code: "module_version: \(newVersion)", file: ".jazzy.yaml", line: 5) - case (_, true): - message("Version was updated in both locations!") - } - - if danger.github.pullRequest.title.contains("$DESCRIPTION") { - fail("$DESCRIPTION placeholder has not been filled in!") } - if danger.github.pullRequest.body?.split(separator: "\n").suffix(3).map(String.init) != ["1. Wait for CI", "1. Merge", "1. Run `release.sh`"] { - warn("Remember to run `release.sh` after merging!") - } - - // MARK: Changelog edited - containsChangelog: if editedFiles.contains("CHANGELOG.md") { - let lineNumber = danger.utils.lines(for: "## ", inFile: "CHANGELOG.md")[1] - let line = danger.utils.readFile("CHANGELOG.md").split(separator: "\n").filter { $0.hasPrefix("## ") }[1] - let dateString = String(line.drop { $0 != "]" }.dropFirst(4)) + // MARK: Changelog entry + if let lineNumber = danger.utils.lines(for: "## [\(newVersion)]", inFile: "CHANGELOG.md").first, let line = danger.utils.readFile("CHANGELOG.md").split(separator: "\n").first(where: { $0.hasPrefix("## [\(newVersion)]") }) { + message("There is a CHANGELOG entry for this version") + let dateString = String(line.dropFirst("## [\(newVersion)] - ".count)) let df = DateFormatter() df.dateFormat = "yyyy-MM-dd" - let todaysDate = df.string(from: Date()) - guard df.date(from: dateString) != nil else { - fail("Illegal date string in CHANGELOG!: '\(dateString)'") - fail(message: "Illegal date string in CHANGELOG!", file: "CHANGELOG.md", line: lineNumber) - suggestion(code: "## [\(newVersion)] - \(todaysDate)", file: "CHANGELOG.md", line: lineNumber) - break containsChangelog + if df.string(from: Date()) == dateString { + message("The date for this version's entry is today, \(dateString)") + } else { + fail("The date for this version's entry is not today!") + fail(message: "The date for this version's entry is not today!", file: "CHANGELOG.md", line: lineNumber) + suggestion(code: "## [\(newVersion)] — \(df.string(from: Date()))", file: "CHANGELOG.md", line: lineNumber) } - if todaysDate != dateString { - fail("The latest date in the CHANGELOG is not today!") - fail(message: "The latest date in the CHANGELOG is not today!", file: "CHANGELOG.md", line: lineNumber) - suggestion(code: "## [\(newVersion)] - \(todaysDate)", file: "CHANGELOG.md", line: lineNumber) + // MARK: Changelog compare link + if let upcomingLineNumber = danger.utils.lines(for: "[Upcoming]:", inFile: "CHANGELOG.md").first, + let upcomingLine = danger.utils.readFile("CHANGELOG.md").split(separator: "\n").first(where: { $0.hasPrefix("[Upcoming]:") }) { + if upcomingLine == "[Upcoming]: https://github.com/Samasaur1/DiceKit/compare/v\(newVersion)...master" { + message("Upcoming link was updated to show changes between latest version and `master`") + } else { + fail("Upcoming link was not updated to show the latest changes") + suggestion(code: "[Upcoming]: https://github.com/Samasaur1/DiceKit/compare/v\(newVersion)...master", file: "CHANGELOG.md", line: upcomingLineNumber) + } } else { - message("The latest date in the CHANGELOG is today, \(dateString)") + fail("The upcoming changes compare link line is missing!") } - } else { - if FileManager.default.fileExists(atPath: "CHANGELOG.md") { - fail("The CHANGELOG was not updated") + if let linkLineNumber = danger.utils.lines(for: "[\(newVersion)]:", inFile: "CHANGELOG.md").first, + let linkLine = danger.utils.readFile("CHANGELOG.md").split(separator: "\n").first(where: { $0.hasPrefix("[\(newVersion)]:") }) { + if linkLine.hasSuffix("...v\(newVersion)") { + message("Link line compares to the new version") + } else { + fail(message: "Link line does not compare to the new version, v\(newVersion)", file: "CHANGELOG.md", line: linkLineNumber) + } } else { - warn("There is no CHANGELOG!") + fail("There is no link line to compare the new version to the previous version!") } + } else { + fail("There is no CAHNGELOG entry for this version!") + } +} else { // MARK: - Non-new version PR + message("Non-new version PR detected, to branch \(danger.github.pullRequest.base.ref)") + if danger.github.pullRequest.base.ref != "master" { + warn("Most PRs should be made directly to `master`. If you know why you're making it to a different branch, ignore this warning.") + } + if danger.github.pullRequest.head.repo.fullName == "Samasaur1/DiceKit" { + message("Internal PR detected") + } else { + message("PR from fork detected — thanks for contributing!") } +} + +// MARK: - All PRs + +// MARK: Changelog updated +if editedFiles.contains("CHANGELOG.md") { + message("The CHANGELOG was updated") } else { - if editedFiles.contains("CHANGELOG.md") { - message("The CHANGELOG was updated!") + if FileManager.default.fileExists(atPath: "CHANGELOG.md") { + fail("The CHANGELOG was not updated! (put your changes in the UPCOMING section)") } else { - if FileManager.default.fileExists(atPath: "CHANGELOG.md") { - fail("The CHANGELOG was not updated! (put your changes in the UPCOMING section)") - } else { - warn("There is no CHANGELOG!") - } + warn("There is no CHANGELOG!") } } -// MARK: - Updated tests +// MARK: Updated tests // Make sure source changes have their tests updated for file in editedFiles where file.hasPrefix("Sources/") { let dir = file.dropFirst("Sources/".count).split(separator: "/")[0] @@ -100,7 +108,7 @@ for file in editedFiles where file.hasPrefix("Sources/") { } } -// MARK: - Updated test manifests +// MARK: Updated test manifests // If tests are added, ensure that they're in XCTestManifest / LinuxMain if danger.git.createdFiles.contains(where: { $0.hasPrefix("Tests/") }) { // LinuxMain doesn't need to change anymore, unless a new XCTestManifests file is added @@ -129,7 +137,7 @@ if danger.git.createdFiles.contains(where: { $0.hasPrefix("Tests/") }) { } } -// MARK: - Tasks in PR body +// MARK: Tasks in PR body // Check for incomplete tasks in the PR body // Note the difference between the first regex and the later two ("\n" vs "^"). // That's the "start of string" character, which I only want to match after I've split diff --git a/Package.resolved.danger b/Package.resolved.danger deleted file mode 100644 index ec9788a9..00000000 --- a/Package.resolved.danger +++ /dev/null @@ -1,88 +0,0 @@ -{ - "object": { - "pins": [ - { - "package": "Files", - "repositoryURL": "https://github.com/JohnSundell/Files.git", - "state": { - "branch": null, - "revision": "a84615f4558151fab52ac38df697ce2442991f93", - "version": "2.3.0" - } - }, - { - "package": "Logger", - "repositoryURL": "https://github.com/shibapm/Logger", - "state": { - "branch": null, - "revision": "53c3ecca5abe8cf46697e33901ee774236d94cce", - "version": "0.2.3" - } - }, - { - "package": "Marathon", - "repositoryURL": "https://github.com/JohnSundell/Marathon", - "state": { - "branch": null, - "revision": "35b672e05ac411fb104e462fbfd6541f995abc17", - "version": "3.3.0" - } - }, - { - "package": "OctoKit", - "repositoryURL": "https://github.com/nerdishbynature/octokit.swift", - "state": { - "branch": null, - "revision": "c391cfba4d33f3f4c7d7d8fa6708970f7d30af82", - "version": "0.10.1" - } - }, - { - "package": "Releases", - "repositoryURL": "https://github.com/JohnSundell/Releases.git", - "state": { - "branch": null, - "revision": "ea62f33a429185b0ed21344c2355862c5bc4fcce", - "version": "4.0.0" - } - }, - { - "package": "RequestKit", - "repositoryURL": "https://github.com/nerdishbynature/RequestKit.git", - "state": { - "branch": null, - "revision": "fd5e9e99aada7432170366c9e95967011ce13bad", - "version": "2.4.0" - } - }, - { - "package": "Require", - "repositoryURL": "https://github.com/JohnSundell/Require.git", - "state": { - "branch": null, - "revision": "7cfbd0d8a2dede0e01f6f0d8ab2c7acef1df112e", - "version": "2.0.1" - } - }, - { - "package": "ShellOut", - "repositoryURL": "https://github.com/JohnSundell/ShellOut.git", - "state": { - "branch": null, - "revision": "e1577acf2b6e90086d01a6d5e2b8efdaae033568", - "version": "2.3.0" - } - }, - { - "package": "danger-swift", - "repositoryURL": "https://github.com/danger/swift.git", - "state": { - "branch": null, - "revision": "33d35bf94f54155be505ffecfca745e4cc1cd0cc", - "version": "1.6.5" - } - } - ] - }, - "version": 1 -} From eb649bc58dd144a4d2b2956cd6e33239c14c1446 Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 31 Oct 2020 15:02:49 -0400 Subject: [PATCH 09/48] Fix misspelling and read full Jazzy version --- Dangerfile.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dangerfile.swift b/Dangerfile.swift index 2e9312a0..837c9083 100644 --- a/Dangerfile.swift +++ b/Dangerfile.swift @@ -14,7 +14,7 @@ if let range = danger.github.pullRequest.title.range(of: #"(?<=Version )\d+\.\d+ let newVersion = String(danger.github.pullRequest.title[range]) message("The new version is v\(newVersion)") // MARK: New version (.jazzy.yaml) - let jazzyVersion = String(danger.utils.readFile(".jazzy.yaml").split(separator: "\n")[4].dropFirst(17)) + let jazzyVersion = String(danger.utils.readFile(".jazzy.yaml").split(separator: "\n")[4].dropFirst(16)) if editedFiles.contains(".jazzy.yaml") { message("Version in .jazzy.yaml agrees with PR title") } else { @@ -64,7 +64,7 @@ if let range = danger.github.pullRequest.title.range(of: #"(?<=Version )\d+\.\d+ fail("There is no link line to compare the new version to the previous version!") } } else { - fail("There is no CAHNGELOG entry for this version!") + fail("There is no CHANGELOG entry for this version!") } } else { // MARK: - Non-new version PR message("Non-new version PR detected, to branch \(danger.github.pullRequest.base.ref)") From 7bc2f92b11f9a512f17ae50e9042b1908add4b83 Mon Sep 17 00:00:00 2001 From: Sam <30577766+Samasaur1@users.noreply.github.com> Date: Sat, 31 Oct 2020 15:10:35 -0400 Subject: [PATCH 10/48] Include Swift 5.2 on macOS It probably won't work, but I should keep trying. --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9c1b1cb4..1151f2b6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,8 +14,8 @@ jobs: exclude: - os: macos-latest swift: "4.2" #Swift 4.2 is no longer supported on macOS 10.15 (macOS-latest) - - os: macos-latest - swift: "5.2" #Not sure why, but this isn't working +# - os: macos-latest +# swift: "5.2" #Not sure why, but this isn't working runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 From 684ee954a6a0f8ee2e0e8bd73bca636ee1118d68 Mon Sep 17 00:00:00 2001 From: Sam <30577766+Samasaur1@users.noreply.github.com> Date: Sat, 31 Oct 2020 18:46:32 -0400 Subject: [PATCH 11/48] Use both Danger tokens --- .travis.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 17c7397f..0687e8d8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,9 @@ jobs: - stage: deploy script: bash .deploy-docs.sh - stage: danger + env: + - DANGER_GITHUB_API_TOKEN=$DANGER_GITHUB_API_TOKEN_BOT_ACCOUNT + - DANGER_GITHUB_API_TOKEN=$DANGER_GITHUB_API_TOKEN_MAIN_ACCOUNT script: swift run danger-swift ci install: - python3 scripts/include_dev_dependencies.py @@ -26,4 +29,4 @@ jobs: cache: directories: - .build - - ~/.danger-swift \ No newline at end of file + - ~/.danger-swift From 5a5d0145c036ae5ca2942428e1ea462ebe39c7e2 Mon Sep 17 00:00:00 2001 From: Sam <30577766+Samasaur1@users.noreply.github.com> Date: Sat, 31 Oct 2020 18:53:27 -0400 Subject: [PATCH 12/48] Run Danger as two separate jobs --- .travis.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0687e8d8..3975ee5d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,14 +16,22 @@ jobs: - stage: deploy script: bash .deploy-docs.sh - stage: danger + name: "Bot account (issue comment)" env: - DANGER_GITHUB_API_TOKEN=$DANGER_GITHUB_API_TOKEN_BOT_ACCOUNT + script: swift run danger-swift ci + install: + - python3 scripts/include_dev_dependencies.py + - npm install -g danger + after_success: python3 scripts/remove_dev_dependencies.py + - stage: danger + name: "Main account (status check)" + env: - DANGER_GITHUB_API_TOKEN=$DANGER_GITHUB_API_TOKEN_MAIN_ACCOUNT script: swift run danger-swift ci install: - python3 scripts/include_dev_dependencies.py - npm install -g danger - - swift build after_success: python3 scripts/remove_dev_dependencies.py cache: From b9a231a428061a97a309d9349a1d5b0159e8b2c2 Mon Sep 17 00:00:00 2001 From: Sam <30577766+Samasaur1@users.noreply.github.com> Date: Sat, 31 Oct 2020 18:57:49 -0400 Subject: [PATCH 13/48] Build danger-swift before running --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 3975ee5d..daf6f54b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,6 +23,7 @@ jobs: install: - python3 scripts/include_dev_dependencies.py - npm install -g danger + - swift build after_success: python3 scripts/remove_dev_dependencies.py - stage: danger name: "Main account (status check)" @@ -32,6 +33,7 @@ jobs: install: - python3 scripts/include_dev_dependencies.py - npm install -g danger + - swift build after_success: python3 scripts/remove_dev_dependencies.py cache: From 4ab8a1e7d873f043b69a668a4fdb51705c2a007c Mon Sep 17 00:00:00 2001 From: Sam <30577766+Samasaur1@users.noreply.github.com> Date: Sat, 31 Oct 2020 20:20:19 -0400 Subject: [PATCH 14/48] Explicitly use GitHub checks I tried to figure out how danger/swift and danger/js interact, and I think I more or less got it, but unless this works I think I will need to make a feature request --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index daf6f54b..4dcf8245 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ jobs: name: "Bot account (issue comment)" env: - DANGER_GITHUB_API_TOKEN=$DANGER_GITHUB_API_TOKEN_BOT_ACCOUNT - script: swift run danger-swift ci + script: swift run danger-swift ci --use-github-checks install: - python3 scripts/include_dev_dependencies.py - npm install -g danger @@ -29,7 +29,7 @@ jobs: name: "Main account (status check)" env: - DANGER_GITHUB_API_TOKEN=$DANGER_GITHUB_API_TOKEN_MAIN_ACCOUNT - script: swift run danger-swift ci + script: swift run danger-swift ci --use-github-checks install: - python3 scripts/include_dev_dependencies.py - npm install -g danger From 4c59b4d0e41c561bf455f9bca92172be6f69b289 Mon Sep 17 00:00:00 2001 From: Samasaur1 <30577766+Samasaur1@users.noreply.github.com> Date: Thu, 2 Jun 2022 18:09:25 -0400 Subject: [PATCH 15/48] Use current versions of Swift and OSs --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1151f2b6..ee5aa562 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,8 +9,8 @@ jobs: name: Test Swift ${{ matrix.swift }}.x on ${{ matrix.os }} strategy: matrix: - os: [macos-latest, ubuntu-16.04, ubuntu-latest] - swift: ["4.2", "5.0", "5.1", "5.2", "5.3"] #setup-swift finds the latest bug fix version + os: [macos-10.15, macos-11, macos-12, ubuntu-18.04, ubuntu-20.04, ubuntu-22.04] + swift: ["4.2", "5.0", "5.1", "5.2", "5.3", "5.4", "5.5"] #setup-swift finds the latest bug fix version exclude: - os: macos-latest swift: "4.2" #Swift 4.2 is no longer supported on macOS 10.15 (macOS-latest) From 74a5c79cd2f3ec13e7baf00d51a29b306a5aab53 Mon Sep 17 00:00:00 2001 From: Samasaur1 <30577766+Samasaur1@users.noreply.github.com> Date: Thu, 2 Jun 2022 18:13:49 -0400 Subject: [PATCH 16/48] Temporarily disable multiple Swift versions --- .github/workflows/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ee5aa562..866e6862 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,7 +10,7 @@ jobs: strategy: matrix: os: [macos-10.15, macos-11, macos-12, ubuntu-18.04, ubuntu-20.04, ubuntu-22.04] - swift: ["4.2", "5.0", "5.1", "5.2", "5.3", "5.4", "5.5"] #setup-swift finds the latest bug fix version + #swift: ["4.2", "5.0", "5.1", "5.2", "5.3", "5.4", "5.5"] #setup-swift finds the latest bug fix version exclude: - os: macos-latest swift: "4.2" #Swift 4.2 is no longer supported on macOS 10.15 (macOS-latest) @@ -20,7 +20,7 @@ jobs: steps: - uses: actions/checkout@v2 - uses: fwal/setup-swift@v1 - with: - swift-version: ${{ matrix.swift }} + #with: + #swift-version: ${{ matrix.swift }} - run: swift --version #make sure we have the version of swift we want, and that it can be seen in the logs - run: swift test From 1e256636960a9c0d7ecfcaf655d330f49724c9e9 Mon Sep 17 00:00:00 2001 From: Samasaur1 <30577766+Samasaur1@users.noreply.github.com> Date: Thu, 2 Jun 2022 18:14:39 -0400 Subject: [PATCH 17/48] Actually disable Swift versions --- .github/workflows/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 866e6862..74d1d56e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,9 +11,9 @@ jobs: matrix: os: [macos-10.15, macos-11, macos-12, ubuntu-18.04, ubuntu-20.04, ubuntu-22.04] #swift: ["4.2", "5.0", "5.1", "5.2", "5.3", "5.4", "5.5"] #setup-swift finds the latest bug fix version - exclude: - - os: macos-latest - swift: "4.2" #Swift 4.2 is no longer supported on macOS 10.15 (macOS-latest) + #exclude: + #- os: macos-latest + #swift: "4.2" #Swift 4.2 is no longer supported on macOS 10.15 (macOS-latest) # - os: macos-latest # swift: "5.2" #Not sure why, but this isn't working runs-on: ${{ matrix.os }} From 905ff18bdefe42d58290cff6d43920a23177d76e Mon Sep 17 00:00:00 2001 From: Samasaur1 <30577766+Samasaur1@users.noreply.github.com> Date: Thu, 2 Jun 2022 18:16:17 -0400 Subject: [PATCH 18/48] Disable Ubuntu 22.04 --- .github/workflows/main.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 74d1d56e..849b78d4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,7 +9,8 @@ jobs: name: Test Swift ${{ matrix.swift }}.x on ${{ matrix.os }} strategy: matrix: - os: [macos-10.15, macos-11, macos-12, ubuntu-18.04, ubuntu-20.04, ubuntu-22.04] + #os: [macos-10.15, macos-11, macos-12, ubuntu-18.04, ubuntu-20.04, ubuntu-22.04] + os: [macos-10.15, macos-11, macos-12, ubuntu-18.04, ubuntu-20.04] #swift: ["4.2", "5.0", "5.1", "5.2", "5.3", "5.4", "5.5"] #setup-swift finds the latest bug fix version #exclude: #- os: macos-latest @@ -19,7 +20,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 - - uses: fwal/setup-swift@v1 + - uses: swift-actions/setup-swift@v1 #with: #swift-version: ${{ matrix.swift }} - run: swift --version #make sure we have the version of swift we want, and that it can be seen in the logs From 7c3e4b3bae03c91c678c670a1193b831cb4d3234 Mon Sep 17 00:00:00 2001 From: Samasaur1 <30577766+Samasaur1@users.noreply.github.com> Date: Thu, 2 Jun 2022 19:37:13 -0400 Subject: [PATCH 19/48] Try to use Danger This might fail without an API token --- .github/workflows/danger.yml | 30 ++++++++++++++++++++++++++++++ .github/workflows/test.yml | 27 +++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 .github/workflows/danger.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml new file mode 100644 index 00000000..dbb5ac01 --- /dev/null +++ b/.github/workflows/danger.yml @@ -0,0 +1,30 @@ +name: danger + +# Controls when the action will run. This action runs Danger, so run on PRs only +on: pull_request + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + test: + name: Test Swift ${{ matrix.swift }}.x on ${{ matrix.os }} + strategy: + matrix: + #os: [macos-10.15, macos-11, macos-12, ubuntu-18.04, ubuntu-20.04, ubuntu-22.04] + os: macos-latest + #swift: ["4.2", "5.0", "5.1", "5.2", "5.3", "5.4", "5.5"] #setup-swift finds the latest bug fix version + #exclude: + #- os: macos-latest + #swift: "4.2" #Swift 4.2 is no longer supported on macOS 10.15 (macOS-latest) +# - os: macos-latest +# swift: "5.2" #Not sure why, but this isn't working + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + - uses: swift-actions/setup-swift@v1 + #with: + #swift-version: ${{ matrix.swift }} + - run: swift --version #make sure we have the version of swift we want, and that it can be seen in the logs + - run: python3 scripts/include_dev_dependencies.py + - run: npm install -g danger + - run: swift build + - run: swift run danger-swift ci --use-github-checks diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..dbfbd711 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,27 @@ +name: tests + +# Controls when the action will run. Since this action runs only tests, run on pushes and PRs +on: [push, pull_request] + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + test: + name: Test Swift ${{ matrix.swift }}.x on ${{ matrix.os }} + strategy: + matrix: + #os: [macos-10.15, macos-11, macos-12, ubuntu-18.04, ubuntu-20.04, ubuntu-22.04] + os: [macos-10.15, macos-11, macos-12, ubuntu-18.04, ubuntu-20.04] + #swift: ["4.2", "5.0", "5.1", "5.2", "5.3", "5.4", "5.5"] #setup-swift finds the latest bug fix version + #exclude: + #- os: macos-latest + #swift: "4.2" #Swift 4.2 is no longer supported on macOS 10.15 (macOS-latest) +# - os: macos-latest +# swift: "5.2" #Not sure why, but this isn't working + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + - uses: swift-actions/setup-swift@v1 + #with: + #swift-version: ${{ matrix.swift }} + - run: swift --version #make sure we have the version of swift we want, and that it can be seen in the logs + - run: swift test From 929519e93b597d6c75945c9c73402dc57a1dce0e Mon Sep 17 00:00:00 2001 From: Samasaur1 <30577766+Samasaur1@users.noreply.github.com> Date: Thu, 2 Jun 2022 19:38:34 -0400 Subject: [PATCH 20/48] Fix Danger workflow file --- .github/workflows/danger.yml | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml index dbb5ac01..d1e5da2e 100644 --- a/.github/workflows/danger.yml +++ b/.github/workflows/danger.yml @@ -6,23 +6,11 @@ on: pull_request # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: test: - name: Test Swift ${{ matrix.swift }}.x on ${{ matrix.os }} - strategy: - matrix: - #os: [macos-10.15, macos-11, macos-12, ubuntu-18.04, ubuntu-20.04, ubuntu-22.04] - os: macos-latest - #swift: ["4.2", "5.0", "5.1", "5.2", "5.3", "5.4", "5.5"] #setup-swift finds the latest bug fix version - #exclude: - #- os: macos-latest - #swift: "4.2" #Swift 4.2 is no longer supported on macOS 10.15 (macOS-latest) -# - os: macos-latest -# swift: "5.2" #Not sure why, but this isn't working - runs-on: ${{ matrix.os }} + name: Run Danger + runs-on: macos-latest steps: - uses: actions/checkout@v2 - uses: swift-actions/setup-swift@v1 - #with: - #swift-version: ${{ matrix.swift }} - run: swift --version #make sure we have the version of swift we want, and that it can be seen in the logs - run: python3 scripts/include_dev_dependencies.py - run: npm install -g danger From af41743e25008590814d8d096a704a58c855240b Mon Sep 17 00:00:00 2001 From: Samasaur1 <30577766+Samasaur1@users.noreply.github.com> Date: Thu, 2 Jun 2022 20:01:32 -0400 Subject: [PATCH 21/48] Add github token to Danger --- .github/workflows/danger.yml | 5 ++++- .github/workflows/main.yml | 27 --------------------------- 2 files changed, 4 insertions(+), 28 deletions(-) delete mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml index d1e5da2e..1c101c13 100644 --- a/.github/workflows/danger.yml +++ b/.github/workflows/danger.yml @@ -15,4 +15,7 @@ jobs: - run: python3 scripts/include_dev_dependencies.py - run: npm install -g danger - run: swift build - - run: swift run danger-swift ci --use-github-checks + - run: swift run danger-swift ci --use-github-checks --verbose + env: + DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 849b78d4..00000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Main - -# Controls when the action will run. Since this action runs only tests, and Danger/deploy is run via Travis, run on pushes and PRs -on: [push, pull_request] - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - test: - name: Test Swift ${{ matrix.swift }}.x on ${{ matrix.os }} - strategy: - matrix: - #os: [macos-10.15, macos-11, macos-12, ubuntu-18.04, ubuntu-20.04, ubuntu-22.04] - os: [macos-10.15, macos-11, macos-12, ubuntu-18.04, ubuntu-20.04] - #swift: ["4.2", "5.0", "5.1", "5.2", "5.3", "5.4", "5.5"] #setup-swift finds the latest bug fix version - #exclude: - #- os: macos-latest - #swift: "4.2" #Swift 4.2 is no longer supported on macOS 10.15 (macOS-latest) -# - os: macos-latest -# swift: "5.2" #Not sure why, but this isn't working - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v2 - - uses: swift-actions/setup-swift@v1 - #with: - #swift-version: ${{ matrix.swift }} - - run: swift --version #make sure we have the version of swift we want, and that it can be seen in the logs - - run: swift test From bb95b8efff9f152c9f463eaf5f33ba44956c75a0 Mon Sep 17 00:00:00 2001 From: Samasaur1 <30577766+Samasaur1@users.noreply.github.com> Date: Thu, 2 Jun 2022 20:39:40 -0400 Subject: [PATCH 22/48] Use prebundled version of Swift to try and avoid inconsistency --- .github/workflows/danger.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml index 1c101c13..a1491650 100644 --- a/.github/workflows/danger.yml +++ b/.github/workflows/danger.yml @@ -10,7 +10,7 @@ jobs: runs-on: macos-latest steps: - uses: actions/checkout@v2 - - uses: swift-actions/setup-swift@v1 + #- uses: swift-actions/setup-swift@v1 - run: swift --version #make sure we have the version of swift we want, and that it can be seen in the logs - run: python3 scripts/include_dev_dependencies.py - run: npm install -g danger From 44a9a53a9fc865e2ad7245b4066895d0214a5507 Mon Sep 17 00:00:00 2001 From: Samasaur1 <30577766+Samasaur1@users.noreply.github.com> Date: Fri, 3 Jun 2022 09:41:15 -0400 Subject: [PATCH 23/48] Use Swift 5.3 for Danger --- .github/workflows/danger.yml | 21 ----------- .github/workflows/pr.yml | 53 ++++++++++++++++++++++++++++ .github/workflows/push-master.yml | 46 ++++++++++++++++++++++++ .github/workflows/push-nonmaster.yml | 25 +++++++++++++ .github/workflows/test.yml | 27 -------------- 5 files changed, 124 insertions(+), 48 deletions(-) delete mode 100644 .github/workflows/danger.yml create mode 100644 .github/workflows/pr.yml create mode 100644 .github/workflows/push-master.yml create mode 100644 .github/workflows/push-nonmaster.yml delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml deleted file mode 100644 index a1491650..00000000 --- a/.github/workflows/danger.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: danger - -# Controls when the action will run. This action runs Danger, so run on PRs only -on: pull_request - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - test: - name: Run Danger - runs-on: macos-latest - steps: - - uses: actions/checkout@v2 - #- uses: swift-actions/setup-swift@v1 - - run: swift --version #make sure we have the version of swift we want, and that it can be seen in the logs - - run: python3 scripts/include_dev_dependencies.py - - run: npm install -g danger - - run: swift build - - run: swift run danger-swift ci --use-github-checks --verbose - env: - DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 00000000..1e13df35 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,53 @@ +# This is a basic workflow to help you get started with Actions + +name: PR + +# Controls when the action will run. Triggers the workflow on push or pull request +# events but only for the master branch +on: + pull_request: + branches: + - master + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + test: + name: Test Swift ${{ matrix.swift }}.x on ${{ matrix.os }} + strategy: + matrix: + os: [macos-latest, ubuntu-16.04, ubuntu-latest] + swift: ["4.2", "5.0", "5.1", "5.2", "5.3"] + exclude: + - os: macos-latest + swift: "5.2" + - os: macos-latest + swift: "4.2" + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + - uses: fwal/setup-swift@v1 + with: + swift-version: ${{ matrix.swift }} + - run: swift --version + - run: swift test + danger: + name: Danger + runs-on: macos-latest + needs: [test] + steps: + - uses: actions/checkout@v2 + - uses: fwal/setup-swift@v1 + with: + swift-version: "5.2" + - run: swift --version + - name: Install Danger + run: | + python3 scripts/include_dev_dependencies.py + npm install -g danger + swift build + - name: Run Danger + run: swift run danger-swift ci + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + - name: Rehide dev dependencies + run: python3 scripts/remove_dev_dependencies.py diff --git a/.github/workflows/push-master.yml b/.github/workflows/push-master.yml new file mode 100644 index 00000000..ee96f515 --- /dev/null +++ b/.github/workflows/push-master.yml @@ -0,0 +1,46 @@ +name: Push (master) + +on: + push: + branches: + - master + +jobs: + test: + name: Test Swift ${{ matrix.swift }}.x on ${{ matrix.os }} + strategy: + matrix: + os: [macos-latest, ubuntu-16.04, ubuntu-latest] + swift: ["4.2", "5.0", "5.1", "5.2"] + exclude: + - os: macos-latest + swift: "5.2" + - os: macos-latest + swift: "4.2" + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + - uses: fwal/setup-swift@v1 + with: + swift-version: ${{ matrix.swift }} + - run: swift --version + - run: swift test + deploy: + name: Deploy + runs-on: macos-latest + needs: [test] + steps: + - uses: actions/checkout@v2 + - uses: fwal/setup-swift@v1 + with: + swift-version: "5" + - run: swift --version + - name: Install Danger + run: | + python3 scripts/include_dev_dependencies.py + npm install -g danger + swift build + - name: Deploy Docs + run: bash .deploy-docs.sh + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} diff --git a/.github/workflows/push-nonmaster.yml b/.github/workflows/push-nonmaster.yml new file mode 100644 index 00000000..b5140e4a --- /dev/null +++ b/.github/workflows/push-nonmaster.yml @@ -0,0 +1,25 @@ +name: Push (non-master) + +on: + push: + branches-ignore: + - master + +jobs: + test: + name: Test Swift ${{ matrix.swift }}.x on ${{ matrix.os }} + strategy: + matrix: + os: [macos-latest, ubuntu-16.04, ubuntu-latest] + swift: ["4.2", "5.0", "5.1", "5.2"] + exclude: + - os: macos-latest + swift: "4.2" + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + - uses: fwal/setup-swift@v1 + with: + swift-version: ${{ matrix.swift }} + - run: swift --version + - run: swift test diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index dbfbd711..00000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: tests - -# Controls when the action will run. Since this action runs only tests, run on pushes and PRs -on: [push, pull_request] - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - test: - name: Test Swift ${{ matrix.swift }}.x on ${{ matrix.os }} - strategy: - matrix: - #os: [macos-10.15, macos-11, macos-12, ubuntu-18.04, ubuntu-20.04, ubuntu-22.04] - os: [macos-10.15, macos-11, macos-12, ubuntu-18.04, ubuntu-20.04] - #swift: ["4.2", "5.0", "5.1", "5.2", "5.3", "5.4", "5.5"] #setup-swift finds the latest bug fix version - #exclude: - #- os: macos-latest - #swift: "4.2" #Swift 4.2 is no longer supported on macOS 10.15 (macOS-latest) -# - os: macos-latest -# swift: "5.2" #Not sure why, but this isn't working - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v2 - - uses: swift-actions/setup-swift@v1 - #with: - #swift-version: ${{ matrix.swift }} - - run: swift --version #make sure we have the version of swift we want, and that it can be seen in the logs - - run: swift test From b54977d6df91f0087370d0bddb1f59f014077ba0 Mon Sep 17 00:00:00 2001 From: Samasaur1 <30577766+Samasaur1@users.noreply.github.com> Date: Fri, 3 Jun 2022 09:49:33 -0400 Subject: [PATCH 24/48] Re-add workflow files that I apparently deleted? --- .github/workflows/danger.yml | 23 +++++++++++++++++++++++ .github/workflows/test.yml | 27 +++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 .github/workflows/danger.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml new file mode 100644 index 00000000..a1a9a8eb --- /dev/null +++ b/.github/workflows/danger.yml @@ -0,0 +1,23 @@ +name: danger + +# Controls when the action will run. This action runs Danger, so run on PRs only +on: pull_request + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + test: + name: Run Danger + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + - uses: swift-actions/setup-swift@v1 + with: + swift-version: "5.3" + - run: swift --version #make sure we have the version of swift we want, and that it can be seen in the logs + - run: python3 scripts/include_dev_dependencies.py + - run: npm install -g danger + - run: swift build + - run: swift run danger-swift ci --use-github-checks --verbose + env: + DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..dbfbd711 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,27 @@ +name: tests + +# Controls when the action will run. Since this action runs only tests, run on pushes and PRs +on: [push, pull_request] + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + test: + name: Test Swift ${{ matrix.swift }}.x on ${{ matrix.os }} + strategy: + matrix: + #os: [macos-10.15, macos-11, macos-12, ubuntu-18.04, ubuntu-20.04, ubuntu-22.04] + os: [macos-10.15, macos-11, macos-12, ubuntu-18.04, ubuntu-20.04] + #swift: ["4.2", "5.0", "5.1", "5.2", "5.3", "5.4", "5.5"] #setup-swift finds the latest bug fix version + #exclude: + #- os: macos-latest + #swift: "4.2" #Swift 4.2 is no longer supported on macOS 10.15 (macOS-latest) +# - os: macos-latest +# swift: "5.2" #Not sure why, but this isn't working + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + - uses: swift-actions/setup-swift@v1 + #with: + #swift-version: ${{ matrix.swift }} + - run: swift --version #make sure we have the version of swift we want, and that it can be seen in the logs + - run: swift test From 3e6e6d1353e6c1f4fd117e4fd04856a104a1dfae Mon Sep 17 00:00:00 2001 From: Samasaur1 <30577766+Samasaur1@users.noreply.github.com> Date: Fri, 3 Jun 2022 11:01:50 -0400 Subject: [PATCH 25/48] Run Danger on macOS 10.15 --- .github/workflows/danger.yml | 2 +- .github/workflows/push-nonmaster.yml | 25 ------------------------- 2 files changed, 1 insertion(+), 26 deletions(-) delete mode 100644 .github/workflows/push-nonmaster.yml diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml index a1a9a8eb..20afb9ed 100644 --- a/.github/workflows/danger.yml +++ b/.github/workflows/danger.yml @@ -7,7 +7,7 @@ on: pull_request jobs: test: name: Run Danger - runs-on: macos-latest + runs-on: macos-10.15 steps: - uses: actions/checkout@v2 - uses: swift-actions/setup-swift@v1 diff --git a/.github/workflows/push-nonmaster.yml b/.github/workflows/push-nonmaster.yml deleted file mode 100644 index b5140e4a..00000000 --- a/.github/workflows/push-nonmaster.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Push (non-master) - -on: - push: - branches-ignore: - - master - -jobs: - test: - name: Test Swift ${{ matrix.swift }}.x on ${{ matrix.os }} - strategy: - matrix: - os: [macos-latest, ubuntu-16.04, ubuntu-latest] - swift: ["4.2", "5.0", "5.1", "5.2"] - exclude: - - os: macos-latest - swift: "4.2" - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v2 - - uses: fwal/setup-swift@v1 - with: - swift-version: ${{ matrix.swift }} - - run: swift --version - - run: swift test From cb3389bf5f4038467e28d83c9f9d4f8c56aa3488 Mon Sep 17 00:00:00 2001 From: Samasaur1 <30577766+Samasaur1@users.noreply.github.com> Date: Fri, 3 Jun 2022 11:27:45 -0400 Subject: [PATCH 26/48] Try GitHub Action adn test all matrix combos --- .github/workflows/danger.yml | 21 +++++++++++++-------- .github/workflows/test.yml | 11 ++++++----- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml index 20afb9ed..926455a8 100644 --- a/.github/workflows/danger.yml +++ b/.github/workflows/danger.yml @@ -10,14 +10,19 @@ jobs: runs-on: macos-10.15 steps: - uses: actions/checkout@v2 - - uses: swift-actions/setup-swift@v1 + - uses: danger/swift@3 with: - swift-version: "5.3" - - run: swift --version #make sure we have the version of swift we want, and that it can be seen in the logs - - run: python3 scripts/include_dev_dependencies.py - - run: npm install -g danger - - run: swift build - - run: swift run danger-swift ci --use-github-checks --verbose + args: --use-github-checks --verbose env: - DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + #- uses: swift-actions/setup-swift@v1 + #with: + #swift-version: "5.3" + #- run: swift --version #make sure we have the version of swift we want, and that it can be seen in the logs + #- run: python3 scripts/include_dev_dependencies.py + #- run: npm install -g danger + #- run: swift build + #- run: swift run danger-swift ci --use-github-checks --verbose + #env: + #DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} + #GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dbfbd711..b246ff19 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,10 +8,11 @@ jobs: test: name: Test Swift ${{ matrix.swift }}.x on ${{ matrix.os }} strategy: + fail-fast: false matrix: - #os: [macos-10.15, macos-11, macos-12, ubuntu-18.04, ubuntu-20.04, ubuntu-22.04] - os: [macos-10.15, macos-11, macos-12, ubuntu-18.04, ubuntu-20.04] - #swift: ["4.2", "5.0", "5.1", "5.2", "5.3", "5.4", "5.5"] #setup-swift finds the latest bug fix version + os: [macos-10.15, macos-11, macos-12, ubuntu-18.04, ubuntu-20.04, ubuntu-22.04] + #os: [macos-10.15, macos-11, macos-12, ubuntu-18.04, ubuntu-20.04] + swift: ["4.2", "5.0", "5.1", "5.2", "5.3", "5.4", "5.5"] #setup-swift finds the latest bug fix version #exclude: #- os: macos-latest #swift: "4.2" #Swift 4.2 is no longer supported on macOS 10.15 (macOS-latest) @@ -21,7 +22,7 @@ jobs: steps: - uses: actions/checkout@v2 - uses: swift-actions/setup-swift@v1 - #with: - #swift-version: ${{ matrix.swift }} + with: + swift-version: ${{ matrix.swift }} - run: swift --version #make sure we have the version of swift we want, and that it can be seen in the logs - run: swift test From 3d7356cb72135fd5b11a1be9d951d2f2c0741e33 Mon Sep 17 00:00:00 2001 From: Samasaur1 <30577766+Samasaur1@users.noreply.github.com> Date: Fri, 3 Jun 2022 11:41:56 -0400 Subject: [PATCH 27/48] Try using specific Danger version Also eliminate tests for versions of Swift that fail because of setup-swift --- .github/workflows/danger.yml | 2 +- .github/workflows/test.yml | 28 ++++++++++++++++++++++------ 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml index 926455a8..4955fb3c 100644 --- a/.github/workflows/danger.yml +++ b/.github/workflows/danger.yml @@ -10,7 +10,7 @@ jobs: runs-on: macos-10.15 steps: - uses: actions/checkout@v2 - - uses: danger/swift@3 + - uses: danger/swift@3.3.0 with: args: --use-github-checks --verbose env: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b246ff19..ddbd57e1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,12 +12,28 @@ jobs: matrix: os: [macos-10.15, macos-11, macos-12, ubuntu-18.04, ubuntu-20.04, ubuntu-22.04] #os: [macos-10.15, macos-11, macos-12, ubuntu-18.04, ubuntu-20.04] - swift: ["4.2", "5.0", "5.1", "5.2", "5.3", "5.4", "5.5"] #setup-swift finds the latest bug fix version - #exclude: - #- os: macos-latest - #swift: "4.2" #Swift 4.2 is no longer supported on macOS 10.15 (macOS-latest) -# - os: macos-latest -# swift: "5.2" #Not sure why, but this isn't working + swift: ["4.2", "5.0", "5.1", "5.2", "5.3", "5.4", "5.5", "5.6"] #setup-swift finds the latest bug fix version + exclude: + - os: macos-10.15 + swift: "4.2" + - os: macos-10.15 + swift: "5.1" + - os: macos-10.15 + swift: "5.2" + - os: macos-11 #the vast majority of these fail, so we exclude the OS and include the specific Swift versions + - os: macos-12 + #- os: ubuntu-20.04 # These may be transient errors; more testing required + #swift: "4.2" + #- os: ubuntu-20.04 + #swift: "5.0" + #- os: ubuntu-20.04 + #swift: "5.1" + - os: ubuntu-22.04 #Not supported by setup-swift + include: + - os: macos-11 + swift: "5.5" + - os: macos-12 + swift: "5.5" runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 From 02769b71009a8ef2dc17125afa347a8171575289 Mon Sep 17 00:00:00 2001 From: Samasaur1 <30577766+Samasaur1@users.noreply.github.com> Date: Fri, 3 Jun 2022 13:16:17 -0400 Subject: [PATCH 28/48] Use Danger action on Linux --- .github/workflows/danger.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml index 4955fb3c..f8dae253 100644 --- a/.github/workflows/danger.yml +++ b/.github/workflows/danger.yml @@ -7,10 +7,10 @@ on: pull_request jobs: test: name: Run Danger - runs-on: macos-10.15 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: danger/swift@3.3.0 + - uses: danger/swift@3.12.3 with: args: --use-github-checks --verbose env: From 5305494e4f86e577fb5e0854ad1425af510d1445 Mon Sep 17 00:00:00 2001 From: Samasaur1 <30577766+Samasaur1@users.noreply.github.com> Date: Fri, 3 Jun 2022 15:29:06 -0400 Subject: [PATCH 29/48] Add separate deploy docs workflow Also removes now-obsolete old workflows --- .github/workflows/deploydocs.yml | 38 ++++++++++++++++++++++ .github/workflows/pr.yml | 53 ------------------------------- .github/workflows/push-master.yml | 46 --------------------------- 3 files changed, 38 insertions(+), 99 deletions(-) create mode 100644 .github/workflows/deploydocs.yml delete mode 100644 .github/workflows/pr.yml delete mode 100644 .github/workflows/push-master.yml diff --git a/.github/workflows/deploydocs.yml b/.github/workflows/deploydocs.yml new file mode 100644 index 00000000..4c9a6349 --- /dev/null +++ b/.github/workflows/deploydocs.yml @@ -0,0 +1,38 @@ +name: Deploy Docs + +on: + push: + tags: 'v[0-9]+.[0-9]+.[0-9]+' + +jobs: + deploy: + name: Deploy + runs-on: macos-latest + steps: + - uses: actions/checkout@v3 + - uses: swift-actions/setup-swift@v1 + - run: swift --version + - name: Install jazzy + run: gem install jazzy + - name: Run jazzy + run: jazzy -o newdocs + - name: Checkout gh-pages + uses: actions/checkout@v3 + with: + ref: gh-pages + path: ghp + - name: Process docs + run: | + VERSION=${GITHUB_REF:#refs/tags/v} #lops of that part from the beginning of the string, could be ${GITHUB_REF:11} to chop off 11 characters + mkdir ghp/docs/v$VERSION + mv newdocs/* ghpd/docs/v$VERSION + cd ghp + echo 'section > section > p > img { margin-top: 4em; margin-right: 2em; }' >> docs/v$VERSION/css/jazzy.css + bash ../scripts/updateLatestDocs.sh $VERSION + - name: Push updated docs + run: | + git config user.name github-actions + git config user.email github-actions@github.com + git add . + git commit -m "Add documentation for version $VERSION" + git push diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml deleted file mode 100644 index 1e13df35..00000000 --- a/.github/workflows/pr.yml +++ /dev/null @@ -1,53 +0,0 @@ -# This is a basic workflow to help you get started with Actions - -name: PR - -# Controls when the action will run. Triggers the workflow on push or pull request -# events but only for the master branch -on: - pull_request: - branches: - - master - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - test: - name: Test Swift ${{ matrix.swift }}.x on ${{ matrix.os }} - strategy: - matrix: - os: [macos-latest, ubuntu-16.04, ubuntu-latest] - swift: ["4.2", "5.0", "5.1", "5.2", "5.3"] - exclude: - - os: macos-latest - swift: "5.2" - - os: macos-latest - swift: "4.2" - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v2 - - uses: fwal/setup-swift@v1 - with: - swift-version: ${{ matrix.swift }} - - run: swift --version - - run: swift test - danger: - name: Danger - runs-on: macos-latest - needs: [test] - steps: - - uses: actions/checkout@v2 - - uses: fwal/setup-swift@v1 - with: - swift-version: "5.2" - - run: swift --version - - name: Install Danger - run: | - python3 scripts/include_dev_dependencies.py - npm install -g danger - swift build - - name: Run Danger - run: swift run danger-swift ci - env: - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} - - name: Rehide dev dependencies - run: python3 scripts/remove_dev_dependencies.py diff --git a/.github/workflows/push-master.yml b/.github/workflows/push-master.yml deleted file mode 100644 index ee96f515..00000000 --- a/.github/workflows/push-master.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Push (master) - -on: - push: - branches: - - master - -jobs: - test: - name: Test Swift ${{ matrix.swift }}.x on ${{ matrix.os }} - strategy: - matrix: - os: [macos-latest, ubuntu-16.04, ubuntu-latest] - swift: ["4.2", "5.0", "5.1", "5.2"] - exclude: - - os: macos-latest - swift: "5.2" - - os: macos-latest - swift: "4.2" - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v2 - - uses: fwal/setup-swift@v1 - with: - swift-version: ${{ matrix.swift }} - - run: swift --version - - run: swift test - deploy: - name: Deploy - runs-on: macos-latest - needs: [test] - steps: - - uses: actions/checkout@v2 - - uses: fwal/setup-swift@v1 - with: - swift-version: "5" - - run: swift --version - - name: Install Danger - run: | - python3 scripts/include_dev_dependencies.py - npm install -g danger - swift build - - name: Deploy Docs - run: bash .deploy-docs.sh - env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} From 2012e0e108c609f4bc79f4cff888e6edf1eefd41 Mon Sep 17 00:00:00 2001 From: Samasaur1 <30577766+Samasaur1@users.noreply.github.com> Date: Fri, 3 Jun 2022 17:02:50 -0400 Subject: [PATCH 30/48] Remove Travis, add release deployment, update version and tests --- .github/workflows/deploydocs.yml | 31 ++++++++++++++++++++--- .github/workflows/test.yml | 18 ++++++++------ .jazzy.yaml | 4 +-- .travis.yml | 42 -------------------------------- CHANGELOG.md | 7 ++++++ 5 files changed, 47 insertions(+), 55 deletions(-) delete mode 100644 .travis.yml diff --git a/.github/workflows/deploydocs.yml b/.github/workflows/deploydocs.yml index 4c9a6349..84152094 100644 --- a/.github/workflows/deploydocs.yml +++ b/.github/workflows/deploydocs.yml @@ -1,12 +1,12 @@ -name: Deploy Docs +name: Deploy on: push: tags: 'v[0-9]+.[0-9]+.[0-9]+' jobs: - deploy: - name: Deploy + deploy-docs: + name: Deploy Docs runs-on: macos-latest steps: - uses: actions/checkout@v3 @@ -21,18 +21,41 @@ jobs: with: ref: gh-pages path: ghp + - name: Determine VERSION + run: echo 'VERSION=${GITHUB_REF:#refs/tags/v}' >> $GITHUB_ENV #lops of that part from the beginning of the string, could be ${GITHUB_REF:11} to chop off 11 characters - name: Process docs run: | - VERSION=${GITHUB_REF:#refs/tags/v} #lops of that part from the beginning of the string, could be ${GITHUB_REF:11} to chop off 11 characters mkdir ghp/docs/v$VERSION mv newdocs/* ghpd/docs/v$VERSION cd ghp echo 'section > section > p > img { margin-top: 4em; margin-right: 2em; }' >> docs/v$VERSION/css/jazzy.css bash ../scripts/updateLatestDocs.sh $VERSION + cd .. - name: Push updated docs run: | + cd ghp git config user.name github-actions git config user.email github-actions@github.com git add . git commit -m "Add documentation for version $VERSION" git push + deploy-release: + name: Deploy Release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Determine VERSION + run: echo 'VERSION=${GITHUB_REF:#refs/tags/v}' >> $GITHUB_ENV #lops of that part from the beginning of the string, could be ${GITHUB_REF:11} to chop off 11 characters + - name: Determine release name + run: | + NAME=$(git tag -l --format='%(contents)' v$VERSION | head -n 1) + echo "NAME='$NAME'" >> $GITHUB_ENV + echo "Determined release name as '$NAME'" >> $GITHUB_STEP_SUMMARY + - name: Determine release body (from CHANGELOG) + run: cat CHANGELOG.md | sed '1,/^## /d' | sed '1,/^## /d' | sed '/^## /,$d' | tee body.md + - uses: ncipollo/release-action@v1.10.0 + with: + name: ${{ env.NAME }} + bodyFile: "body.md" + draft: true + prerelease: true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ddbd57e1..33845618 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,21 +22,25 @@ jobs: swift: "5.2" - os: macos-11 #the vast majority of these fail, so we exclude the OS and include the specific Swift versions - os: macos-12 - #- os: ubuntu-20.04 # These may be transient errors; more testing required - #swift: "4.2" - #- os: ubuntu-20.04 - #swift: "5.0" - #- os: ubuntu-20.04 - #swift: "5.1" + - os: ubuntu-20.04 + swift: "4.2" + - os: ubuntu-20.04 + swift: "5.0" + - os: ubuntu-20.04 + swift: "5.1" - os: ubuntu-22.04 #Not supported by setup-swift include: - os: macos-11 swift: "5.5" + - os: macos-11 + swift: "5.6" - os: macos-12 swift: "5.5" + - os: macos-12 + swift: "5.6" runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: swift-actions/setup-swift@v1 with: swift-version: ${{ matrix.swift }} diff --git a/.jazzy.yaml b/.jazzy.yaml index 7f8e034b..3665703e 100644 --- a/.jazzy.yaml +++ b/.jazzy.yaml @@ -2,7 +2,7 @@ clean: true author: Samasaur author_url: https://github.com/Samasaur1 module: DiceKit -module_version: 0.24.1 +module_version: 0.25.0 # docset_icon: github_url: https://github.com/Samasaur1/DiceKit # github_file_prefix: @@ -27,4 +27,4 @@ custom_categories: - Chances - Chance - Caching - - ENABLE_CACHING \ No newline at end of file + - ENABLE_CACHING diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4dcf8245..00000000 --- a/.travis.yml +++ /dev/null @@ -1,42 +0,0 @@ -language: generic -dist: xenial - -stages: -- name: danger - if: type = pull_request -- name: deploy - if: tag IS present - -os: osx - -osx_image: xcode11.5 - -jobs: - include: - - stage: deploy - script: bash .deploy-docs.sh - - stage: danger - name: "Bot account (issue comment)" - env: - - DANGER_GITHUB_API_TOKEN=$DANGER_GITHUB_API_TOKEN_BOT_ACCOUNT - script: swift run danger-swift ci --use-github-checks - install: - - python3 scripts/include_dev_dependencies.py - - npm install -g danger - - swift build - after_success: python3 scripts/remove_dev_dependencies.py - - stage: danger - name: "Main account (status check)" - env: - - DANGER_GITHUB_API_TOKEN=$DANGER_GITHUB_API_TOKEN_MAIN_ACCOUNT - script: swift run danger-swift ci --use-github-checks - install: - - python3 scripts/include_dev_dependencies.py - - npm install -g danger - - swift build - after_success: python3 scripts/remove_dev_dependencies.py - -cache: - directories: - - .build - - ~/.danger-swift diff --git a/CHANGELOG.md b/CHANGELOG.md index 967acd85..b23ce76d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Upcoming] +## [0.25.0] - 2022-06-03 +### Added +### Changed +### Fixed +### Removed + ## [0.24.1] - 2020-10-15 ### Fixed - Danger now reports tasks in the correct order @@ -277,6 +283,7 @@ Update .travis.yml in case https://swiftenv.fuller.li/install.sh is down/has no - `Rollable`: a protocol for anything that is rollable [Upcoming]: https://github.com/Samasaur1/DiceKit/compare/development +[0.25.0]: https://github.com/Samasaur1/DiceKit/compare/v0.25.0...v0.24.1 [0.24.1]: https://github.com/Samasaur1/DiceKit/compare/v0.24.0...v0.24.1 [0.24.0]: https://github.com/Samasaur1/DiceKit/compare/v0.23.0...v0.24.0 [0.23.0]: https://github.com/Samasaur1/DiceKit/compare/v0.22.0...v0.23.0 From d5a26e8ef5db9ee45bbd6204f73e8d7d72691cdb Mon Sep 17 00:00:00 2001 From: Samasaur1 <30577766+Samasaur1@users.noreply.github.com> Date: Fri, 3 Jun 2022 17:08:08 -0400 Subject: [PATCH 31/48] Update CHANGELOG --- .github/workflows/danger.yml | 11 ----------- CHANGELOG.md | 11 +++++++++++ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml index f8dae253..da399d2d 100644 --- a/.github/workflows/danger.yml +++ b/.github/workflows/danger.yml @@ -15,14 +15,3 @@ jobs: args: --use-github-checks --verbose env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - #- uses: swift-actions/setup-swift@v1 - #with: - #swift-version: "5.3" - #- run: swift --version #make sure we have the version of swift we want, and that it can be seen in the logs - #- run: python3 scripts/include_dev_dependencies.py - #- run: npm install -g danger - #- run: swift build - #- run: swift run danger-swift ci --use-github-checks --verbose - #env: - #DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} - #GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index b23ce76d..174b13a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,9 +8,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [0.25.0] - 2022-06-03 ### Added +- Releases are now auto-deployed from GitHub Actions +- Extra checks in Danger + ### Changed +- Improve PR template and guidelines +- Danger now runs in GitHub Actions, not Travis CI +- Documentation is now auto-deployed from GitHub Actions, not Travis CI + ### Fixed +- We now test on Swift 4.2–5.6, and use the current allowed versions of macOS and Ubuntu + ### Removed +- Extra now-obsolete GitHub Actions +- All uses of Travis CI are now gone ## [0.24.1] - 2020-10-15 ### Fixed From eeb3354d845102c4831d4656880cbd63e3fd29c8 Mon Sep 17 00:00:00 2001 From: Samasaur1 <30577766+Samasaur1@users.noreply.github.com> Date: Fri, 3 Jun 2022 17:27:07 -0400 Subject: [PATCH 32/48] Fix compare link --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 174b13a3..23ba1a56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -294,7 +294,7 @@ Update .travis.yml in case https://swiftenv.fuller.li/install.sh is down/has no - `Rollable`: a protocol for anything that is rollable [Upcoming]: https://github.com/Samasaur1/DiceKit/compare/development -[0.25.0]: https://github.com/Samasaur1/DiceKit/compare/v0.25.0...v0.24.1 +[0.25.0]: https://github.com/Samasaur1/DiceKit/compare/v0.24.1...v0.25.0 [0.24.1]: https://github.com/Samasaur1/DiceKit/compare/v0.24.0...v0.24.1 [0.24.0]: https://github.com/Samasaur1/DiceKit/compare/v0.23.0...v0.24.0 [0.23.0]: https://github.com/Samasaur1/DiceKit/compare/v0.22.0...v0.23.0 From 631fb3f1f79280c82f7cdfbf38d59ef5c4cb5f83 Mon Sep 17 00:00:00 2001 From: Samasaur1 <30577766+Samasaur1@users.noreply.github.com> Date: Fri, 3 Jun 2022 18:35:17 -0400 Subject: [PATCH 33/48] Hopefully fix Danger task listing --- CHANGELOG.md | 2 +- Dangerfile.swift | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 23ba1a56..962170a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -293,7 +293,7 @@ Update .travis.yml in case https://swiftenv.fuller.li/install.sh is down/has no - `Roll`: the result of rolling a `Rollable` - `Rollable`: a protocol for anything that is rollable -[Upcoming]: https://github.com/Samasaur1/DiceKit/compare/development +[Upcoming]: https://github.com/Samasaur1/DiceKit/compare/v0.25.0...master [0.25.0]: https://github.com/Samasaur1/DiceKit/compare/v0.24.1...v0.25.0 [0.24.1]: https://github.com/Samasaur1/DiceKit/compare/v0.24.0...v0.24.1 [0.24.0]: https://github.com/Samasaur1/DiceKit/compare/v0.23.0...v0.24.0 diff --git a/Dangerfile.swift b/Dangerfile.swift index 837c9083..ce35b49d 100644 --- a/Dangerfile.swift +++ b/Dangerfile.swift @@ -16,10 +16,11 @@ if let range = danger.github.pullRequest.title.range(of: #"(?<=Version )\d+\.\d+ // MARK: New version (.jazzy.yaml) let jazzyVersion = String(danger.utils.readFile(".jazzy.yaml").split(separator: "\n")[4].dropFirst(16)) if editedFiles.contains(".jazzy.yaml") { - message("Version in .jazzy.yaml agrees with PR title") + message(".jazzy.yaml was updated") } else { fail("Version was not updated in .jazzy.yaml!") fail(message: "Version was not updated in .jazzy.yaml!", file: ".jazzy.yaml", line: 5) + suggestion(code: "module_version: \(newVersion)", file: ".jazzy.yaml", line: 5) } if newVersion == jazzyVersion { message("PR title and .jazzy.yaml agree") @@ -148,7 +149,7 @@ if let body = danger.github.pullRequest.body { let split = body.split { $0.isNewline } let allTaskLines = split .filter { $0.range(of: #"^- \[[x ]\] "#, options: .regularExpression) != nil } - for (num, line) in allTaskLines.enumerated().reversed() { + for (num, line) in allTaskLines.enumerated()/*.reversed()*/ { if line.range(of: #"^- \[x\] "#, options: .regularExpression) != nil { message("**Task \(num + 1) completed:** \(line.dropFirst(6))") continue From 414b3b77f27e6037fa7431c42d6a4021a4e98386 Mon Sep 17 00:00:00 2001 From: Samasaur1 <30577766+Samasaur1@users.noreply.github.com> Date: Fri, 3 Jun 2022 18:43:21 -0400 Subject: [PATCH 34/48] Try to debug Dangerfile --- .github/workflows/test.yml | 4 +++- Dangerfile.swift | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 33845618..1c9ecd91 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -44,5 +44,7 @@ jobs: - uses: swift-actions/setup-swift@v1 with: swift-version: ${{ matrix.swift }} - - run: swift --version #make sure we have the version of swift we want, and that it can be seen in the logs + run: | + swift --version + echo "Using '$(swift --version | head -n 1)'" >> $GITHUB_STEP_SUMMARY - run: swift test diff --git a/Dangerfile.swift b/Dangerfile.swift index ce35b49d..29740123 100644 --- a/Dangerfile.swift +++ b/Dangerfile.swift @@ -150,6 +150,7 @@ if let body = danger.github.pullRequest.body { let allTaskLines = split .filter { $0.range(of: #"^- \[[x ]\] "#, options: .regularExpression) != nil } for (num, line) in allTaskLines.enumerated()/*.reversed()*/ { + message("task \(num)") if line.range(of: #"^- \[x\] "#, options: .regularExpression) != nil { message("**Task \(num + 1) completed:** \(line.dropFirst(6))") continue @@ -157,7 +158,7 @@ if let body = danger.github.pullRequest.body { fail("**Task \(num + 1) incomplete:** \(line.dropFirst(6))") // "- [ ] " } } else { - warn("PR body doesn't appear to have any tasks, which it should") + warn("PR has no tasks (are you sure?)") } } else { warn("Cannot fetch PR body!") From e0516c183f9611e2ad45d9a4a4e894109420a711 Mon Sep 17 00:00:00 2001 From: Samasaur1 <30577766+Samasaur1@users.noreply.github.com> Date: Fri, 3 Jun 2022 18:45:59 -0400 Subject: [PATCH 35/48] Fix tests workflow --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1c9ecd91..d4d96ccc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -44,7 +44,7 @@ jobs: - uses: swift-actions/setup-swift@v1 with: swift-version: ${{ matrix.swift }} - run: | + - run: | swift --version echo "Using '$(swift --version | head -n 1)'" >> $GITHUB_STEP_SUMMARY - run: swift test From 6e6ff1140968c06cc9bc19cc508270e8c1b09a4d Mon Sep 17 00:00:00 2001 From: Samasaur1 <30577766+Samasaur1@users.noreply.github.com> Date: Fri, 3 Jun 2022 19:38:11 -0400 Subject: [PATCH 36/48] Add test summary to job summary --- .github/workflows/test.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d4d96ccc..347dc3e4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -46,5 +46,9 @@ jobs: swift-version: ${{ matrix.swift }} - run: | swift --version - echo "Using '$(swift --version | head -n 1)'" >> $GITHUB_STEP_SUMMARY - - run: swift test + echo "Using \`$(swift --version | head -n 1)\`" >> $GITHUB_STEP_SUMMARY + - run: swift test --parallel --xunit-output output.xml + - uses: test-summary/action@v1 + with: + path: output.xml + show: all From 393aec949b6351480260d225c406c8c94503b258 Mon Sep 17 00:00:00 2001 From: Samasaur1 <30577766+Samasaur1@users.noreply.github.com> Date: Fri, 3 Jun 2022 19:40:21 -0400 Subject: [PATCH 37/48] Fix test workflow --- .github/workflows/test.yml | 2 +- Dangerfile.swift | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 347dc3e4..ebf09e8a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -50,5 +50,5 @@ jobs: - run: swift test --parallel --xunit-output output.xml - uses: test-summary/action@v1 with: - path: output.xml + paths: output.xml show: all diff --git a/Dangerfile.swift b/Dangerfile.swift index 29740123..d8c5b3f1 100644 --- a/Dangerfile.swift +++ b/Dangerfile.swift @@ -150,7 +150,6 @@ if let body = danger.github.pullRequest.body { let allTaskLines = split .filter { $0.range(of: #"^- \[[x ]\] "#, options: .regularExpression) != nil } for (num, line) in allTaskLines.enumerated()/*.reversed()*/ { - message("task \(num)") if line.range(of: #"^- \[x\] "#, options: .regularExpression) != nil { message("**Task \(num + 1) completed:** \(line.dropFirst(6))") continue From b39f69e5934b84e06f395cbb871e981dc3edc846 Mon Sep 17 00:00:00 2001 From: Samasaur1 <30577766+Samasaur1@users.noreply.github.com> Date: Fri, 3 Jun 2022 23:45:28 -0400 Subject: [PATCH 38/48] Only use fancy test statuses on Ubuntu --- .github/workflows/test.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ebf09e8a..a2848798 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -48,7 +48,11 @@ jobs: swift --version echo "Using \`$(swift --version | head -n 1)\`" >> $GITHUB_STEP_SUMMARY - run: swift test --parallel --xunit-output output.xml + if: startsWith(matrix.os, 'ubuntu') + - run: swift test + if: startsWith(matrix.os, 'macos') - uses: test-summary/action@v1 + if: always() && startsWith(matrix.os, 'ubuntu') with: paths: output.xml - show: all + show: fail #none | all | (fail)?,(pass)?,(skip)? From 622b629cdc87920d7165b86faa792744f3b38f04 Mon Sep 17 00:00:00 2001 From: Samasaur1 <30577766+Samasaur1@users.noreply.github.com> Date: Fri, 3 Jun 2022 23:55:40 -0400 Subject: [PATCH 39/48] We can still have somewhat-nice statuses --- .github/workflows/test.yml | 4 ++++ CHANGELOG.md | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a2848798..a7d97e14 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -56,3 +56,7 @@ jobs: with: paths: output.xml show: fail #none | all | (fail)?,(pass)?,(skip)? + - run: echo ":white_check_mark: Tests passed!" >> $GITHUB_STEP_SUMMARY + if: success() && startsWith(matrix.os, 'macos') + - run: echo ":x: Some tests failing!" >> $GITHUB_STEP_SUMMARY #perhaps :heavy_exclamation_mark: + if: failure() && startsWith(matrix.os, 'macos') diff --git a/CHANGELOG.md b/CHANGELOG.md index 962170a4..7f1b3cc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Upcoming] -## [0.25.0] - 2022-06-03 +## [0.25.0] - 2022-06-04 ### Added - Releases are now auto-deployed from GitHub Actions - Extra checks in Danger From 2c3d4f2041fa5221c820b806d1aab793dc12fd5f Mon Sep 17 00:00:00 2001 From: Samasaur1 <30577766+Samasaur1@users.noreply.github.com> Date: Sat, 4 Jun 2022 00:02:34 -0400 Subject: [PATCH 40/48] Try to fix test workflow (again) --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a7d97e14..08910935 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -56,7 +56,7 @@ jobs: with: paths: output.xml show: fail #none | all | (fail)?,(pass)?,(skip)? - - run: echo ":white_check_mark: Tests passed!" >> $GITHUB_STEP_SUMMARY - if: success() && startsWith(matrix.os, 'macos') + - run: echo "success" >> $GITHUB_STEP_SUMMARY + if: ${{ success() && startsWith(matrix.os, 'macos') }} - run: echo ":x: Some tests failing!" >> $GITHUB_STEP_SUMMARY #perhaps :heavy_exclamation_mark: if: failure() && startsWith(matrix.os, 'macos') From 048de4c73b8888643066be494ff45180168ab402 Mon Sep 17 00:00:00 2001 From: Samasaur1 <30577766+Samasaur1@users.noreply.github.com> Date: Sat, 4 Jun 2022 00:03:52 -0400 Subject: [PATCH 41/48] Fix test workflow --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 08910935..a838e692 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -56,7 +56,7 @@ jobs: with: paths: output.xml show: fail #none | all | (fail)?,(pass)?,(skip)? - - run: echo "success" >> $GITHUB_STEP_SUMMARY + - run: echo ":white_check_mark: Tests succeeded!" >> $GITHUB_STEP_SUMMARY if: ${{ success() && startsWith(matrix.os, 'macos') }} - run: echo ":x: Some tests failing!" >> $GITHUB_STEP_SUMMARY #perhaps :heavy_exclamation_mark: - if: failure() && startsWith(matrix.os, 'macos') + if: ${{ failure() && startsWith(matrix.os, 'macos') }} From 0000ec533a315775f9a08a0f0c114b1d693fcfdd Mon Sep 17 00:00:00 2001 From: Samasaur1 <30577766+Samasaur1@users.noreply.github.com> Date: Sat, 4 Jun 2022 00:04:50 -0400 Subject: [PATCH 42/48] Is this the problem? --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a838e692..304152e8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -56,7 +56,7 @@ jobs: with: paths: output.xml show: fail #none | all | (fail)?,(pass)?,(skip)? - - run: echo ":white_check_mark: Tests succeeded!" >> $GITHUB_STEP_SUMMARY + - run: echo ':white_check_mark: Tests succeeded!' >> $GITHUB_STEP_SUMMARY if: ${{ success() && startsWith(matrix.os, 'macos') }} - - run: echo ":x: Some tests failing!" >> $GITHUB_STEP_SUMMARY #perhaps :heavy_exclamation_mark: + - run: echo ':x: Some tests failing!' >> $GITHUB_STEP_SUMMARY #perhaps :heavy_exclamation_mark: if: ${{ failure() && startsWith(matrix.os, 'macos') }} From 6de5054fe94e44f995d8b8009c1fd338e5a46415 Mon Sep 17 00:00:00 2001 From: Samasaur1 <30577766+Samasaur1@users.noreply.github.com> Date: Sat, 4 Jun 2022 00:06:35 -0400 Subject: [PATCH 43/48] Ah, it was a YAML error --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 304152e8..4d67f30f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -56,7 +56,7 @@ jobs: with: paths: output.xml show: fail #none | all | (fail)?,(pass)?,(skip)? - - run: echo ':white_check_mark: Tests succeeded!' >> $GITHUB_STEP_SUMMARY + - run: 'echo ":white_check_mark: Tests succeeded!" >> $GITHUB_STEP_SUMMARY' if: ${{ success() && startsWith(matrix.os, 'macos') }} - - run: echo ':x: Some tests failing!' >> $GITHUB_STEP_SUMMARY #perhaps :heavy_exclamation_mark: + - run: 'echo ":x: Some tests failing!" >> $GITHUB_STEP_SUMMARY' #perhaps :heavy_exclamation_mark: if: ${{ failure() && startsWith(matrix.os, 'macos') }} From 8e5ced8e6e6691c21b5a1dd5e0e78a9492bef40e Mon Sep 17 00:00:00 2001 From: Samasaur1 <30577766+Samasaur1@users.noreply.github.com> Date: Sat, 4 Jun 2022 00:45:19 -0400 Subject: [PATCH 44/48] Force the use of emdashes in CHANGELOG --- Dangerfile.swift | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Dangerfile.swift b/Dangerfile.swift index d8c5b3f1..ec3364b5 100644 --- a/Dangerfile.swift +++ b/Dangerfile.swift @@ -35,12 +35,13 @@ if let range = danger.github.pullRequest.title.range(of: #"(?<=Version )\d+\.\d+ let dateString = String(line.dropFirst("## [\(newVersion)] - ".count)) let df = DateFormatter() df.dateFormat = "yyyy-MM-dd" - if df.string(from: Date()) == dateString { + let ds = df.string(from: Date()) + if ds == dateString { message("The date for this version's entry is today, \(dateString)") } else { fail("The date for this version's entry is not today!") fail(message: "The date for this version's entry is not today!", file: "CHANGELOG.md", line: lineNumber) - suggestion(code: "## [\(newVersion)] — \(df.string(from: Date()))", file: "CHANGELOG.md", line: lineNumber) + suggestion(code: "## [\(newVersion)] — \(ds)", file: "CHANGELOG.md", line: lineNumber) } // MARK: Changelog compare link if let upcomingLineNumber = danger.utils.lines(for: "[Upcoming]:", inFile: "CHANGELOG.md").first, @@ -67,6 +68,13 @@ if let range = danger.github.pullRequest.title.range(of: #"(?<=Version )\d+\.\d+ } else { fail("There is no CHANGELOG entry for this version!") } + + // MARK: Changelog hyphen vs emdash + let contents = danger.utils.readFile("CHANGELOG.md").split(separator: "\n") + for (_ln, line) in contents.enumerated() where line.range(of: #"## [.+] - \d\d\d\d-\d\d-\d\d"#, options: .regularExpression) != nil { + fail(message: "Use emdashes instead of hyphens!", file: "CHANGELOG.md", line: _ln + 1) + suggestion(code: line.replacingOccurrences(of: " - ", with: " — "), file: "CHANGELOG.md", line: _ln + 1) + } } else { // MARK: - Non-new version PR message("Non-new version PR detected, to branch \(danger.github.pullRequest.base.ref)") if danger.github.pullRequest.base.ref != "master" { From 1e2f07797ffc9fb543b8519858d18eb3fdd8ba60 Mon Sep 17 00:00:00 2001 From: Samasaur1 <30577766+Samasaur1@users.noreply.github.com> Date: Sat, 4 Jun 2022 00:53:33 -0400 Subject: [PATCH 45/48] Escape square brackets in regex --- Dangerfile.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dangerfile.swift b/Dangerfile.swift index ec3364b5..522e40b5 100644 --- a/Dangerfile.swift +++ b/Dangerfile.swift @@ -71,7 +71,7 @@ if let range = danger.github.pullRequest.title.range(of: #"(?<=Version )\d+\.\d+ // MARK: Changelog hyphen vs emdash let contents = danger.utils.readFile("CHANGELOG.md").split(separator: "\n") - for (_ln, line) in contents.enumerated() where line.range(of: #"## [.+] - \d\d\d\d-\d\d-\d\d"#, options: .regularExpression) != nil { + for (_ln, line) in contents.enumerated() where line.range(of: #"## \[.+\] - \d\d\d\d-\d\d-\d\d"#, options: .regularExpression) != nil { fail(message: "Use emdashes instead of hyphens!", file: "CHANGELOG.md", line: _ln + 1) suggestion(code: line.replacingOccurrences(of: " - ", with: " — "), file: "CHANGELOG.md", line: _ln + 1) } From 7cacf271013b3db8d558373f4e285b39f0c28035 Mon Sep 17 00:00:00 2001 From: Samasaur1 <30577766+Samasaur1@users.noreply.github.com> Date: Sat, 4 Jun 2022 01:22:03 -0400 Subject: [PATCH 46/48] Forcibly correct CHANGELOG entry headings --- CHANGELOG.md | 52 ++++++++++++++++++++++++------------------------ Dangerfile.swift | 13 ++++++------ 2 files changed, 33 insertions(+), 32 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f1b3cc9..0b7e95f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Upcoming] -## [0.25.0] - 2022-06-04 +## [0.25.0] — 2022-06-04 ### Added - Releases are now auto-deployed from GitHub Actions - Extra checks in Danger @@ -23,11 +23,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Extra now-obsolete GitHub Actions - All uses of Travis CI are now gone -## [0.24.1] - 2020-10-15 +## [0.24.1] — 2020-10-15 ### Fixed - Danger now reports tasks in the correct order -## [0.24.0] - 2020-07-13 +## [0.24.0] — 2020-07-13 ### Added - `Chance` objects can now be multiplied together (which, mathematically, represents the chance of both occurring) - More test cases for `Chance` @@ -40,7 +40,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - GitHub Actions can now deploy docs through the use of the GitHub token - Typos -## [0.23.0] - 2020-07-09 +## [0.23.0] — 2020-07-09 ### Added - A `Package@swift-5.0.swift` file in order to be able to specify supported platforms - Supported versions of Swift are listed in the package manifest file @@ -97,7 +97,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - The structure of the GitHub Pages site has changed. There is now a `docs` directory, with subdirectories for each version. The auto-deployment of documentation has been updated to support this. -## [0.19.0] - 2019-12-26 +## [0.19.0] — 2019-12-26 ### Added - Scripts to hide/unhide dev dependencies @@ -108,12 +108,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Dev dependencies, such as Danger, are now only included, downloaded, and built on CI -## [0.18.1] - 2019-08-22 +## [0.18.1] — 2019-08-22 ### Fixed - The release script has been fixed (closes #67) - The automatic documentation has been fixed -## [0.18.0] - 2019-08-04 +## [0.18.0] — 2019-08-04 ### Added - Add release.py and updateVersion.py scripts - Add [Danger](https://github.com/danger/swift) integration @@ -135,7 +135,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed Update .travis.yml in case https://swiftenv.fuller.li/install.sh is down/has no SSL certificate -## [0.17.0] - 2019-07-26 +## [0.17.0] — 2019-07-26 ### Added - New feature guidelines - Issue and pull request templates @@ -159,14 +159,14 @@ Update .travis.yml in case https://swiftenv.fuller.li/install.sh is down/has no - `Rollable` - `roll(times:_:)` would crash when called like so: `roll(times: 1, .dropOutsides)` -## [0.16.1] - 2019-06-24 +## [0.16.1] — 2019-06-24 ### Added - Testing on Swift 5.0.1 and Xcode 10.2 ### Fixed - Auto-deploying docs -## [0.16.0] - 2019-06-24 +## [0.16.0] — 2019-06-24 ### Added - `CustomDie` - `DieSide` @@ -186,7 +186,7 @@ Update .travis.yml in case https://swiftenv.fuller.li/install.sh is down/has no ### Removed - Support for Swift 4.0 through Swift 4.1.3 -## [0.15.0] - 2018-12-02 +## [0.15.0] — 2018-12-02 ### Added - CODE_OF_CONDUCT.md - CONTRIBUTING.md @@ -203,48 +203,48 @@ Update .travis.yml in case https://swiftenv.fuller.li/install.sh is down/has no - Include modifiers in `Dice` addition functions - Properly multiply `Die`s in `Dice` multiplication functions. -## [0.14.1] - 2018-11-15 +## [0.14.1] — 2018-11-15 ### Fixed - `Die` - Die rolling bug (#44): All dice Swift 4.2+ were being treated as `d6`s by [@Taufi](https://github.com/Taufi) -## [0.14.0] - 2018-10-31 +## [0.14.0] — 2018-10-31 ### Added - `Die` - `init?(_ str: String)`: String parsing - `Dice` - `init?(_ str: String)`: String parsing -## [0.13.0] - 2018-10-11 +## [0.13.0] — 2018-10-11 ### Changed - Changed LICENSE from MIT to AFL v3.0 -## [0.12.0] - 2018-10-09 +## [0.12.0] — 2018-10-09 ### Added - Logo by [@richardbmx](https://github.com/richardbmx) -## [0.11.0] - 2018-10-1 +## [0.11.0] — 2018-10-1 ### Added - More documentation -## [0.10.0] - 2018-09-29 +## [0.10.0] — 2018-09-29 ### Added - Automatic documentation deployment for the latest version -## [0.9.0] - 2018-09-28 +## [0.9.0] — 2018-09-28 ### Added - Linux support -## [0.8.0] - 2018-09-22 +## [0.8.0] — 2018-09-22 ### Changed - Changed `Roll` to `Int` typealias -## [0.7.0] - 2018-09-22 +## [0.7.0] — 2018-09-22 ### Added - LICENSE - Swift 4.2/Xcode 10 compatibility -## [0.6.0] - 2018-09-17 +## [0.6.0] — 2018-09-17 ### Added - `Dice` - `init(_ die: Die, count: Int)` @@ -256,14 +256,14 @@ Update .travis.yml in case https://swiftenv.fuller.li/install.sh is down/has no - `Die` - Addition operators for `Die` and `(Die, Int)` -> `Dice` -## [0.5.0] - 2018-09-13 +## [0.5.0] — 2018-09-13 ### Added - `Rollable` - `roll(times:_:)`: rolls a given number of times and performs the given operation on them. - `MultipleRollResult`: denotes the operation to do on `roll(times:_:)` - `public typealias DKMultipleRollResult = MultipleRollResult` -## [0.4.0] - 2018-09-12 +## [0.4.0] — 2018-09-12 ### Added - Typealiases - `public typealias DKDie = Die` @@ -271,14 +271,14 @@ Update .travis.yml in case https://swiftenv.fuller.li/install.sh is down/has no - `public typealias DKRoll = Roll` - `public typealias DKRollable = Rollable` -## [0.3.0] - 2018-09-11 +## [0.3.0] — 2018-09-11 ### Added - `Die` - multiplication operators for `Die` and `Int` that return `Dice` - `Dice` - multiplication operators for `Dice` and `Int` that return `Dice` -## [0.2.0] - 2018-09-02 +## [0.2.0] — 2018-09-02 ### Added - `Dice` - `numberOfDice`: the number of `Die`s in the object @@ -286,7 +286,7 @@ Update .travis.yml in case https://swiftenv.fuller.li/install.sh is down/has no - `minimumResult`: the lowest possible roll - `maximumResult`: the highest possible roll -## [0.1.0] - 2018-09-01 +## [0.1.0] — 2018-09-01 ### Added - `Die`: class; conforms to `Rollable` - `Dice`: class; conforms to `Rollable` diff --git a/Dangerfile.swift b/Dangerfile.swift index 522e40b5..032ff5fa 100644 --- a/Dangerfile.swift +++ b/Dangerfile.swift @@ -32,17 +32,18 @@ if let range = danger.github.pullRequest.title.range(of: #"(?<=Version )\d+\.\d+ // MARK: Changelog entry if let lineNumber = danger.utils.lines(for: "## [\(newVersion)]", inFile: "CHANGELOG.md").first, let line = danger.utils.readFile("CHANGELOG.md").split(separator: "\n").first(where: { $0.hasPrefix("## [\(newVersion)]") }) { message("There is a CHANGELOG entry for this version") - let dateString = String(line.dropFirst("## [\(newVersion)] - ".count)) let df = DateFormatter() df.dateFormat = "yyyy-MM-dd" let ds = df.string(from: Date()) - if ds == dateString { - message("The date for this version's entry is today, \(dateString)") + let correct = "## [\(newVersion)] — \(ds)" + if line == correct { + message("The CHANGELOG entry heading is correct") } else { - fail("The date for this version's entry is not today!") - fail(message: "The date for this version's entry is not today!", file: "CHANGELOG.md", line: lineNumber) - suggestion(code: "## [\(newVersion)] — \(ds)", file: "CHANGELOG.md", line: lineNumber) + fail("There is something wrong with the CHANGELOG entry heading!") + fail(message: "There is something wrong with this CHANGELOG entry heading!", file: "CHANGELOG.md", line: lineNumber) + suggestion(code: correct, file: "CHANGELOG.md", line: lineNumber) } + //if line.range(of: #"## \[.+\] - \d\d\d\d-\d\d-\d\d"#, options: .regularExpression) != nil { // MARK: Changelog compare link if let upcomingLineNumber = danger.utils.lines(for: "[Upcoming]:", inFile: "CHANGELOG.md").first, let upcomingLine = danger.utils.readFile("CHANGELOG.md").split(separator: "\n").first(where: { $0.hasPrefix("[Upcoming]:") }) { From 4354e5d252cf21cf6fc27d497d95c831b71b1396 Mon Sep 17 00:00:00 2001 From: Samasaur1 <30577766+Samasaur1@users.noreply.github.com> Date: Sat, 4 Jun 2022 10:36:34 -0400 Subject: [PATCH 47/48] Clean up PR template --- .github/PULL_REQUEST_TEMPLATE.md | 19 ++++++------------- Dangerfile.swift | 1 - 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 49350c31..c1a143da 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,13 +1,11 @@ -If you are merging to `master`, please follow these instructions: -1. Your PR title should be "Version $VERSION: $DESCRIPTION", where $VERSION is the next version, and $DESCRIPTION is a description of your changes, in command form (i.e., "add", not "added"). - 1. Given version X.Y.Z - 1. If your change is internal/a bug fix, the next version should increment Z - 1. If your change adds a small/related new feature, the next version should increment Y and set Z to 0 - 1. If your change is breaking/major/adds a large/unrelated new feature, increment X and set Y and Z to 0. +If you are merging to a non-`master` branch, I assume you know what you are doing. Most PRs should be made to `master`. + +If you are merging to `master`, you have two options: explicitly say that these changes constitute a "new version" (you probably don't want to do that, and I will walk you through it if that is what you should be doing), or just merge your changes in to `master` and they will be released when I determine it is time for a new version. + +Assuming you are not merging as a new version: 1. Fill in the list below with your changes, referring to issues when appropriate (https://docs.github.com/articles/closing-issues-using-keywords). 1. Fill in any information you want to share, if you have any. Otherwise, remove that line. -1. Replace the first four checkboxes with any tasks that need to be completed before merging. Leave the changelog and bump version tasks in place, checking them off once you have completed them. -1. Ensure you leave the last three items alone, and at the bottom of your PR body. +1. Change the task list below to contain any tasks you need to complete before this PR can be merged. 1. You can now delete these instructions, so that "Here's what's new" is the first line of your PR body. Here's what's new: @@ -23,8 +21,3 @@ Here's what has to happen: - [ ] Specific - [ ] This - [ ] PR -- [ ] Ensure the changelog has everything new that is being added -- [ ] Bump version (run `updateVersion.sh`) -1. Wait for CI -1. Merge -1. Run `release.sh` diff --git a/Dangerfile.swift b/Dangerfile.swift index 032ff5fa..214c4148 100644 --- a/Dangerfile.swift +++ b/Dangerfile.swift @@ -43,7 +43,6 @@ if let range = danger.github.pullRequest.title.range(of: #"(?<=Version )\d+\.\d+ fail(message: "There is something wrong with this CHANGELOG entry heading!", file: "CHANGELOG.md", line: lineNumber) suggestion(code: correct, file: "CHANGELOG.md", line: lineNumber) } - //if line.range(of: #"## \[.+\] - \d\d\d\d-\d\d-\d\d"#, options: .regularExpression) != nil { // MARK: Changelog compare link if let upcomingLineNumber = danger.utils.lines(for: "[Upcoming]:", inFile: "CHANGELOG.md").first, let upcomingLine = danger.utils.readFile("CHANGELOG.md").split(separator: "\n").first(where: { $0.hasPrefix("[Upcoming]:") }) { From f1a42eb8744b22cd6461f8a014850449478cac3f Mon Sep 17 00:00:00 2001 From: Samasaur1 <30577766+Samasaur1@users.noreply.github.com> Date: Sat, 4 Jun 2022 10:43:26 -0400 Subject: [PATCH 48/48] It's perfectly fine for a PR not to have any tasks --- Dangerfile.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dangerfile.swift b/Dangerfile.swift index 214c4148..309ddd1d 100644 --- a/Dangerfile.swift +++ b/Dangerfile.swift @@ -165,7 +165,7 @@ if let body = danger.github.pullRequest.body { fail("**Task \(num + 1) incomplete:** \(line.dropFirst(6))") // "- [ ] " } } else { - warn("PR has no tasks (are you sure?)") + message("PR has no tasks (are you sure?)") } } else { warn("Cannot fetch PR body!")