Skip to content

Commit

Permalink
[ci] github workflows
Browse files Browse the repository at this point in the history
this commit can be reverted if we decide we don't need github workflows
anymore.
  • Loading branch information
ganthern committed Feb 10, 2025
1 parent b7a234d commit b577ea3
Show file tree
Hide file tree
Showing 16 changed files with 552 additions and 309 deletions.
34 changes: 34 additions & 0 deletions .github/shared/setup-emscripten/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "Setup emscripten"
description: "Setup emcc"
inputs:
emscripten-version:
required: true
description: "emscripten version"
runs:
using: "composite"

steps:
- name: "get emscripten cached location"
shell: bash
run: |
echo "emscripten_path=$(pwd)/emsdk" >> $GITHUB_ENV
- name: cache emscripten
id: cache-emscripten
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # 4.2.0
with:
path: ${{ env.emscripten_path }}
key: emscripten-${{ inputs.emscripten-version }}
- name: install emscripten
shell: bash
if: steps.cache-emscripten.outputs.cache-hit != 'true'
run: |
git clone --branch ${{ inputs.emscripten-version }} https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install latest
./emsdk activate latest
source ./emsdk_env.sh
- name: add emscripten to path
shell: bash
run: |
echo ${{ env.emscripten_path }}/upstream/bin >> $GITHUB_PATH
echo ${{ env.emscripten_path }}/upstream/emscripten >> $GITHUB_PATH
26 changes: 26 additions & 0 deletions .github/shared/setup-rust/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: "Setup Rust"
description: "Setup rust environment and dependencies"
runs:
using: "composite"

steps:
- name: setup rust
shell: bash
run: |
# Specify an exact Rust version.
#
# Newer versions will enable newer features, but at the same time, you may get newer warnings which you have
# to fix. This should be a manual step.
rustup install 1.84.0
rustup default 1.84.0
rustup component add rustfmt clippy
- name: Versions
shell: bash
run: |
rustup --version
cargo --version
rustc --version
- name: Add rust targets
if: env.rust-targets != ''
shell: bash
run: rustup target add ${{ env.rust-targets }}
24 changes: 24 additions & 0 deletions .github/shared/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: "Setup"
description: "Setup js environment and dependencies"
runs:
using: "composite"

steps:
- name: Use Node.js
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 #v4.0.2
with:
node-version: 20.18.0
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Get better-sqlite3 cached location
shell: bash
run: |
echo "better_sqlite3_path=$(node buildSrc/getNativeCacheLocation.js better-sqlite3)" >> $GITHUB_ENV
- name: try to use cached better-sqlite3
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 #v4.2.0
with:
path: ${{ env.better_sqlite3_path }}
key: ${{ env.better_sqlite3_path }}
- name: install packages
shell: bash
run: npm ci
30 changes: 30 additions & 0 deletions .github/shared/swift-common/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: "Swift Common"
description: "Common Swift Checks"

runs:
using: "composite"

steps:
- name: Setup Swift
uses: swift-actions/setup-swift@cdbe0f7f4c77929b6580e71983e8606e55ffe7e4 # v1.26.2
with:
swift-version: ${{ env.swift-version }}
- name: Install Homebrew
uses: Homebrew/actions/setup-homebrew@d54a6744d5fcdff54b45a9659f3e17f769389952
- name: Install Homebrew dependencies
shell: bash
run: |
brew install swiftlint swift-format xcodegen
- uses: ./.github/shared/setup-rust
- name: Lint
working-directory: ./app-ios
shell: bash
run: ./lint.sh lint:check
- name: Format
working-directory: ./app-ios
shell: bash
run: ./lint.sh style:check
- name: Xcodegen sdk
working-directory: tuta-sdk/ios
shell: bash
run: xcodegen
61 changes: 61 additions & 0 deletions .github/workflows/kotlin-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Kotlin CI

on:
pull_request:
types: [ opened, synchronize, edited ]
paths:
- 'app-android/**'
- '.github/workflows/kotlin-test.yml'
push:
branches:
- dev-*
- '*/dev'
paths:
- 'app-android/**'
workflow_dispatch:

