From 7641fe6b38ed28172df7fec2eb3d43d04e720965 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20Coye=20de=20Brune=CC=81lis?= Date: Tue, 23 Jul 2024 16:45:08 +0200 Subject: [PATCH] test: Fix CI tests for Tuist4 --- .github/workflows/apitests.yml | 35 ++++++++++++++++++++++++++++++++++ .github/workflows/ci.yml | 8 +++++--- .github/workflows/uitests.yml | 35 ++++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/apitests.yml create mode 100644 .github/workflows/uitests.yml diff --git a/.github/workflows/apitests.yml b/.github/workflows/apitests.yml new file mode 100644 index 000000000..07fab4049 --- /dev/null +++ b/.github/workflows/apitests.yml @@ -0,0 +1,35 @@ +name: API tests workflow + +on: + pull_request: + branches: [ master,release-* ] + +jobs: + build: + name: Build and Test project + runs-on: [ self-hosted, iOS ] + + steps: + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.12.1 + with: + access_token: ${{ github.token }} + - uses: jdx/mise-action@v2 + with: + cache: false + - name: Checkout + uses: actions/checkout@v2 + - name: Create test env + env: + ENV_PATH: "kDriveTests/Env.swift" + ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} + USER_ID: ${{ secrets.USER_ID }} + INVITE_USER_ID: ${{ secrets.INVITE_USER_ID }} + INVITE_EMAIL: ${{ secrets.INVITE_EMAIL }} + run: | + touch $ENV_PATH + echo -e "enum Env {\n static let token = \"$ACCESS_TOKEN\"\n\n static let driveId = 420132\n\n static let userId = $USER_ID\n\n static let inviteUserId = $INVITE_USER_ID\n\n static let inviteMail = \"$INVITE_EMAIL\"\n\n static let inviteTeam = 0\n\n static let commonDocumentsId = 3\n}" > $ENV_PATH + - name: Project setup + run: tuist install && tuist generate + - name: API tests + run: tuist test kDrive --test-targets kDriveAPITests diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0e3d485b6..a546aed74 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,6 +30,8 @@ jobs: touch $ENV_PATH echo -e "enum Env {\n static let token = \"$ACCESS_TOKEN\"\n\n static let driveId = 420132\n\n static let userId = $USER_ID\n\n static let inviteUserId = $INVITE_USER_ID\n\n static let inviteMail = \"$INVITE_EMAIL\"\n\n static let inviteTeam = 0\n\n static let commonDocumentsId = 3\n}" > $ENV_PATH - name: Build - run: tuist install && tuist build --generate kDrive - - name: Test - run: tuist test kDrive --test-targets kDriveTests/DriveApiTests + run: tuist install && tuist generate && tuist build + - name: Unit Test + run: tuist test kDrive --skip-ui-tests + - name: UI tests + run: tuist test --device "iPhone 15 Pro" --test-targets kDriveUITests diff --git a/.github/workflows/uitests.yml b/.github/workflows/uitests.yml new file mode 100644 index 000000000..f0a2496d6 --- /dev/null +++ b/.github/workflows/uitests.yml @@ -0,0 +1,35 @@ +name: UI tests workflow + +on: + pull_request: + branches: [ master,release-* ] + +jobs: + build: + name: Build and Test project + runs-on: [ self-hosted, iOS ] + + steps: + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.12.1 + with: + access_token: ${{ github.token }} + - uses: jdx/mise-action@v2 + with: + cache: false + - name: Checkout + uses: actions/checkout@v2 + - name: Create test env + env: + ENV_PATH: "kDriveTests/Env.swift" + ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} + USER_ID: ${{ secrets.USER_ID }} + INVITE_USER_ID: ${{ secrets.INVITE_USER_ID }} + INVITE_EMAIL: ${{ secrets.INVITE_EMAIL }} + run: | + touch $ENV_PATH + echo -e "enum Env {\n static let token = \"$ACCESS_TOKEN\"\n\n static let driveId = 420132\n\n static let userId = $USER_ID\n\n static let inviteUserId = $INVITE_USER_ID\n\n static let inviteMail = \"$INVITE_EMAIL\"\n\n static let inviteTeam = 0\n\n static let commonDocumentsId = 3\n}" > $ENV_PATH + - name: Project setup + run: tuist install && tuist generate + - name: UI tests + run: tuist test --device "iPhone 15 Pro" --test-targets kDriveUITests