Skip to content

CI

CI #1644

Workflow file for this run

name: CI
on:
push:
branches:
- "main"
pull_request:
branches:
- "**"
schedule:
- cron: '0 0 * * *'
permissions:
contents: read
packages: write
jobs:
ci:
name: CI
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
suite:
- { path: bundler, name: bundler1 }
- { path: bundler, name: bundler2 }
- { path: cargo, name: cargo }
- { path: common, name: common }
- { path: composer, name: composer }
- { path: docker, name: docker }
- { path: elm, name: elm }
- { path: git_submodules, name: git_submodules }
- { path: github_actions, name: github_actions }
- { path: go_modules, name: go_modules }
- { path: gradle, name: gradle }
- { path: hex, name: hex }
- { path: maven, name: maven }
- { path: npm_and_yarn, name: npm_and_yarn }
- { path: nuget, name: nuget }
- { path: omnibus, name: omnibus }
- { path: python, name: python }
- { path: python, name: python_slow }
- { path: terraform, name: terraform }
env:
BASE_IMAGE: ubuntu:18.04
CORE_IMAGE: dependabot/dependabot-core
CORE_BRANCH_IMAGE: ghcr.io/dependabot/dependabot-core-branch
CORE_CI_IMAGE: ghcr.io/dependabot/dependabot-core-ci
CODE_DIR: /home/dependabot/dependabot-core
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Prepare BRANCH_REF environment variable
run: echo "BRANCH_REF=$(echo '${{ github.ref }}' | sed -E 's/[^A-Za-z0-9]+/-/g')" >> $GITHUB_ENV
- name: Log in to GHCR
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Build dependabot-core image for branch
env:
DOCKER_BUILDKIT: 1
run: |
docker build \
-t "$CORE_IMAGE:latest" \
-t "$CORE_BRANCH_IMAGE:$BRANCH_REF" \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--cache-from "$BASE_IMAGE" \
--cache-from "$CORE_IMAGE:latest" \
--cache-from "$CORE_BRANCH_IMAGE:$BRANCH_REF" \
.
- name: Push dependabot-core-branch image to GHCR
env:
ACCESS_CANARY: ${{ secrets.ACCESS_CANARY }}
if: env.ACCESS_CANARY != ''
run: |
docker push "$CORE_BRANCH_IMAGE:$BRANCH_REF"
- name: Build dependabot-core-ci image
env:
DOCKER_BUILDKIT: 1
run: |
docker build \
-t "$CORE_CI_IMAGE:latest" \
-t "$CORE_CI_IMAGE:branch--$BRANCH_REF" \
-f Dockerfile.ci \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--cache-from "$CORE_CI_IMAGE:latest" \
--cache-from "$CORE_CI_IMAGE:branch--$BRANCH_REF" \
.
- name: Push dependabot-core-ci image to GHCR
env:
ACCESS_CANARY: ${{ secrets.ACCESS_CANARY }}
if: env.ACCESS_CANARY != ''
run: |
docker push "$CORE_CI_IMAGE:latest"
docker push "$CORE_CI_IMAGE:branch--$BRANCH_REF"
- name: Run ${{ matrix.suite.name }} tests
run: |
docker run \
--env "CI=true" \
--env "RAISE_ON_WARNINGS=true" \
--env "DEPENDABOT_TEST_ACCESS_TOKEN=${{ secrets.GITHUB_TOKEN }}" \
--env "SUITE_NAME=${{ matrix.suite.name }}" \
--rm "$CORE_CI_IMAGE:branch--$BRANCH_REF" bash -c \
"cd /home/dependabot/dependabot-core/${{ matrix.suite.path }} && ./script/ci-test"
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: sudo apt-get update -y && sudo apt-get install --no-install-recommends shellcheck
- run: ./bin/lint