From 3792d2843757beb2fb69440035a5df41b8e7d2e3 Mon Sep 17 00:00:00 2001 From: Marvin Pinto Date: Wed, 25 Dec 2019 11:34:14 -0500 Subject: [PATCH] build: enable caching + other GitHub action refactoring --- .github/workflows/ci.yml | 35 --------------------- .github/workflows/pre-release.yml | 27 ++++++++++++---- .github/workflows/tagged-release.yml | 25 +++++++++++---- .github/workflows/tests.yml | 47 ++++++++++++++++++++++++++++ 4 files changed, 87 insertions(+), 47 deletions(-) delete mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 00520045..00000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,35 +0,0 @@ ---- -name: "ci" - -on: - push: - pull_request: - types: - - "opened" - - "closed" - - "reopened" - - "synchronize" - -jobs: - test: - runs-on: "ubuntu-latest" - steps: - - name: "Checkout source code" - uses: "actions/checkout@v1" - with: - lfs: true - - - name: "Build and run tests" - env: - JEST_VERBOSE: ${{ secrets.JEST_VERBOSE }} - run: | - yarn run reinstall - yarn run lint - yarn run test - yarn run build - - uses: "./packages/keybase-notifications" - if: always() - with: - job_status: ${{ job.status }} - opensentinel_owner: ${{ secrets.OSL_OWNER }} - opensentinel_token: ${{ secrets.OSL_TOKEN }} diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index c059182d..16053868 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -5,11 +5,14 @@ on: push: branches: - "master" + tags-ignore: + - "*" jobs: - pre-release: - name: "Pre Release" + gh_pre_release: runs-on: "ubuntu-latest" + env: + JEST_VERBOSE: ${{ secrets.JEST_VERBOSE }} steps: - name: "Checkout source code" @@ -17,10 +20,22 @@ jobs: with: lfs: true - - name: "Install and build" - run: | - yarn run reinstall - yarn run build + - id: "yarn-cache" + run: echo "::set-output name=dir::$(yarn cache dir)" + - uses: "actions/cache@v1" + with: + path: ${{ steps.yarn-cache.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + + - uses: "actions/cache@v1" + with: + path: "node_modules" + key: ${{ runner.os }}-yarn-node-modules${{ hashFiles('**/yarn.lock') }} + + - run: "yarn install --frozen-lockfile" + - run: "yarn lint" + - run: "yarn test" + - run: "yarn build" - uses: "./packages/automatic-releases/" with: diff --git a/.github/workflows/tagged-release.yml b/.github/workflows/tagged-release.yml index 42569d83..b6670a2b 100644 --- a/.github/workflows/tagged-release.yml +++ b/.github/workflows/tagged-release.yml @@ -7,9 +7,10 @@ on: - "v*" jobs: - tagged-release: - name: "Tagged Release" + gh_tagged_release: runs-on: "ubuntu-latest" + env: + JEST_VERBOSE: ${{ secrets.JEST_VERBOSE }} steps: - name: "Checkout source code" @@ -17,10 +18,22 @@ jobs: with: lfs: true - - name: "Install and build" - run: | - yarn run reinstall - yarn run build + - id: "yarn-cache" + run: echo "::set-output name=dir::$(yarn cache dir)" + - uses: "actions/cache@v1" + with: + path: ${{ steps.yarn-cache.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + + - uses: "actions/cache@v1" + with: + path: "node_modules" + key: ${{ runner.os }}-yarn-node-modules${{ hashFiles('**/yarn.lock') }} + + - run: "yarn install --frozen-lockfile" + - run: "yarn lint" + - run: "yarn test" + - run: "yarn build" - uses: "marvinpinto/action-automatic-releases@latest" with: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..1f96d37c --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,47 @@ +--- +name: "tests" + +on: + push: + pull_request: + types: + - "opened" + - "closed" + - "reopened" + - "synchronize" + +jobs: + gh_tests: + runs-on: "ubuntu-latest" + env: + JEST_VERBOSE: ${{ secrets.JEST_VERBOSE }} + + steps: + - name: "Checkout source code" + uses: "actions/checkout@v1" + with: + lfs: true + + - id: "yarn-cache" + run: echo "::set-output name=dir::$(yarn cache dir)" + - uses: "actions/cache@v1" + with: + path: ${{ steps.yarn-cache.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + + - uses: "actions/cache@v1" + with: + path: "node_modules" + key: ${{ runner.os }}-yarn-node-modules${{ hashFiles('**/yarn.lock') }} + + - run: "yarn install --frozen-lockfile" + - run: "yarn lint" + - run: "yarn test" + - run: "yarn build" + + - uses: "./packages/keybase-notifications" + if: always() + with: + job_status: ${{ job.status }} + opensentinel_owner: ${{ secrets.OSL_OWNER }} + opensentinel_token: ${{ secrets.OSL_TOKEN }}