2021-01-26 12:37:03 +00:00
|
|
|
name: TestNDeploy
|
|
|
|
|
2021-01-28 15:19:30 +00:00
|
|
|
on: [push, pull_request]
|
2021-01-26 12:37:03 +00:00
|
|
|
|
2021-01-23 20:46:54 +00:00
|
|
|
jobs:
|
2021-01-26 12:37:03 +00:00
|
|
|
cache:
|
|
|
|
name: Caching
|
2023-01-06 12:07:20 +00:00
|
|
|
runs-on: ubuntu-latest
|
2021-01-26 12:37:03 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2023-10-30 20:01:03 +00:00
|
|
|
python-version: [ 3.7, 3.8, 3.9, "3.10", "3.11", "3.12" ]
|
2021-01-26 12:37:03 +00:00
|
|
|
|
2021-01-23 20:46:54 +00:00
|
|
|
steps:
|
2023-09-05 17:33:10 +00:00
|
|
|
- uses: actions/checkout@v4
|
2021-01-26 12:37:03 +00:00
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
2022-08-25 19:03:30 +00:00
|
|
|
uses: actions/setup-python@v4
|
2021-01-26 12:37:03 +00:00
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Get pip cache dir
|
|
|
|
id: pip-cache-dir
|
|
|
|
run: |
|
2022-10-30 11:18:06 +00:00
|
|
|
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
|
2021-01-26 12:37:03 +00:00
|
|
|
- name: pip cache
|
|
|
|
id: pip-cache
|
2022-08-25 19:03:30 +00:00
|
|
|
uses: actions/cache@v3
|
2021-01-26 12:37:03 +00:00
|
|
|
with:
|
|
|
|
path: ${{ steps.pip-cache-dir.outputs.dir }}
|
2023-03-03 14:12:16 +00:00
|
|
|
key: pip-${{ matrix.python-version }}-${{ hashFiles('**/setup.cfg') }}
|
2021-04-06 09:02:34 +00:00
|
|
|
- name: Update pip
|
2021-07-26 06:40:39 +00:00
|
|
|
if: ${{ steps.pip-cache.outputs.cache-hit != 'true' }}
|
2021-04-06 09:02:34 +00:00
|
|
|
run: |
|
2021-08-18 08:19:27 +00:00
|
|
|
python -m pip install --upgrade pip
|
2021-01-26 12:37:03 +00:00
|
|
|
- name: Install project dependencies
|
|
|
|
if: ${{ steps.pip-cache.outputs.cache-hit != 'true' }}
|
|
|
|
run: |
|
|
|
|
pip install -r requirements-dev.txt
|
|
|
|
|
|
|
|
lint:
|
|
|
|
name: Linting
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: cache
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2023-01-06 12:07:20 +00:00
|
|
|
python-version: [3.9]
|
2021-01-26 12:37:03 +00:00
|
|
|
steps:
|
2023-09-05 17:33:10 +00:00
|
|
|
- uses: actions/checkout@v4
|
2021-01-26 12:37:03 +00:00
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
2022-08-25 19:03:30 +00:00
|
|
|
uses: actions/setup-python@v4
|
2021-01-26 12:37:03 +00:00
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
# Retrieve the previously cached dependencies
|
|
|
|
- name: Get pip cache dir
|
|
|
|
id: pip-cache
|
|
|
|
run: |
|
2022-10-30 11:18:06 +00:00
|
|
|
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
|
2021-01-26 12:37:03 +00:00
|
|
|
- name: pip cache
|
2022-08-25 19:03:30 +00:00
|
|
|
uses: actions/cache@v3
|
2021-01-26 12:37:03 +00:00
|
|
|
with:
|
|
|
|
path: ${{ steps.pip-cache.outputs.dir }}
|
2023-01-06 19:43:16 +00:00
|
|
|
key: pip-${{ matrix.python-version }}-${{ hashFiles('**/setup.cfg') }}
|
2021-07-26 14:21:17 +00:00
|
|
|
# Update PIP
|
2021-04-06 09:02:34 +00:00
|
|
|
- name: Update pip
|
|
|
|
run: |
|
2021-08-18 08:19:27 +00:00
|
|
|
python -m pip install --upgrade pip
|
2021-01-26 12:37:03 +00:00
|
|
|
# Still need to properly install the dependencies - it will only skip the download part
|
|
|
|
- name: Install project dependencies
|
|
|
|
run: |
|
|
|
|
pip install -r requirements-dev.txt
|
2023-09-08 20:45:11 +00:00
|
|
|
- name: Lint
|
2021-01-26 12:37:03 +00:00
|
|
|
run:
|
|
|
|
make lint
|
|
|
|
|
2023-03-02 14:28:21 +00:00
|
|
|
javatest:
|
|
|
|
needs: lint
|
2023-03-03 14:12:16 +00:00
|
|
|
uses: ./.github/workflows/tests_sdk_java.yml
|
2023-03-02 14:28:21 +00:00
|
|
|
|
2023-03-24 10:46:37 +00:00
|
|
|
dotnettest:
|
|
|
|
needs: lint
|
|
|
|
uses: ./.github/workflows/tests_sdk_dotnet.yml
|
|
|
|
|
2023-11-23 11:04:20 +00:00
|
|
|
rubytest:
|
|
|
|
needs: lint
|
|
|
|
uses: ./.github/workflows/tests_sdk_ruby.yml
|
|
|
|
|
2021-01-26 12:37:03 +00:00
|
|
|
test:
|
2023-03-03 14:12:16 +00:00
|
|
|
needs: [lint]
|
2023-04-02 11:51:55 +00:00
|
|
|
if: "!contains(github.event.pull_request.labels.*.name, 'java')"
|
2023-03-03 14:12:16 +00:00
|
|
|
uses: ./.github/workflows/tests_decoratormode.yml
|
2021-01-26 12:37:03 +00:00
|
|
|
|
|
|
|
testserver:
|
2023-03-03 14:12:16 +00:00
|
|
|
needs: [lint]
|
2023-04-02 11:51:55 +00:00
|
|
|
if: "!contains(github.event.pull_request.labels.*.name, 'java')"
|
2023-03-03 14:12:16 +00:00
|
|
|
uses: ./.github/workflows/tests_servermode.yml
|
2021-01-26 12:37:03 +00:00
|
|
|
|
2023-09-27 18:34:30 +00:00
|
|
|
testproxy:
|
|
|
|
needs: [lint]
|
|
|
|
if: "!contains(github.event.pull_request.labels.*.name, 'java')"
|
|
|
|
uses: ./.github/workflows/tests_proxymode.yml
|
|
|
|
|
2023-03-03 14:12:16 +00:00
|
|
|
release:
|
|
|
|
name: Release
|
2021-01-26 12:37:03 +00:00
|
|
|
runs-on: ubuntu-latest
|
2023-11-10 22:44:59 +00:00
|
|
|
permissions:
|
|
|
|
id-token: write
|
2023-03-24 10:46:37 +00:00
|
|
|
needs: [dotnettest, javatest, test, testserver ]
|
2023-01-07 11:35:14 +00:00
|
|
|
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'getmoto/moto' }}
|
2021-01-26 12:37:03 +00:00
|
|
|
steps:
|
2023-09-05 17:33:10 +00:00
|
|
|
- uses: actions/checkout@v4
|
2021-03-03 09:57:08 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
2022-08-25 19:03:30 +00:00
|
|
|
uses: actions/setup-python@v4
|
2021-03-03 09:57:08 +00:00
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
2021-03-05 12:36:32 +00:00
|
|
|
- name: Update & Build
|
2021-01-26 12:37:03 +00:00
|
|
|
run: |
|
2023-01-06 19:43:16 +00:00
|
|
|
pip install build
|
2021-01-26 12:37:03 +00:00
|
|
|
python update_version_from_git.py
|
2023-01-06 19:43:16 +00:00
|
|
|
python -m build
|
2021-01-26 12:37:03 +00:00
|
|
|
- name: Publish to PyPI
|
2022-08-25 19:03:30 +00:00
|
|
|
uses: pypa/gh-action-pypi-publish@release/v1
|
2021-08-28 10:05:19 +00:00
|
|
|
- name: Build Docker release
|
2021-08-28 10:23:02 +00:00
|
|
|
run: |
|
|
|
|
docker build -t motoserver/moto . --tag moto:latest
|
2022-02-18 11:54:58 +00:00
|
|
|
# Required to get the correct Digest
|
|
|
|
# See https://github.com/docker/build-push-action/issues/461
|
2023-01-22 16:48:46 +00:00
|
|
|
- name: Set up QEMU
|
2023-09-19 07:43:09 +00:00
|
|
|
uses: docker/setup-qemu-action@v3
|
2022-02-18 11:54:58 +00:00
|
|
|
- name: Set up Docker Buildx
|
2023-09-19 07:42:34 +00:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2021-08-28 10:05:19 +00:00
|
|
|
- name: Login to DockerHub
|
2023-09-19 07:43:57 +00:00
|
|
|
uses: docker/login-action@v3
|
2021-08-28 10:05:19 +00:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
2023-03-16 21:22:02 +00:00
|
|
|
- name: Login to GHCR
|
2023-09-19 07:43:57 +00:00
|
|
|
uses: docker/login-action@v3
|
2023-03-16 21:22:02 +00:00
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Push to DockerHub and GHCR
|
2023-09-19 07:44:36 +00:00
|
|
|
uses: docker/build-push-action@v5
|
2021-08-28 10:05:19 +00:00
|
|
|
with:
|
|
|
|
push: true
|
2023-01-22 16:48:46 +00:00
|
|
|
platforms: linux/amd64,linux/arm64
|
2023-03-16 21:22:02 +00:00
|
|
|
tags: |
|
|
|
|
motoserver/moto:latest
|
|
|
|
ghcr.io/getmoto/motoserver:latest
|
2021-03-20 16:36:00 +00:00
|
|
|
- name: Get version number
|
|
|
|
run: |
|
|
|
|
version=$(grep -oP '(?<=__version__ = ")[0-9.a-z]+(?=")' moto/__init__.py)
|
|
|
|
echo "moto_version=$version" >> $GITHUB_ENV
|
2021-03-21 10:18:53 +00:00
|
|
|
- uses: octokit/graphql-action@v2.x
|
|
|
|
name: Get PR info
|
|
|
|
id: get_pr
|
|
|
|
with:
|
|
|
|
query: |
|
|
|
|
query get_pr($owner:String!,$repo:String!,$commit:GitObjectID) {
|
|
|
|
repository(owner:$owner,name:$repo) {
|
|
|
|
object(oid:$commit) {
|
|
|
|
... on Commit {
|
|
|
|
associatedPullRequests(last: 1){
|
|
|
|
edges {
|
|
|
|
node {
|
|
|
|
baseRepository {
|
|
|
|
nameWithOwner
|
|
|
|
}
|
|
|
|
merged
|
|
|
|
number
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
owner: ${{ github.event.repository.owner.name }}
|
|
|
|
repo: ${{ github.event.repository.name }}
|
|
|
|
commit: "${{ github.sha }}"
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2021-03-20 16:36:00 +00:00
|
|
|
- name: Get PR number
|
|
|
|
run: |
|
2021-03-21 10:18:53 +00:00
|
|
|
nr="${{ fromJSON(steps.get_pr.outputs.data).repository.object.associatedPullRequests.edges[0].node.number }}"
|
|
|
|
repo="${{ fromJSON(steps.get_pr.outputs.data).repository.object.associatedPullRequests.edges[0].node.baseRepository.nameWithOwner }}"
|
2021-03-20 16:36:00 +00:00
|
|
|
if [ -z "$nr" ]
|
|
|
|
then
|
|
|
|
echo "PR nr not found in $msg"
|
|
|
|
echo "pr_found=false" >> $GITHUB_ENV
|
|
|
|
else
|
|
|
|
echo "PR NR: $nr"
|
|
|
|
echo "pr_nr=$nr" >> $GITHUB_ENV
|
2021-03-21 10:18:53 +00:00
|
|
|
echo "pr_repo=$repo" >> $GITHUB_ENV
|
2021-03-20 16:36:00 +00:00
|
|
|
echo "pr_found=true" >> $GITHUB_ENV
|
|
|
|
fi
|
|
|
|
- name: Leave PR comment with Moto version
|
2023-04-11 18:22:21 +00:00
|
|
|
uses: peter-evans/create-or-update-comment@v3
|
2023-01-07 11:35:14 +00:00
|
|
|
if: env.pr_found == 'true' && env.pr_repo == 'getmoto/moto'
|
2021-03-20 16:36:00 +00:00
|
|
|
with:
|
|
|
|
issue-number: ${{ env.pr_nr }}
|
|
|
|
body: |
|
|
|
|
This is now part of moto >= ${{ env.moto_version }}
|