Skip to content

Commit

Permalink
chore: add names to GitHub Actions (#595)
Browse files Browse the repository at this point in the history
  • Loading branch information
huxuan authored Jun 8, 2024
1 parent c61eb9e commit 43843f9
Show file tree
Hide file tree
Showing 10 changed files with 138 additions and 86 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ jobs:
if: ${{ !cancelled() && ! failure() }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Checkout repository
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
fetch-depth: 0
- uses: pdm-project/setup-pdm@568ddd69406b30de1774ec0044b73ae06e716aa4 # v4
- name: Set up PDM
uses: pdm-project/setup-pdm@568ddd69406b30de1774ec0044b73ae06e716aa4 # v4
with:
cache: true
python-version: ${{ matrix.python-version }}
Expand Down Expand Up @@ -59,7 +61,8 @@ jobs:
runs-on: ubuntu-22.04
steps:
- run: env | sort
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Checkout repository
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Set up Git
run: |
git config --global user.name github-actions
Expand Down Expand Up @@ -96,7 +99,8 @@ jobs:
echo "# :warning: GITHUB_TOKEN is used for semantic-release" >> $GITHUB_STEP_SUMMARY
echo "The GITHUB_TOKEN is used instead of a bot token or PAT and will not emit the released publish event for the released workflow." >> $GITHUB_STEP_SUMMARY
fi
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Checkout repository
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
fetch-depth: 0
persist-credentials: false
Expand Down
24 changes: 16 additions & 8 deletions .github/workflows/devcontainer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,35 +26,43 @@ jobs:
runs-on: ubuntu-22.04
steps:
- run: env | sort
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- run: docker login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io
- run: |
- name: Checkout repository
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Set up authentication
run: docker login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io
- name: Set up BuildKit
run: |
docker context create builder
docker buildx create builder --name container --driver docker-container --use
docker buildx inspect --bootstrap --builder container
- run: |
- name: Build the dev container
run: |
docker buildx build . \
--build-arg PYTHON_VERSION=${{ matrix.python-version }} \
--cache-from type=registry,ref=ghcr.io/${{ github.repository }}/dev-cache:py${{ matrix.python-version }} \
--file .devcontainer/Dockerfile \
--load \
--tag ghcr.io/${{ github.repository }}/dev:py${{ matrix.python-version }} \
--target dev
- run: |
- name: Test the dev container
run: |
docker run --rm \
-e CI=true \
-v ${PWD}:/workspace \
ghcr.io/${{ github.repository }}/dev:py${{ matrix.python-version }} \
make dev lint test doc build
- run: |
- name: Build the prod container
run: |
docker buildx build . \
--build-arg PYTHON_VERSION=${{ matrix.python-version }} \
--file .devcontainer/Dockerfile \
--load \
--tag ghcr.io/${{ github.repository }}:py${{ matrix.python-version }} \
--target prod
- run: docker run --rm ghcr.io/${{ github.repository }}:py${{ matrix.python-version }}
- if: github.event_name != 'pull_request'
- name: Test the prod container
run: docker run --rm ghcr.io/${{ github.repository }}:py${{ matrix.python-version }}
- name: Push the dev container
if: github.event_name != 'pull_request'
run: |
docker buildx build . \
--build-arg PYTHON_VERSION=${{ matrix.python-version }} \
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/readthedocs-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ jobs:
documentation-links:
runs-on: ubuntu-22.04
steps:
- uses: readthedocs/actions/preview@cc0920454cf03ca8a3fbd3cbaa2ce2e509e70636 # v1.2
- name: Add Read the Docs preview's link to pull request
uses: readthedocs/actions/preview@cc0920454cf03ca8a3fbd3cbaa2ce2e509e70636 # v1.2
with:
project-slug: ss-python
on:
Expand Down
55 changes: 34 additions & 21 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ jobs:
pages-build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Checkout repository
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
fetch-depth: 0
- uses: pdm-project/setup-pdm@568ddd69406b30de1774ec0044b73ae06e716aa4 # v4
- name: Set up PDM
uses: pdm-project/setup-pdm@568ddd69406b30de1774ec0044b73ae06e716aa4 # v4
with:
cache: true
python-version: '3.12'
Expand Down Expand Up @@ -45,13 +47,17 @@ jobs:
runs-on: ubuntu-22.04
steps:
- run: env | sort
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- run: docker login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io
- run: |
- name: Checkout repository
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Set up authentication
run: docker login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io
- name: Set up BuildKit
run: |
docker context create builder
docker buildx create builder --name container --driver docker-container --use
docker buildx inspect --bootstrap --builder container
- run: |
- name: Build the dev container
run: |
docker buildx build . \
--build-arg PYTHON_VERSION=${{ matrix.python-version }} \
--cache-from type=registry,ref=ghcr.io/${{ github.repository }}/dev-cache:py${{ matrix.python-version }} \
Expand All @@ -60,22 +66,15 @@ jobs:
--tag ghcr.io/${{ github.repository }}/dev:py${{ matrix.python-version }} \
--tag ghcr.io/${{ github.repository }}/dev:py${{ matrix.python-version }}-${{ github.ref_name }} \
--target dev
- run: |
- name: Test the dev container
run: |
docker run --rm \
-e CI=true \
-v ${PWD}:/workspace \
ghcr.io/${{ github.repository }}/dev:py${{ matrix.python-version }} \
make dev lint test doc build
- run: |
docker buildx build . \
--build-arg PYTHON_VERSION=${{ matrix.python-version }} \
--cache-to type=registry,ref=ghcr.io/${{ github.repository }}/dev-cache:py${{ matrix.python-version }},mode=max \
--file .devcontainer/Dockerfile \
--push \
--tag ghcr.io/${{ github.repository }}/dev:py${{ matrix.python-version }} \
--tag ghcr.io/${{ github.repository }}/dev:py${{ matrix.python-version }}-${{ github.ref_name }} \
--target dev
- run: |
- name: Build the prod container
run: |
docker buildx build . \
--build-arg SCM_VERSION=${{ github.ref_name }} \
--build-arg PYTHON_VERSION=${{ matrix.python-version }} \
Expand All @@ -84,8 +83,20 @@ jobs:
--tag ghcr.io/${{ github.repository }}:py${{ matrix.python-version }} \
--tag ghcr.io/${{ github.repository }}:py${{ matrix.python-version }}-${{ github.ref_name }} \
--target prod
- run: docker run --rm ghcr.io/${{ github.repository }}:py${{ matrix.python-version }}
- run: |
- name: Test the prod container
run: docker run --rm ghcr.io/${{ github.repository }}:py${{ matrix.python-version }}
- name: Push the dev container
run: |
docker buildx build . \
--build-arg PYTHON_VERSION=${{ matrix.python-version }} \
--cache-to type=registry,ref=ghcr.io/${{ github.repository }}/dev-cache:py${{ matrix.python-version }},mode=max \
--file .devcontainer/Dockerfile \
--push \
--tag ghcr.io/${{ github.repository }}/dev:py${{ matrix.python-version }} \
--tag ghcr.io/${{ github.repository }}/dev:py${{ matrix.python-version }}-${{ github.ref_name }} \
--target dev
- name: Push the prod container
run: |
docker buildx build . \
--build-arg SCM_VERSION=${{ github.ref_name }} \
--build-arg PYTHON_VERSION=${{ matrix.python-version }} \
Expand All @@ -105,8 +116,10 @@ jobs:
package-publish:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: pdm-project/setup-pdm@568ddd69406b30de1774ec0044b73ae06e716aa4 # v4
- name: Checkout repository
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Set up PDM
uses: pdm-project/setup-pdm@568ddd69406b30de1774ec0044b73ae06e716aa4 # v4
with:
cache: true
python-version: '3.12'
Expand Down
18 changes: 9 additions & 9 deletions .gitlab/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,6 @@ container-publish:
-v ${PWD}:/workspace \
${CI_REGISTRY_IMAGE}/dev:py${PYTHON_VERSION} \
make dev lint test doc build
- |
docker buildx build . \
--build-arg PYTHON_VERSION=${PYTHON_VERSION} \
--cache-to type=registry,ref=${CI_REGISTRY_IMAGE}/dev-cache:py${PYTHON_VERSION},mode=max \
--file .devcontainer/Dockerfile \
--push \
--tag ${CI_REGISTRY_IMAGE}/dev:py${PYTHON_VERSION} \
--tag ${CI_REGISTRY_IMAGE}/dev:py${PYTHON_VERSION}-${CI_COMMIT_TAG} \
--target dev
- |
docker buildx build . \
--build-arg SCM_VERSION=${CI_COMMIT_TAG} \
Expand All @@ -80,6 +71,15 @@ container-publish:
--tag ${CI_REGISTRY_IMAGE}:py${PYTHON_VERSION}-${CI_COMMIT_TAG} \
--target prod
- docker run --rm ${CI_REGISTRY_IMAGE}:py${PYTHON_VERSION}
- |
docker buildx build . \
--build-arg PYTHON_VERSION=${PYTHON_VERSION} \
--cache-to type=registry,ref=${CI_REGISTRY_IMAGE}/dev-cache:py${PYTHON_VERSION},mode=max \
--file .devcontainer/Dockerfile \
--push \
--tag ${CI_REGISTRY_IMAGE}/dev:py${PYTHON_VERSION} \
--tag ${CI_REGISTRY_IMAGE}/dev:py${PYTHON_VERSION}-${CI_COMMIT_TAG} \
--target dev
- |
docker buildx build . \
--build-arg SCM_VERSION=${CI_COMMIT_TAG} \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ jobs:
if: {{ '${{ !cancelled() && ! failure() }}' }}
runs-on: {{ '${{ matrix.os }}' }}
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Checkout repository
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
fetch-depth: 0
- uses: pdm-project/setup-pdm@568ddd69406b30de1774ec0044b73ae06e716aa4 # v4
- name: Set up PDM
uses: pdm-project/setup-pdm@568ddd69406b30de1774ec0044b73ae06e716aa4 # v4
with:
cache: true
python-version: {{ '${{ matrix.python-version }}' }}
Expand Down Expand Up @@ -87,7 +89,8 @@ jobs:
runs-on: ubuntu-22.04
steps:
- run: env | sort
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Checkout repository
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Set up Git
run: |
git config --global user.name github-actions
Expand Down Expand Up @@ -127,7 +130,8 @@ jobs:
echo "# :warning: GITHUB_TOKEN is used for semantic-release" >> $GITHUB_STEP_SUMMARY
echo "The GITHUB_TOKEN is used instead of a bot token or PAT and will not emit the released publish event for the released workflow." >> $GITHUB_STEP_SUMMARY
fi
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Checkout repository
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
fetch-depth: 0
persist-credentials: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,35 +27,43 @@ jobs:
runs-on: ubuntu-22.04
steps:
- run: env | sort
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- run: docker login -u {{ '${{ github.actor }}' }} -p {{ '${{ secrets.GITHUB_TOKEN }}' }} ghcr.io
- run: |
- name: Checkout repository
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Set up authentication
run: docker login -u {{ '${{ github.actor }}' }} -p {{ '${{ secrets.GITHUB_TOKEN }}' }} ghcr.io
- name: Set up BuildKit
run: |
docker context create builder
docker buildx create builder --name container --driver docker-container --use
docker buildx inspect --bootstrap --builder container
- run: |
- name: Build the dev container
run: |
docker buildx build . \
--build-arg PYTHON_VERSION={{ '${{ matrix.python-version }}' }} \
--cache-from type=registry,ref=ghcr.io/{{ '${{ github.repository }}' }}/dev-cache:py{{ '${{ matrix.python-version }}' }} \
--file .devcontainer/Dockerfile \
--load \
--tag ghcr.io/{{ '${{ github.repository }}' }}/dev:py{{ '${{ matrix.python-version }}' }} \
--target dev
- run: |
- name: Test the dev container
run: |
docker run --rm \
-e CI=true \
-v ${PWD}:/workspace \
ghcr.io/{{ '${{ github.repository }}' }}/dev:py{{ '${{ matrix.python-version }}' }} \
make dev lint test doc build
- run: |
- name: Build the prod container
run: |
docker buildx build . \
--build-arg PYTHON_VERSION={{ '${{ matrix.python-version }}' }} \
--file .devcontainer/Dockerfile \
--load \
--tag ghcr.io/{{ '${{ github.repository }}' }}:py{{ '${{ matrix.python-version }}' }} \
--target prod
- run: docker run --rm ghcr.io/{{ '${{ github.repository }}' }}:py{{ '${{ matrix.python-version }}' }}
- if: github.event_name != 'pull_request'
- name: Test the prod container
run: docker run --rm ghcr.io/{{ '${{ github.repository }}' }}:py{{ '${{ matrix.python-version }}' }}
- name: Push the dev container
if: github.event_name != 'pull_request'
run: |
docker buildx build . \
--build-arg PYTHON_VERSION={{ '${{ matrix.python-version }}' }} \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ jobs:
documentation-links:
runs-on: ubuntu-22.04
steps:
- uses: readthedocs/actions/preview@cc0920454cf03ca8a3fbd3cbaa2ce2e509e70636 # v1.2
- name: Add Read the Docs preview's link to pull request
uses: readthedocs/actions/preview@cc0920454cf03ca8a3fbd3cbaa2ce2e509e70636 # v1.2
with:
project-slug: {{ repo_name }}
on:
Expand Down
Loading

0 comments on commit 43843f9

Please sign in to comment.