add pull through cache for earthly #365
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
- pull_request | |
jobs: | |
test: | |
runs-on: self-hosted | |
permissions: | |
contents: read | |
env: | |
# is an empty string if it doesn't exists | |
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} | |
FORCE_COLOR: 1 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Put back the git branch into git (Earthly uses it for tagging) | |
run: | | |
branch="" | |
if [ -n "$GITHUB_HEAD_REF" ]; then | |
branch="$GITHUB_HEAD_REF" | |
else | |
branch="${GITHUB_REF##*/}" | |
fi | |
git checkout -b "$branch" || true | |
- name: Install earthly | |
run: "sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/download/v0.6.23/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly'" | |
- name: Configure pull-through-cache | |
run: | | |
mkdir ~/.earthly | |
cat <<EOF > /home/runner/.earthly/config.yml | |
global: | |
buildkit_additional_config: | | |
[registry."docker.io"] | |
mirrors = ["193.148.176.21:5000"] | |
[registry."193.148.176.21:5000"] | |
http = true | |
insecure = true | |
EOF | |
- name: Check earthly config | |
run: cat /home/runner/.earthly/config.yml | |
- name: Earthly version | |
run: earthly --version | |
- name: Earthly help | |
run: earthly --help | |
- name: Earthly env | |
run: echo $EARTHLY_CONFIG | |
- name: Run Snyk | |
if: ${{ env.SNYK_TOKEN }} | |
run: earthly --ci --secret SNYK_TOKEN +snyk | |
- name: Run Tests | |
run: EARTHLY_CONFIG=/home/runner/.earthly/config.yml earthly --ci +all-except-snyk | |