Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Github Actions #353

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/config.json
@@ -0,0 +1,7 @@
{
"default_options": [
"--ignore-stdin",
"--pretty=format",
"--traceback"
]
}
78 changes: 78 additions & 0 deletions .github/workflows/ci.yaml
@@ -0,0 +1,78 @@
name: Pulp CI
on: [push, pull_request]
jobs:
pulp:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
env:
- TEST: pulp
- TEST: docs
- TEST: bindings
services:
postgres:
image: postgres:9.6
redis:
image: redis
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: '3.7'
- name: Install httpie
run: |
echo ::group::HTTPIE
sudo apt-get update -yq
sudo -E apt-get -yq --no-install-suggests --no-install-recommends install httpie
echo ::endgroup::
- name: Check commit message
if: github.event_name == 'pull_request'
env:
GITHUB_CONTEXT: ${{ github.event.pull_request.commits_url }}
run: |
echo ::group::REQUESTS
pip install requests
echo ::endgroup::
for sha in $(curl $GITHUB_CONTEXT | jq '.[].sha' | sed 's/"//g')
do
python .travis/validate_commit_message.py $sha
VALUE=$?
if [ "$VALUE" -gt 0 ]; then
exit $VALUE
fi
done
shell: bash
- name: Travis to GH actions
run: |
find ./ -type f -exec sed -i -e 's/TRAVIS_BUILD_DIR/GITHUB_WORKSPACE/g' {} \;
find ./ -type f -exec sed -i -e 's/TRAVIS_EVENT_TYPE/GITHUB_EVENT_NAME/g' {} \;
find ./ -type f -exec sed -i -e 's/TRAVIS_BRANCH/\{GITHUB_REF##*\/\}/g' {} \;
find ./ -type f -exec sed -i -e 's/TRAVIS_PULL_REQUEST_BRANCH/\{GITHUB_REF##*\/\}/g' {} \;
find ./ -type f -exec sed -i -e 's/TRAVIS_TAG/\{GITHUB_REF##*\/\}/g' {} \;
find ./ -type f -exec sed -i -e 's/-z "$TRAVIS_TAG" //g' {} \;
find ./ -type f -exec sed -i -e 's/${TRAVIS_PYTHON_VERSION}/3.7/g' {} \;
find ./ -type f -exec sed -i -e 's/"$TRAVIS_PULL_REQUEST" != "false"/"$GITHUB_EVENT_NAME" = "pull_request"/g' {} \;
find ./ -type f -exec sed -i -e 's/"$TRAVIS_PULL_REQUEST" = "false"/"$GITHUB_EVENT_NAME" != "pull_request"/g' {} \;
find ./ -type f -exec sed -i -e 's/travis_fold:start:/::group::/g' {} \;
find ./ -type f -exec sed -i -e 's/travis_fold:end:$containerlog/::endgroup::/g' {} \;
find ./ -type f -exec sed -i -e 's/.\/.travis\/check_commit.sh/#.\/.travis\/check_commit.sh/g' {} \;
- name: Before Install
run: |
.travis/before_install.sh
echo "::set-env name=TEST::${{ matrix.env.TEST }}"
cd ..
find ./ -type f -exec sed -i -e 's/timeout 90 bash/timeout 120 bash/g' {} \;
find ./ -type f -exec sed -i -e 's/\/usr\/local\/bin\/kubectl/$(which kubectl)/g' {} \;
find ./ -type f -exec sed -i -e 's/# containers are not running yet./sudo cp -i \/etc\/rancher\/k3s\/k3s.yaml $HOME\/.kube\/config/g' {} \;
cd pulp_file
- name: Install
run: |
mkdir -p $HOME/.kube
.travis/install.sh
- name: Before Script
run: .travis/before_script.sh
- name: Script
run: .travis/script.sh
shell: bash
96 changes: 96 additions & 0 deletions .github/workflows/cron.yaml
@@ -0,0 +1,96 @@
name: Cron jobs
on:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '15 1 * * *'
jobs:
pulp:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
env:
- TEST: pulp
- TEST: docs
- TEST: bindings
- TEST: performance
services:
postgres:
image: postgres:9.6
redis:
image: redis
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: '3.7'
- name: Install httpie
run: |
echo ::group::HTTPIE
sudo apt-get update -yq
sudo -E apt-get -yq --no-install-suggests --no-install-recommends install httpie
echo ::endgroup::
- name: Travis to GH actions
run: |
find ./ -type f -exec sed -i -e 's/TRAVIS_BUILD_DIR/GITHUB_WORKSPACE/g' {} \;
find ./ -type f -exec sed -i -e 's/TRAVIS_EVENT_TYPE/GITHUB_EVENT_NAME/g' {} \;
find ./ -type f -exec sed -i -e 's/TRAVIS_BRANCH/\{GITHUB_REF##*\/\}/g' {} \;
find ./ -type f -exec sed -i -e 's/TRAVIS_PULL_REQUEST_BRANCH/\{GITHUB_REF##*\/\}/g' {} \;
find ./ -type f -exec sed -i -e 's/TRAVIS_TAG/\{GITHUB_REF##*\/\}/g' {} \;
find ./ -type f -exec sed -i -e 's/-z "$TRAVIS_TAG" //g' {} \;
find ./ -type f -exec sed -i -e 's/${TRAVIS_PYTHON_VERSION}/3.7/g' {} \;
find ./ -type f -exec sed -i -e 's/"$TRAVIS_PULL_REQUEST" != "false"/"$GITHUB_EVENT_NAME" = "pull_request"/g' {} \;
find ./ -type f -exec sed -i -e 's/"$TRAVIS_PULL_REQUEST" = "false"/"$GITHUB_EVENT_NAME" != "pull_request"/g' {} \;
find ./ -type f -exec sed -i -e 's/travis_fold:start:/::group::/g' {} \;
find ./ -type f -exec sed -i -e 's/travis_fold:end:$containerlog/::endgroup::/g' {} \;
find ./ -type f -exec sed -i -e 's/.\/.travis\/check_commit.sh/#.\/.travis\/check_commit.sh/g' {} \;
- name: Before Install
run: |
.travis/before_install.sh
echo "::set-env name=TEST::${{ matrix.env.TEST }}"
cd ..
find ./ -type f -exec sed -i -e 's/timeout 90 bash/timeout 120 bash/g' {} \;
find ./ -type f -exec sed -i -e 's/\/usr\/local\/bin\/kubectl/$(which kubectl)/g' {} \;
find ./ -type f -exec sed -i -e 's/# containers are not running yet./sudo cp -i \/etc\/rancher\/k3s\/k3s.yaml $HOME\/.kube\/config/g' {} \;
cd pulp_file
- name: Install
run: |
mkdir -p $HOME/.kube
.travis/install.sh
- name: Before Script
run: .travis/before_script.sh
- name: Script
run: .travis/script.sh
shell: bash
deploy:
needs: pulp
runs-on: ubuntu-latest
services:
postgres:
image: postgres:9.6
redis:
image: redis
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: '3.7'
- name: "Deploy plugin to pypi"
if: contains(github.ref, "tag")
run: bash .travis/publish_plugin_pypi.sh
- name: "Publish client to rubygems"
env:
TEST: bindings
run: bash .travis/publish_client_gem.sh
- name: "Publish client to pypi"
env:
TEST: bindings
run: bash .travis/publish_client_pypi.sh
cherrypick:
needs: pulp
runs-on: ubuntu-latest
steps:
- name: "Cherrypick"
run: bash .travis/cherrypick.sh
1 change: 1 addition & 0 deletions CHANGES/6066.misc
@@ -0,0 +1 @@
Migrate from Travis to Github actions
3 changes: 3 additions & 0 deletions docs/_scripts/base.sh
Expand Up @@ -8,6 +8,9 @@ export CONTENT_ADDR=${CONTENT_ADDR:-http://localhost:24816}
# Necessary for `django-admin`
export DJANGO_SETTINGS_MODULE=pulpcore.app.settings

# Setting httpie env
export HTTPIE_CONFIG_DIR=$TRAVIS_BUILD_DIR/.github

# Poll a Pulp task until it is finished.
wait_until_task_finished() {
echo "Polling the task until it has reached a final state."
Expand Down