From 0bcf1ad601e2a7f30efa9b8abb1e6b2095c0e8f0 Mon Sep 17 00:00:00 2001 From: David Jennes Date: Wed, 27 Jul 2022 02:11:21 +0200 Subject: [PATCH] Switch from travis to github actions --- .github/dependabot.yml | 7 +++ .github/workflows/danger.yml | 25 ++++++++ .github/workflows/lint-cocoapods.yml | 23 +++++++ .github/workflows/release-check-versions.yml | 23 +++++++ .github/workflows/swiftlint.yml | 26 ++++++++ .github/workflows/tag-publish.yml | 44 +++++++++++++ .github/workflows/test-spm.yml | 66 ++++++++++++++++++++ .travis.yml | 22 ------- 8 files changed, 214 insertions(+), 22 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/danger.yml create mode 100644 .github/workflows/lint-cocoapods.yml create mode 100644 .github/workflows/release-check-versions.yml create mode 100644 .github/workflows/swiftlint.yml create mode 100644 .github/workflows/tag-publish.yml create mode 100644 .github/workflows/test-spm.yml delete mode 100644 .travis.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..2c7d1708 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +version: 2 +updates: + # Maintain dependencies for GitHub Actions + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml new file mode 100644 index 00000000..322aefc8 --- /dev/null +++ b/.github/workflows/danger.yml @@ -0,0 +1,25 @@ +name: Danger + +on: + push: + branches: master + pull_request: + +jobs: + check: + name: Danger Check + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + - + name: Run Danger + run: bundle exec danger --verbose --dangerfile=rakelib/Dangerfile + env: + DANGER_GITHUB_API_TOKEN: ${{ secrets.danger_github_api_token }} diff --git a/.github/workflows/lint-cocoapods.yml b/.github/workflows/lint-cocoapods.yml new file mode 100644 index 00000000..60e88e79 --- /dev/null +++ b/.github/workflows/lint-cocoapods.yml @@ -0,0 +1,23 @@ +name: Lint Cocoapods + +on: + push: + branches: master + pull_request: + +jobs: + lint: + name: Pod Lint + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + - + name: Lint podspec + run: bundle exec rake pod:lint diff --git a/.github/workflows/release-check-versions.yml b/.github/workflows/release-check-versions.yml new file mode 100644 index 00000000..748c4dfa --- /dev/null +++ b/.github/workflows/release-check-versions.yml @@ -0,0 +1,23 @@ +name: Check Versions + +on: + push: + branches: + - 'release/**' + +jobs: + check_versions: + name: Check Versions + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + - + name: Check versions + run: bundle exec rake release:check_versions diff --git a/.github/workflows/swiftlint.yml b/.github/workflows/swiftlint.yml new file mode 100644 index 00000000..0c2d1b74 --- /dev/null +++ b/.github/workflows/swiftlint.yml @@ -0,0 +1,26 @@ +name: SwiftLint + +on: + push: + branches: master + pull_request: + +jobs: + lint: + name: SwiftLint + runs-on: macos-latest + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + - + name: Lint source code + run: bundle exec rake lint:code + - + name: Lint tests source code + run: bundle exec rake lint:tests diff --git a/.github/workflows/tag-publish.yml b/.github/workflows/tag-publish.yml new file mode 100644 index 00000000..99e7d668 --- /dev/null +++ b/.github/workflows/tag-publish.yml @@ -0,0 +1,44 @@ +name: Publish on Tag + +on: + push: + tags: + - '*' + workflow_dispatch: + +jobs: + cocoapods: + name: Push To CocoaPods + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + - + name: Push to CocoaPods + run: bundle exec rake release:cocoapods + env: + COCOAPODS_TRUNK_TOKEN: ${{secrets.COCOAPODS_TRUNK_TOKEN}} + + github: + name: GitHub Release + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + - + name: Create release on GitHub + run: bundle exec rake release:github + env: + DANGER_GITHUB_API_TOKEN: ${{ secrets.danger_github_api_token }} diff --git a/.github/workflows/test-spm.yml b/.github/workflows/test-spm.yml new file mode 100644 index 00000000..e647bb5b --- /dev/null +++ b/.github/workflows/test-spm.yml @@ -0,0 +1,66 @@ +name: Test SPM + +on: + push: + branches: master + pull_request: + +jobs: + linux: + name: Test SPM Linux + runs-on: ubuntu-latest + container: swiftgen/swift:5.6 + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + # Note: we can't use `ruby/setup-ruby` on custom docker images, so we + # have to do our own caching + name: Cache gems + uses: actions/cache@v3 + with: + path: vendor/bundle + key: ${{ runner.os }}-gems-${{ hashFiles('Gemfile.lock') }} + restore-keys: | + ${{ runner.os }}-gems- + - + name: Cache SPM + uses: actions/cache@v3 + with: + path: .build + key: ${{ runner.os }}-spm-${{ hashFiles('Package.resolved') }} + restore-keys: | + ${{ runner.os }}-spm- + - + name: Bundle install + run: | + bundle config path vendor/bundle + bundle install --jobs 4 --retry 3 + - + name: Run tests + run: bundle exec rake spm:test + + macos: + name: Test SPM macOS + runs-on: macos-latest + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + - + name: Cache SPM + uses: actions/cache@v3 + with: + path: .build + key: ${{ runner.os }}-spm-${{ hashFiles('Package.resolved') }} + restore-keys: | + ${{ runner.os }}-spm- + - + name: Run tests + run: bundle exec rake spm:test diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 871283e3..00000000 --- a/.travis.yml +++ /dev/null @@ -1,22 +0,0 @@ -matrix: - include: - - os: osx - osx_image: xcode11.4 - env: SWIFT_VERSION=4.2 - - os: osx - osx_image: xcode11.4 - env: SWIFT_VERSION=5.0 - - os: linux - env: SWIFT_VERSION=4.2 - - os: linux - env: SWIFT_VERSION=5.0 -language: generic -sudo: required -dist: trusty -install: - - if [ "$TRAVIS_OS_NAME" == "linux" ]; then eval "$(curl -sL https://swiftenv.fuller.li/install.sh)"; fi - - if [ "$TRAVIS_OS_NAME" == "osx" ]; then wget --output-document /tmp/SwiftLint.pkg https://github.com/realm/SwiftLint/releases/download/0.39.2/SwiftLint.pkg && - sudo installer -pkg /tmp/SwiftLint.pkg -target /; fi -script: - - swift test - - if [ "$TRAVIS_OS_NAME" == "osx" ]; then swiftlint; fi