diff --git a/.github/actions/setup-python/action.yml b/.github/actions/setup-python/action.yml new file mode 100644 index 0000000..b72d3cb --- /dev/null +++ b/.github/actions/setup-python/action.yml @@ -0,0 +1,8 @@ +name: 'Setup Python' +description: 'Setup Python 3.9' +runs: + using: "composite" + steps: + - uses: actions/setup-python@v5 + with: + python-version: '3.9' diff --git a/.github/workflows/all_tests.yml b/.github/workflows/all_tests.yml index ffe30a5..3fbffcf 100644 --- a/.github/workflows/all_tests.yml +++ b/.github/workflows/all_tests.yml @@ -5,34 +5,53 @@ on: workflow_dispatch: jobs: - test: + type-check: runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - include: - - name: Type check - run: python3 -m pip install mypy && mypy --check-untyped-defs src/__main__.py src/downloader - - name: Unit Tests - run: cd src && python3 -m unittest discover -s test/unit - - name: Integration Tests - run: cd src && python3 -m unittest discover -s test/integration - - name: System Quick Tests - run: cd src && python3 -m unittest discover -s test/system/quick -v - - name: System Slow Tests - run: cd src && python3 -m unittest discover -s test/system/slow -v - - name: Full Run Launcher Test - run: ./downloader.sh - steps: - uses: actions/checkout@v4 + - uses: ./.github/actions/setup-python + - name: Type check + run: python3 -m pip install mypy && mypy --check-untyped-defs src/__main__.py src/downloader - - uses: actions/setup-python@v5 - with: - python-version: '3.9' + unit-tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup-python + - name: Unit Tests + run: cd src && python3 -m unittest discover -s test/unit - - name: ${{ matrix.name }} - run: ${{ matrix.run }} + integration-tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup-python + - name: Integration Tests + run: cd src && python3 -m unittest discover -s test/integration + + system-quick-tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup-python + - name: System Quick Tests + run: cd src && python3 -m unittest discover -s test/system/quick -v + + system-slow-tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup-python + - name: System Slow Tests + run: cd src && python3 -m unittest discover -s test/system/slow -v + + launcher-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup-python + - name: Full Run Launcher Test + run: ./downloader.sh env: DEBUG: true DEFAULT_BASE_PATH: ${{ runner.temp }}/downloader_test diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2fc936d..c4d1446 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,26 +12,38 @@ permissions: jobs: - main-test: + unit-tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup-python + - name: Unit Tests + run: cd src && python3 -m unittest discover -s test/unit + + integration-tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup-python + - name: Integration Tests + run: cd src && python3 -m unittest discover -s test/integration + + system-quick-tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup-python + - name: System Quick Tests + run: cd src && python3 -m unittest discover -s test/system/quick -v + + check-changes: runs-on: ubuntu-latest outputs: NEW_RELEASE: ${{ steps.check-changes.outputs.NEW_RELEASE }} steps: - - uses: actions/setup-python@v5 - with: - python-version: '3.9' - - uses: actions/checkout@v4 - - - name: Unit Tests - run: cd src && python3 -m unittest discover -s test/unit - - - name: Integration Tests - run: cd src && python3 -m unittest discover -s test/integration - - - name: System Quick Tests - run: cd src && python3 -m unittest discover -s test/system/quick -v + - uses: ./.github/actions/setup-python - name: Check for changes id: check-changes @@ -54,21 +66,24 @@ jobs: echo "NEW_RELEASE=no" >> "$GITHUB_OUTPUT" fi + system-slow-tests: + runs-on: ubuntu-latest + needs: check-changes + if: needs.check-changes.outputs.NEW_RELEASE == 'yes' + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup-python - name: System Slow Tests - if: steps.check-changes.outputs.NEW_RELEASE == 'yes' run: cd src && python3 -m unittest discover -s test/system/slow -v build: runs-on: ubuntu-latest - needs: main-test - if: needs.main-test.outputs.NEW_RELEASE == 'yes' + needs: [unit-tests, integration-tests, system-quick-tests, system-slow-tests, check-changes] + if: needs.check-changes.outputs.NEW_RELEASE == 'yes' steps: - - uses: actions/setup-python@v5 - with: - python-version: '3.9' - - uses: actions/checkout@v4 + - uses: ./.github/actions/setup-python - name: Build run: | @@ -94,7 +109,6 @@ jobs: pc-launcher-test: runs-on: ${{ matrix.os }} needs: build - if: needs.main-test.outputs.NEW_RELEASE == 'yes' strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] @@ -107,7 +121,7 @@ jobs: python-cmd: python steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Download build artifacts uses: actions/download-artifact@v4 @@ -126,7 +140,6 @@ jobs: compile-release: runs-on: ubuntu-latest needs: pc-launcher-test - if: needs.main-test.outputs.NEW_RELEASE == 'yes' steps: - run: echo "owner_lc=$(echo "${GITHUB_REPOSITORY_OWNER,,}")" >> "$GITHUB_OUTPUT" diff --git a/.github/workflows/pack_launcher.yml b/.github/workflows/pack_launcher.yml index 4ad6756..e0f1af2 100644 --- a/.github/workflows/pack_launcher.yml +++ b/.github/workflows/pack_launcher.yml @@ -11,12 +11,8 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-python@v5 - with: - python-version: '3.9' + - uses: ./.github/actions/setup-python - name: Launcher Test run: ./downloader.sh diff --git a/.github/workflows/pack_pc_launcher.yml b/.github/workflows/pack_pc_launcher.yml index ccb2f42..0795b04 100644 --- a/.github/workflows/pack_pc_launcher.yml +++ b/.github/workflows/pack_pc_launcher.yml @@ -36,7 +36,6 @@ jobs: needs: test steps: - - uses: actions/checkout@v4 - name: Pack PC Launcher