From b95ce7668bac09d5cdc4b89dbb68ba9959a134d2 Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Thu, 30 Apr 2020 07:17:46 +0200 Subject: [PATCH] chore(ci): refactor build (#29) * chore: simplify workflows * chore: only build on master and renovate breanches * chore: rename jobs * chore: cancel previous builds * chore: testing * chore: update config * chore: add tests * chore: update renovate * chore: simplify entrypoint * chore: pass to default entrypoint * chore: include forks * fix: wrong home * chore: update config * fix: set renovate token in command rather than exporting Co-authored-by: Jeroen de Bruijn --- .github/config.js | 29 +++++++++ .github/renovate.json | 16 ++++- .github/workflows/build.yml | 68 ++++++++++++++++++++++ .github/workflows/lint-commit-messages.yml | 18 ------ .github/workflows/lint.yml | 20 ------- src/Dockerfile | 2 +- src/entrypoint.sh | 12 ++-- 7 files changed, 120 insertions(+), 45 deletions(-) create mode 100644 .github/config.js create mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/lint-commit-messages.yml delete mode 100644 .github/workflows/lint.yml diff --git a/.github/config.js b/.github/config.js new file mode 100644 index 00000000..202b8c60 --- /dev/null +++ b/.github/config.js @@ -0,0 +1,29 @@ +module.exports = { + branchPrefix: 'test-renovate/', + dryRun: true, + gitAuthor: 'Renovate Bot ', + logLevel: 'debug', + onboarding: false, + platform: 'github', + includeForks: true, + repositories: [ + 'renovatebot/github-action', + 'renovate-tests/cocoapods1', + 'renovate-tests/gomod1', + ], + packageRules: [ + { + description: 'lockFileMaintenance', + updateTypes: [ + 'pin', + 'digest', + 'patch', + 'minor', + 'major', + 'lockFileMaintenance', + ], + masterIssueApproval: false, + stabilityDays: 0, + }, + ], +}; diff --git a/.github/renovate.json b/.github/renovate.json index c60364c5..f9afe9d2 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -1,12 +1,24 @@ { "extends": [ "config:base", + ":rebaseStalePrs", ":pinDependencies", + ":masterIssue", ":timezone(Europe/Amsterdam)", - ":assignee(vidavidorra)" + ":assignee(vidavidorra)", + "docker:enableMajor" ], "prCreation": "not-pending", "schedule": ["before 6am"], + "lockFileMaintenance": { + "enabled": true, + "schedule": ["at any time"], + "masterIssueApproval": true + }, + "major": { + "stabilityDays": 3, + "masterIssueApproval": true + }, "packageRules": [ { "languages": ["docker"], @@ -17,6 +29,7 @@ "description": "Automerge devDependencies updates", "depTypeList": ["devDependencies"], "updateTypes": ["pin", "digest", "patch", "minor"], + "schedule": ["at any time"], "automerge": true, "automergeType": "branch" }, @@ -24,6 +37,7 @@ "description": "Automerge renovate minor and patch updates", "packageNames": ["renovate/renovate"], "updateTypes": ["minor", "patch"], + "schedule": ["at any time"], "automerge": true, "automergeType": "branch" } diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..aca0e16f --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,68 @@ +name: build + +on: + push: + branches: + - master + - 'renovate/**' + + pull_request: + +jobs: + cleanup: + runs-on: ubuntu-latest + timeout-minutes: 5 + + steps: + - name: github-cleanup + uses: renovatebot/internal-tools@v0 + continue-on-error: true + with: + command: github-cleanup + token: ${{ secrets.GITHUB_TOKEN }} + + commitlint: + needs: [cleanup] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2.1.0 + with: + fetch-depth: 0 + - name: Lint commit messages + uses: wagoid/commitlint-github-action@v1.6.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + lint: + needs: [cleanup] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2.1.0 + - name: Setup node + uses: actions/setup-node@v1.4.1 + with: + node-version: '12.x' + - name: Install project + run: npm ci + - name: Lint + run: npm run lint + + e2e: + needs: [cleanup] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2.1.0 + - name: Renovate test + uses: ./ + with: + configurationFile: .github/config.js + token: ${{ secrets.RENOVATE_TOKEN }} + + build: + needs: [lint, commitlint, e2e] + runs-on: ubuntu-latest + steps: + - run: echo 'Dummy' diff --git a/.github/workflows/lint-commit-messages.yml b/.github/workflows/lint-commit-messages.yml deleted file mode 100644 index 2de87938..00000000 --- a/.github/workflows/lint-commit-messages.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Lint commit messages -on: - push: - branches: - - master - pull_request: -jobs: - commitlint: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2.1.0 - with: - fetch-depth: 0 - - name: Lint commit messages - uses: wagoid/commitlint-github-action@v1.6.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 6fc29499..00000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Lint -on: - push: - branches: - - master - pull_request: -jobs: - lint: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2.1.0 - - name: Setup node - uses: actions/setup-node@v1.4.1 - with: - node-version: '12.x' - - name: Install project - run: npm ci - - name: Lint - run: npm run lint diff --git a/src/Dockerfile b/src/Dockerfile index 9f12c5f9..0fac9de0 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -1,4 +1,4 @@ -FROM renovate/renovate:19.219.11 +FROM renovate/renovate:19.221.0 COPY entrypoint.sh /usr/entrypoint.sh diff --git a/src/entrypoint.sh b/src/entrypoint.sh index 6030bcfc..5c1dab49 100755 --- a/src/entrypoint.sh +++ b/src/entrypoint.sh @@ -2,10 +2,11 @@ # # Entrypoint for Docker. -readonly CONFIGURATION_FILE="${1}" -readonly TOKEN="${2}" +export RENOVATE_CONFIG_FILE="${GITHUB_WORKSPACE}/${1}" +readonly _RENOVATE_TOKEN="${2}" -export RENOVATE_CONFIG_FILE="${GITHUB_WORKSPACE}/${CONFIGURATION_FILE}" +# We are running as ubuntu, so no write access to /github/home +export HOME=/home/ubuntu if [[ ! -f "${RENOVATE_CONFIG_FILE}" ]]; then echo "ERROR: Couldn't find file ${RENOVATE_CONFIG_FILE}" 1>&2 @@ -16,5 +17,6 @@ fi # # Mimic the original ENTRYPOINT of the renovate/renovate Docker container. See # the following link for this entry. -# https://github.com/renovatebot/renovate/blob/19.175.3/Dockerfile#L220 -RENOVATE_TOKEN="${TOKEN}" node /usr/src/app/dist/renovate.js +# https://github.com/renovatebot/docker-renovate/blob/d3aa0d99931ea7ad7e901a1e538eba0d61268229/Dockerfile#L63 + +RENOVATE_TOKEN="${_RENOVATE_TOKEN}" /usr/local/bin/docker-entrypoint.sh