Skip to content

Commit

Permalink
Update GitHub workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
majd committed Dec 5, 2022
1 parent f77b0d9 commit 15dbfe4
Show file tree
Hide file tree
Showing 7 changed files with 131 additions and 286 deletions.
166 changes: 38 additions & 128 deletions .github/workflows/distribute.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,140 +8,50 @@ on:
jobs:
get_version:
name: Get version
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- name: Set output
id: set_output
- id: set_output
run: echo ::set-output name=version::${GITHUB_REF#refs/tags/v}
outputs:
version: ${{ steps.set_output.outputs.version }}
test:
name: Run tests
runs-on: macos-12
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cache SwiftPM packages
uses: actions/cache@v3
with:
path: .build/checkouts
key: ${{ runner.os }}-spm-${{ hashFiles('Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-${{ hashFiles('Package.resolved') }}
${{ runner.os }}-spm-
- name: Inject version
run: ./Scripts/version
- name: Run tests
run: swift test
build_macos:
name: Build (macOS)
runs-on: macos-12
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
with:
go-version: '1.19.3'
cache: true
- run: ./tools/version.sh
- run: go test -v github.com/majd/ipatool/...
build:
name: Build
runs-on: macos-latest
needs: [get_version, test]
strategy:
fail-fast: false
matrix:
os: [ darwin, linux, windows ]
arch: [ arm64, amd64 ]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cache SwiftPM packages
uses: actions/cache@v3
with:
path: .build/checkouts
key: ${{ runner.os }}-spm-${{ hashFiles('Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-${{ hashFiles('Package.resolved') }}
${{ runner.os }}-spm-
- name: Inject version
run: ./Scripts/version
- name: Build
run: make build-macos
- name: Upload binary
uses: actions/upload-artifact@v2
with:
name: ipatool-macos-v${{ needs.get_version.outputs.version }}
path: .build/ipatool
if-no-files-found: error
build_ios:
name: Build (iOS)
runs-on: macos-12
needs: [get_version, test]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cache SwiftPM packages
uses: actions/cache@v3
with:
path: .build/checkouts
key: ${{ runner.os }}-spm-${{ hashFiles('Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-${{ hashFiles('Package.resolved') }}
${{ runner.os }}-spm-
- name: Inject version
run: ./Scripts/version
- name: Install dependencies
run: brew install xcodegen ldid
- name: Build
run: make build-ios
- name: Upload binary
uses: actions/upload-artifact@v2
with:
name: ipatool-ios-v${{ needs.get_version.outputs.version }}
path: .build/ipatool
if-no-files-found: error
distribute:
name: Distribute
runs-on: ubuntu-20.04
needs: [get_version, build_ios, build_macos]
steps:
- name: Download binary (macOS)
uses: actions/download-artifact@v2
with:
name: ipatool-macos-v${{ needs.get_version.outputs.version }}
path: ipatool-macos-v${{ needs.get_version.outputs.version }}
- name: Archive binary (macOS)
run: |
mv ipatool-macos-v${{ needs.get_version.outputs.version }}/ipatool ipatool
zip ipatool-macos-v${{ needs.get_version.outputs.version }}.zip ipatool
rm ipatool
- name: Upload release (macOS)
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ipatool-macos-v${{ needs.get_version.outputs.version }}.zip
asset_name: ipatool-macos-v${{ needs.get_version.outputs.version }}.zip
tag: ${{ github.ref }}
overwrite: false
- name: Download binary (iOS)
uses: actions/download-artifact@v2
with:
name: ipatool-ios-v${{ needs.get_version.outputs.version }}
path: ipatool-ios-v${{ needs.get_version.outputs.version }}
- name: Archive binary (iOS)
run: |
mv ipatool-ios-v${{ needs.get_version.outputs.version }}/ipatool ipatool
zip ipatool-ios-v${{ needs.get_version.outputs.version }}.zip ipatool
rm ipatool
- name: Upload release (iOS)
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ipatool-ios-v${{ needs.get_version.outputs.version }}.zip
asset_name: ipatool-ios-v${{ needs.get_version.outputs.version }}.zip
tag: ${{ github.ref }}
overwrite: false
- name: Checkout homebrew repo
uses: actions/checkout@v2
with:
repository: ${{ secrets.HOMEBREW_REPO }}
path: repo
ref: main
token: ${{ secrets.GH_TOKEN }}
- name: Update homebrew repo
run: |
SHA256=$(sha256sum ipatool-macos-v${{ needs.get_version.outputs.version }}.zip | awk '{print $1}')
cd repo
sed -i "3s/.*/ sha256 \"$SHA256\"/" Casks/ipatool.rb
sed -i "2s/.*/ version \"${{ needs.get_version.outputs.version }}\"/" Casks/ipatool.rb
sed -i "5s/.*/ url \"https:\/\/github.com\/majd\/ipatool\/releases\/download\/v${{ needs.get_version.outputs.version }}\/ipatool-macos-v${{ needs.get_version.outputs.version }}.zip\"/" Casks/ipatool.rb
git config --local user.name ${{ secrets.GH_NAME }}
git config --local user.email ${{ secrets.GH_EMAIL }}
git add Casks/ipatool.rb
git commit -m "Update ipatool to v${{ needs.get_version.outputs.version }}"
git push "https://${{ secrets.GH_TOKEN }}@github.com/${{ secrets.HOMEBREW_REPO }}.git" --set-upstream "main"
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
with:
go-version: '1.19.3'
cache: true
- run: ./tools/version.sh
- run: go build -o ipatool-${{ needs.get_version.outputs.version }}-${GOOS//darwin/macos}-$GOARCH
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
- id: output
run: echo ::set-output name=file::ipatool-${{ needs.get_version.outputs.version }}-${GOOS//darwin/macos}-$GOARCH
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
- uses: actions/upload-artifact@v2
with:
name: steps.output.outputs.file
path: steps.output.outputs.file
if-no-files-found: error
55 changes: 15 additions & 40 deletions .github/workflows/dry-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,45 +8,20 @@ on:
jobs:
build:
name: Build
build_ios:
name: Dry build (iOS)
runs-on: macos-12
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
os: [ darwin, linux, windows ]
arch: [ arm64, amd64 ]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cache SwiftPM packages
uses: actions/cache@v3
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
with:
path: .build/checkouts
key: ${{ runner.os }}-spm-${{ hashFiles('Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-${{ hashFiles('Package.resolved') }}
${{ runner.os }}-spm-
- name: Install dependencies
run: brew install xcodegen ldid
- name: Inject version
run: ./Scripts/version
- name: Build
run: |
make build-ios
file .build/ipatool
build_macos:
name: Dry build (macOS)
runs-on: macos-12
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cache SwiftPM packages
uses: actions/cache@v3
with:
path: .build/checkouts
key: ${{ runner.os }}-spm-${{ hashFiles('Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-${{ hashFiles('Package.resolved') }}
${{ runner.os }}-spm-
- name: Inject version
run: ./Scripts/version
- name: Build
run: |
make build-macos
file .build/ipatool
go-version: '1.19.3'
cache: true
- run: ./tools/version.sh
- run: go build -o ipatool-${{ matrix.os }}
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
84 changes: 54 additions & 30 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,44 +11,68 @@ on:
jobs:
build:
name: Build
runs-on: macos-12
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
os: [ darwin, linux, windows ]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cache SwiftPM packages
uses: actions/cache@v3
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
with:
path: .build/checkouts
key: ${{ runner.os }}-spm-${{ hashFiles('Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-${{ hashFiles('Package.resolved') }}
${{ runner.os }}-spm-
- name: Inject version
run: ./Scripts/version
- name: Build
run: make build-macos
- name: Upload binary
uses: actions/upload-artifact@v2
go-version: '1.19.3'
cache: true
- run: ./tools/version.sh
- run: go build -o ipatool-${{ matrix.os }}
env:
GOOS: ${{ matrix.os }}
- uses: actions/upload-artifact@v2
with:
name: ipatool
path: .build/ipatool
name: ipatool-${{ matrix.os }}
path: ipatool-${{ matrix.os }}
if-no-files-found: error
test:
name: Test
runs-on: ${{ matrix.macos }}
test_macos:
name: Test (macOS)
runs-on: macos-latest
needs: [build]
strategy:
fail-fast: false
matrix:
command: [auth, download, purchase, search]
steps:
- uses: actions/download-artifact@v2
with:
name: ipatool-darwin
path: ipatool
- run: chmod +x ./ipatool/ipatool-darwin
- run: ./ipatool/ipatool-darwin ${{ matrix.command }} --help
test_linux:
name: Test (Linux)
runs-on: ubuntu-latest
needs: [build]
strategy:
fail-fast: false
matrix:
command: [auth, download, purchase, search]
steps:
- uses: actions/download-artifact@v2
with:
name: ipatool-linux
path: ipatool
- run: chmod +x ./ipatool/ipatool-linux
- run: ./ipatool/ipatool-linux ${{ matrix.command }} --help
test_windows:
name: Test (Windows)
runs-on: windows-latest
needs: [build]
strategy:
fail-fast: false
matrix:
macos: [macos-11, macos-12]
command: [auth, download, purchase, search]
steps:
- name: Download binary
uses: actions/download-artifact@v2
- uses: actions/download-artifact@v2
with:
name: ipatool
path: ipatool-current
- name: Update permissions
run: chmod +x ./ipatool-current/ipatool
- name: Run tests
run: ./ipatool-current/ipatool ${{ matrix.command }} --help
name: ipatool-windows
path: ipatool
- run: chmod +x ./ipatool/ipatool-windows
- run: ./ipatool/ipatool-windows ${{ matrix.command }} --help
27 changes: 9 additions & 18 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,14 @@ on:
- main

jobs:
test-networking:
name: Test Networking
runs-on: macos-12
run_tests:
name: Run tests
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cache SwiftPM packages
uses: actions/cache@v3
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
with:
path: .build/checkouts
key: ${{ runner.os }}-spm-${{ hashFiles('Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-${{ hashFiles('Package.resolved') }}
${{ runner.os }}-spm-
- name: Inject version
run: ./Scripts/version
- name: Build
run: swift build
- name: Run tests
run: swift test --filter NetworkingTests
go-version: '1.19.3'
cache: true
- run: ./tools/version.sh
- run: go test -v github.com/majd/ipatool/...
Loading

0 comments on commit 15dbfe4

Please sign in to comment.