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

✨ Migrate to GitHub Actions + partial arm64 support #57

Merged
merged 1 commit into from
May 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 0 additions & 37 deletions .circleci/config.yml

This file was deleted.

119 changes: 0 additions & 119 deletions .circleci/config_template.yml

This file was deleted.

104 changes: 104 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Deploy

on:
push:
branches: [main]
schedule:
- cron: "0 00,12 * * *" # Twice a day

jobs:
generate-matrix:
name: Generate build matrix
runs-on: ubuntu-latest
needs: [test]
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: pipenv
- name: Install dependencies
run: |
pip install pipenv
pipenv install --deploy --dev
- name: Generate build matrix
run: |
FORCE=$(if git log --pretty=format:"%s" HEAD^..HEAD | grep -q '\[force\]'; then echo "--force"; else echo ""; fi)
pipenv run python -m build_versions.main --ci-matrix $FORCE --ci-event ${{ github.event_name }}
id: set-matrix

deploy:
name: ${{ matrix.key }}
runs-on: ubuntu-latest
if: needs.generate-matrix.outputs.matrix != ''
needs: [generate-matrix]
strategy:
matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: pipenv
- run: |
pip install pipenv
pipenv install --deploy --dev
- run: echo ${{ matrix.key }}
- name: Generate Dockerfile from config
run: pipenv run python -m build_versions.main --dockerfile-with-context '${{ toJSON(matrix) }}'
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: dockerfiles/${{ matrix.key }}.Dockerfile
platforms: ${{ join(matrix.platforms) }}
push: true
tags: nikolaik/python-nodejs:${{ matrix.key }}

release:
name: Update versions.json and README.md
runs-on: ubuntu-latest
needs: [deploy]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: pipenv
- run: |
pip install pipenv
pipenv install --deploy --dev
- name: Update versions.json and README.md, then commit and push changes (if any)
run: |
pipenv run python -m build_versions.main --verbose --release
clean_checkout=$(git status --porcelain)
if [[ -n "${clean_checkout}" ]]; then
git config --global user.name "Nikolai Kristiansen" > /dev/null 2>&1
git config --global user.email [email protected] > /dev/null 2>&1

# Update README.md
today=$(date +%Y-%m-%d)
sed -i -E "s/Last updated by bot: .*/Last updated by bot: ${today}/" README.md

git add versions.json README.md
git commit -m '🗃 Updated python/node versions [skip ci]'
git push --quiet origin main
else
echo "Nothing changed, nothing to archive."
fi

test:
uses: ./.github/workflows/tests.yaml
20 changes: 20 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Tests

on:
pull_request:
workflow_call:

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: pipenv
- run: |
pip install pipenv
pipenv install --deploy --dev
- run: pipenv run ./bin/lint
- run: pipenv run ./bin/test
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ debug-*.Dockerfile
.idea/
dockerfiles/
.circleci/config_generated.yml
version_config.json
version_config.json
__pycache__
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.11.1
Loading