Skip to content

Commit

Permalink
fix(docker): use separate jobs to build arm architectures (#66)
Browse files Browse the repository at this point in the history
* fix(docker): use separate jobs to build arm architectures

* chore: scala 3.4 syntax migration
  • Loading branch information
hugo-vrijswijk authored Feb 16, 2024
1 parent 0a161cb commit 309513d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: coursier/cache-action@v6.4
- uses: coursier/cache-action@v6
- uses: VirtusLab/scala-cli-setup@v1
with:
power: true
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,16 @@ jobs:
OS: ["ubuntu-latest"]
platforms:
- linux/amd64
- linux/arm/v7,linux/arm64/v8
- linux/arm/v7
- linux/arm64/v8
include:
- platforms: linux/amd64
uploaded_filename: tgtg-linux-amd64
local_path: artifacts/tgtg-linux-amd64
- platforms: linux/arm/v7,linux/arm64/v8
- platforms: linux/arm/v7
uploaded_filename: tgtg.jar
local_path: artifacts/tgtg.jar
- platforms: linux/arm64/v8
uploaded_filename: tgtg.jar
local_path: artifacts/tgtg.jar
steps:
Expand Down Expand Up @@ -138,12 +142,14 @@ jobs:
if-no-files-found: error
retention-days: 1
- uses: actions/upload-artifact@v4
if: ${{ matrix.platforms != 'linux/arm64/v8' }}
with:
name: ${{ matrix.uploaded_filename }}
path: ${{ matrix.local_path }}
if-no-files-found: error
retention-days: 2
- name: Upload release artifacts
if: ${{ matrix.platforms != 'linux/arm64/v8' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload ${{ needs.release-please.outputs.tag_name }} ${{ matrix.local_path }}
Expand Down
2 changes: 1 addition & 1 deletion Auth.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ final class Auth(tgtg: TooGoodToGo, config: AuthConfig)(using log: Logger[IO]):
yield ()

// Weird summon is needed for scala-js cross-compilation issues
def readLine: IO[String] = stdinUtf8[IO](4096)(summon[Async[IO]])
def readLine: IO[String] = stdinUtf8[IO](4096)(using summon[Async[IO]])
.through(text.lines)
.map(_.strip())
.filter(_.nonEmpty)
Expand Down
14 changes: 7 additions & 7 deletions Model.scala
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,6 @@ case class AccessToken(cookies: Cookies, access_token: ApiToken, ttl: FiniteDura

case class GetItemsResponse(items: Seq[ItemWrapper]) derives Decoder

case class ItemWrapper(item: Item, store: Store, items_available: Int, display_name: String) derives Decoder

given Show[ItemWrapper] = i =>
show"${i.store.store_name} has ${if i.item.name.isBlank() then "box" else i.item.name} available for ${i.item.item_price}"

case class Item(name: String, item_price: Price)

case class Price(code: String, minor_units: Int, decimals: Int)

given Show[Price] = Show.show: price =>
Expand All @@ -57,6 +50,13 @@ given Show[Price] = Show.show: price =>
case _ => price.code
show"$currencySymbol ${price.minor_units / math.pow(10, price.decimals)}"

case class ItemWrapper(item: Item, store: Store, items_available: Int, display_name: String) derives Decoder

given Show[ItemWrapper] = i =>
show"${i.store.store_name} has ${if i.item.name.isBlank() then "box" else i.item.name} available for ${i.item.item_price}"

case class Item(name: String, item_price: Price)

case class Store(store_name: String)

case class LoginRequest(email: Email, device_type: String = "ANDROID") derives Encoder.AsObject
Expand Down

0 comments on commit 309513d

Please sign in to comment.