From 503d6653e4fde915d1697f0fadaf1264674d42be Mon Sep 17 00:00:00 2001 From: Szymon Uglis Date: Thu, 16 Dec 2021 22:01:35 +0100 Subject: [PATCH] Update CI jobs --- .github/workflows/deploy_docs.yml | 22 +++++++++++----- .github/workflows/publish.yml | 13 ++++++++- .github/workflows/unit_tests.yml | 44 +++++++++++++++---------------- 3 files changed, 49 insertions(+), 30 deletions(-) diff --git a/.github/workflows/deploy_docs.yml b/.github/workflows/deploy_docs.yml index 883e8f8..13c1c9d 100644 --- a/.github/workflows/deploy_docs.yml +++ b/.github/workflows/deploy_docs.yml @@ -4,30 +4,38 @@ on: push: branches: - dev + - next jobs: deploy-docs: runs-on: ubuntu-latest steps: - - name: Cache - uses: actions/cache@v2 - with: - path: ~/.pub_cache - key: ${{ runner.os }} - - name: Setup Dart Action uses: dart-lang/setup-dart@v1 - name: Checkout uses: actions/checkout@v2.3.4 + - name: Cache + uses: actions/cache@v2 + with: + path: ~/.pub-cache + key: ${{ runner.os }}-pubspec-${{ hashFiles('**/pubspec.lock') }} + restore-keys: | + ${{ runner.os }}-pubspec- + - name: Install dependencies run: dart pub get - name: Generate docs run: dartdoc + - name: Extract branch name + shell: bash + run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" + id: extract_branch + - name: Deploy nyxx dev docs uses: easingthemes/ssh-deploy@v2.1.5 env: @@ -36,4 +44,4 @@ jobs: SOURCE: "doc/api/" REMOTE_HOST: ${{ secrets.DEPLOY_REMOTE_HOST }} REMOTE_USER: ${{ secrets.DEPLOY_REMOTE_USER }} - TARGET: "${{ secrets.DEPLOY_REMOTE_TARGET }}/dartdocs/nyxx_commander/" + TARGET: "${{ secrets.DEPLOY_REMOTE_TARGET }}/dartdocs/nyxx_commander/${{ steps.extract_branch.outputs.branch }}/" diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index fa3ee14..a20fe92 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -9,7 +9,17 @@ jobs: nyxx_publish: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - name: Checkout + uses: actions/checkout@v2 + + - name: Cache + uses: actions/cache@v2 + with: + path: ~/.pub-cache + key: ${{ runner.os }}-pubspec-${{ hashFiles('**/pubspec.lock') }} + restore-keys: | + ${{ runner.os }}-pubspec- + - name: 'publish nyxx package to pub.dev' id: publish uses: k-paxian/dart-package-publisher@master @@ -18,6 +28,7 @@ jobs: force: true suppressBuildRunner: true credentialJson: ${{ secrets.CREDENTIAL_JSON }} + - name: 'Commit release tag' if: steps.publish.outputs.success uses: hole19/git-tag-action@master diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 70ceb4a..4a21e88 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -12,18 +12,19 @@ jobs: env: TEST_TOKEN: ${{ secrets.TEST_TOKEN }} steps: - - name: Cache - uses: actions/cache@v2 - with: - path: ~/.pub_cache - key: ${{ runner.os }} - - name: Setup Dart Action uses: dart-lang/setup-dart@v1 - name: Checkout uses: actions/checkout@v2.3.4 + - name: Cache + uses: actions/cache@v2 + with: + path: ~/.pub-cache + key: ${{ runner.os }}-pubspec-${{ hashFiles('**/pubspec.lock') }} + restore-keys: | + ${{ runner.os }}-pubspec- - name: Install dependencies run: dart pub get @@ -36,18 +37,19 @@ jobs: env: TEST_TOKEN: ${{ secrets.TEST_TOKEN }} steps: - - name: Cache - uses: actions/cache@v2 - with: - path: ~/.pub_cache - key: ${{ runner.os }} - - name: Setup Dart Action uses: dart-lang/setup-dart@v1 - name: Checkout uses: actions/checkout@v2.3.4 + - name: Cache + uses: actions/cache@v2 + with: + path: ~/.pub-cache + key: ${{ runner.os }}-pubspec-${{ hashFiles('**/pubspec.lock') }} + restore-keys: | + ${{ runner.os }}-pubspec- - name: Install dependencies run: dart pub get @@ -61,12 +63,6 @@ jobs: env: TEST_TOKEN: ${{ secrets.TEST_TOKEN }} steps: - - name: Cache - uses: actions/cache@v2 - with: - path: ~/.pub_cache - key: ${{ runner.os }} - - name: Setup Dart Action uses: dart-lang/setup-dart@v1 @@ -76,16 +72,20 @@ jobs: - name: Checkout uses: actions/checkout@v2.3.4 + - name: Cache + uses: actions/cache@v2 + with: + path: ~/.pub-cache + key: ${{ runner.os }}-pubspec-${{ hashFiles('**/pubspec.lock') }} + restore-keys: | + ${{ runner.os }}-pubspec- + - name: Install dependencies run: dart pub get - name: Unit tests run: dart run test --coverage="coverage" test/unit/** - - name: Integration tests - run: dart run test --coverage="coverage" test/integration/** - continue-on-error: true - - name: Format coverage run: dart run coverage:format_coverage --lcov --in=coverage --out=coverage/coverage.lcov --packages=.packages --report-on=lib