API Test #696
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: API Test | |
# This workflow continuously runs the API Tests for this project twice a day, in order to check, if the remote API is still compatible with this tool. | |
# If the MFA token of the account expires, this workflow can be executed manually in order to acquire a new token. | |
on: | |
schedule: | |
- cron: '20 5,17 * * *' | |
workflow_dispatch: | |
permissions: {} | |
jobs: | |
run-test: | |
name: Run Test | |
runs-on: ubuntu-latest | |
if: github.event_name == 'schedule' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: 'app/.node-version' | |
cache: 'npm' | |
cache-dependency-path: app/ | |
- name: Build | |
run: | | |
npm ci && \ | |
npm run build | |
working-directory: app/ | |
- name: Check MFA Token | |
run: | | |
npm run execute -- token | |
env: | |
FAIL_ON_MFA: true | |
LOG_TO_CLI: true | |
APPLE_ID_USER: ${{ secrets.TEST_APPLE_ID_USER }} | |
APPLE_ID_PWD: ${{ secrets.TEST_APPLE_ID_PWD }} | |
TRUST_TOKEN: ${{ secrets.TEST_TRUST_TOKEN }} | |
working-directory: app/ | |
- name: Run API Test | |
run: | | |
npm run test-api | |
env: | |
NODE_OPTIONS: --experimental-vm-modules # Needed for JEST / ESM compatibility | |
TEST_APPLE_ID_USER: ${{ secrets.TEST_APPLE_ID_USER }} | |
TEST_APPLE_ID_PWD: ${{ secrets.TEST_APPLE_ID_PWD }} | |
TEST_TRUST_TOKEN: ${{ secrets.TEST_TRUST_TOKEN }} | |
working-directory: app/ | |
acquire-token: | |
name: Acquire Token | |
runs-on: ubuntu-latest | |
if: github.event_name == 'workflow_dispatch' | |
env: | |
APPLE_ID_USER: ${{ secrets.TEST_APPLE_ID_USER }} | |
APPLE_ID_PWD: ${{ secrets.TEST_APPLE_ID_PWD }} | |
PORT: 8080 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: 'app/.node-version' | |
cache: 'npm' | |
cache-dependency-path: app/ | |
- name: Build | |
run: | | |
npm ci && \ | |
npm run build | |
working-directory: app/ | |
- name: Install | |
run: | | |
npm link && \ | |
chmod 755 ~/work/icloud-photos-sync/icloud-photos-sync/docker/rootfs/root/enter_mfa.sh && \ | |
ln -s ~/work/icloud-photos-sync/icloud-photos-sync/docker/rootfs/root/enter_mfa.sh /usr/local/bin/enter_mfa && \ | |
chmod 755 ~/work/icloud-photos-sync/icloud-photos-sync/docker/rootfs/root/resend_mfa.sh && \ | |
ln -s ~/work/icloud-photos-sync/icloud-photos-sync/docker/rootfs/root/resend_mfa.sh /usr/local/bin/resend_mfa | |
working-directory: app/ | |
- name: Access runner to acquire token | |
uses: lhotari/action-upterm@v1 | |
with: | |
limit-access-to-users: steilerDev | |
upterm-server: ssh://uptermd.upterm.dev:22 |