jobs:
test-kotlin:
runs-on: ubuntu-latest
env:
java-version: 21
java-distribution: 'temurin'
TZ: "Europe/Berlin" # We have some tests for same day alarms that depends on this TimeZone
rust-targets: "aarch64-linux-android armv7-linux-androideabi x86_64-linux-android i686-linux-android"
permissions:
actions: none
checks: none
contents: read
deployments: none
id-token: none
issues: none
discussions: none
packages: none
pages: none
pull-requests: none
repository-projects: none
security-events: none
statuses: none

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
with:
submodules: 'true'
- name: Create dummy build folder
run: mkdir build && mkdir build-calendar-app # We need this because gradlew lint searches for the app assets
- name: Set up JDK ${{ env.java-version }}
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 #4.2.1
with:
java-version: ${{ env.java-version }}
distribution: ${{ env.java-distribution }}
- name: Setup Android SDK
uses: android-actions/setup-android@07976c6290703d34c16d382cb36445f98bb43b1f #3.2.0
- name: Setup Android NDK
run: sdkmanager "ndk;26.1.10909125"
- uses: ./.github/shared/setup-rust
- name: Lint
working-directory: ./app-android
run: ./gradlew lint --quiet
- name: Test
working-directory: ./app-android
run: ./gradlew test
42 changes: 42 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Create a release draft

on:
workflow_dispatch:
inputs:
tag:
required: true

jobs:
release:
runs-on: ubuntu-latest

permissions:
actions: none
checks: none
contents: write
deployments: none
id-token: none
issues: read
discussions: none
packages: none
pages: none
pull-requests: none
repository-projects: none
security-events: none
statuses: none

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
- name: Use Node.js
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 #v4.0.2
with:
node-version: 20.18.0
- name: npm i
run: npm i @octokit/rest
- name: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: "node buildSrc/releaseNotes --tag tutanota-release-${{ github.event.inputs.tag }}
--releaseName ${{ github.event.inputs.tag }}
--milestone ${{ github.event.inputs.tag }}
--platform all"
42 changes: 42 additions & 0 deletions .github/workflows/rust-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Rust CI

on:
pull_request:
types: [ opened, synchronize, edited ]
paths:
- 'tuta-sdk/**'
- 'packages/node-mimimi/**'
- '.github/workflows/rust-test.yml'
push:
branches:
- dev-*
- '*/dev'

jobs:
test:
runs-on: ubuntu-latest

permissions:
actions: none
checks: none
contents: read
deployments: none
id-token: none
issues: none
discussions: none
packages: none
pages: none
pull-requests: none
repository-projects: none
security-events: none
statuses: none

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
- uses: ./.github/shared/setup-rust
- name: rust format
run: cargo fmt --check
- name: rust warning check with clippy
run: cargo clippy --all --no-deps -- -Dwarnings # -Dwarnings changes warnings to errors so that the check fails
- name: rust tests
run: cargo test --all
52 changes: 52 additions & 0 deletions .github/workflows/swift-calendar-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Swift CI - Calendar

on:
pull_request:
types: [ opened, synchronize, edited ]
paths:
- 'app-ios/**'
- '.github/workflows/swift-calendar-test.yml'
- '!app-ios/**/Info.plist'
push:
branches:
- dev-*
- '*/dev'
paths:
- 'app-ios/**'

env:
swift-version: "5.9.2"
swift-format-version: "509.0.0"
rust-targets: "aarch64-apple-ios-sim"

jobs:
test-swift:
runs-on: macos-14

permissions:
actions: none
checks: none
contents: read
deployments: none
id-token: none
issues: none
discussions: none
packages: none
pages: none
pull-requests: none
repository-projects: none
security-events: none
statuses: none

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
with:
submodules: 'true'
- uses: ./.github/shared/swift-common
- name: Test Calendar
working-directory: app-ios
run: |
mkdir -p ../build-calendar-app
xcodegen --spec calendar-project.yml
fastlane test_calendar_github
52 changes: 52 additions & 0 deletions .github/workflows/swift-mail-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Swift CI - Mail

on:
pull_request:
types: [ opened, synchronize, edited ]
paths:
- 'app-ios/**'
- '.github/workflows/swift-mail-test.yml'
- '!app-ios/**/Info.plist'
push:
branches:
- dev-*
- '*/dev'
paths:
- 'app-ios/**'

env:
swift-version: "5.9.2"
swift-format-version: "509.0.0"
rust-targets: "aarch64-apple-ios-sim"

jobs:
test-swift:
runs-on: macos-14

permissions:
actions: none
checks: none
contents: read
deployments: none
id-token: none
issues: none
discussions: none
packages: none
pages: none
pull-requests: none
repository-projects: none
security-events: none
statuses: none

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
with:
submodules: 'true'
- uses: ./.github/shared/swift-common
- name: Test Mail
working-directory: app-ios
run: |
mkdir -p ../build
xcodegen --spec mail-project.yml
fastlane test_github
Loading

0 comments on commit b577ea3

Please sign in to comment.