Skip to content

Commit

Permalink
Merge branch 'main' into last-release
Browse files Browse the repository at this point in the history
  • Loading branch information
kingdonb committed Mar 28, 2024
2 parents 6ee0223 + 493b694 commit 040b83d
Show file tree
Hide file tree
Showing 13 changed files with 123 additions and 59 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,18 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: false
toolchain: 1.72.1
target: wasm32-wasi

- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.4
bundler-cache: true # runs 'bundle install' and caches installed gems automatically


- name: Install dependent libraries
run: sudo apt-get install libpq-dev

Expand Down
48 changes: 36 additions & 12 deletions .github/workflows/develop.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ env:
BASE_TAG: base
GEMS_TAG: gems
GEM_CACHE_TAG: gem-cache
WABT_VERSION: 1.0.33
BINARYEN_VERSION: "116"
WABT_VERSION: 1.0.34
BINARYEN_VERSION: "117"
DOCKER_TARGET: deploy
CACHE_TAG: gems

Expand All @@ -43,32 +43,33 @@ jobs:
packages: write # needed for ghcr access
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Login to GHCR
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@bc1dd263b68cb5626dbb55d5c89777d79372c484
uses: ruby/setup-ruby@v1
if: "${{ github.event.inputs.dockerTarget == 'base' }}"
with:
ruby-version: '3.1.4'

- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
if: "${{ github.event.inputs.dockerTarget == 'base' }}"
with:
cache: false
toolchain: 1.72.1
target: wasm32-wasi

- name: Add local bin to path (wasm-strip, wasm-opt)
Expand All @@ -79,23 +80,23 @@ jobs:
echo "${HOME}/.local/bin" >> $GITHUB_PATH
- name: Restore Cache (binaries) wasm-opt, wasm-strip, stat.wasm
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
id: cache-restore
if: "${{ github.event.inputs.dockerTarget != 'base' }}"
with:
path: "/home/runner/.local/bin"
key: ${{ runner.os }}-wabt_${{ env.WABT_VERSION }}-binaryen_${{ env.BINARYEN_VERSION }}

- name: Cache (binaries) wasm-opt, wasm-strip, stat.wasm
uses: actions/cache@v3
uses: actions/cache@v4
id: cache
if: "${{ github.event.inputs.dockerTarget == 'base' }}"
with:
path: "/home/runner/.local/bin"
key: ${{ runner.os }}-wabt_${{ env.WABT_VERSION }}-binaryen_${{ env.BINARYEN_VERSION }}

- name: Install wabt, binaryen
uses: kingdonb/setup-wabt@v1.0.5
uses: kingdonb/setup-wabt@v1.0.6
if: "${{ github.event.inputs.dockerTarget == 'base' && steps.cache.outputs.cache-hit != 'true' }}"
with:
version: ${{ env.WABT_VERSION }}
Expand All @@ -121,8 +122,31 @@ jobs:
run: |
cp "${HOME}/.local/bin/stat.wasm" lib/stat.wasm
- name: Free disk space
shell: bash
run: |
echo "=============================================================================="
echo "Freeing up disk space on CI system"
echo "=============================================================================="
echo "Listing 100 largest packages"
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 100
df -h
echo "Removing large packages"
# sudo apt-get remove -y '^ghc-8.*'
sudo apt-get remove -y '^dotnet-.*'
sudo apt-get remove -y '^llvm-.*'
sudo apt-get remove -y 'php.*'
sudo apt-get remove -y azure-cli google-chrome-stable firefox powershell mono-devel
sudo apt-get autoremove -y
sudo apt-get clean
df -h
echo "Removing large directories"
# deleting 15GB
rm -rf /usr/share/dotnet/
df -h
- name: Build and push canary
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
if: "${{ github.event.inputs.dockerTarget != 'base'}}"
with:
context: .
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/execute.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -26,13 +26,13 @@ jobs:
echo LATEST_TAG=$LATEST_TAG >> $GITHUB_OUTPUT
- name: Set up Ruby
uses: ruby/setup-ruby@bc1dd263b68cb5626dbb55d5c89777d79372c484
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1.4'
bundler-cache: true

- name: Setup Kubernetes
uses: helm/kind-action@v1.8.0
uses: helm/kind-action@v1.9.0
with:
cluster_name: stats

Expand Down
70 changes: 50 additions & 20 deletions .github/workflows/publish-tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ env:
BASE_TAG: base
GEMS_TAG: gems
GEM_CACHE_TAG: gem-cache
WABT_VERSION: 1.0.33
BINARYEN_VERSION: "116"
WABT_VERSION: 1.0.34
BINARYEN_VERSION: "117"

jobs:
release:
Expand All @@ -21,14 +21,14 @@ jobs:
packages: write # needed for ghcr access
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Login to GHCR
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
Expand All @@ -37,8 +37,21 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: false
toolchain: 1.72.1
target: wasm32-wasi

- name: Set up Rust cache
uses: Swatinem/rust-cache@v2
with:
workspaces: |
lib/stat
- name: Set up Ruby
uses: ruby/setup-ruby@bc1dd263b68cb5626dbb55d5c89777d79372c484
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1.4'
bundler-cache: true
Expand All @@ -55,26 +68,14 @@ jobs:
echo BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') >> $GITHUB_OUTPUT
echo IMAGE_TAG=${CFGTAG} >> $GITHUB_OUTPUT
- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: false
target: wasm32-wasi

- name: Set up Rust cache
uses: Swatinem/rust-cache@v2
with:
workspaces: |
lib/stat
- name: Add local bin to path (wasm-strip, wasm-opt)
shell: bash
run: |
mkdir -p "${HOME}/.local/bin"
echo "${HOME}/.local/bin" >> $GITHUB_PATH
- name: Install wabt, binaryen
uses: kingdonb/setup-wabt@v1.0.5
uses: kingdonb/setup-wabt@v1.0.6
with:
version: ${{ env.WABT_VERSION }}
version2: ${{ env.BINARYEN_VERSION }}
Expand All @@ -91,8 +92,37 @@ jobs:
make -C lib stat.wasm
cp lib/stat.wasm "${HOME}/.local/bin"
# Copied from: https://github.com/orgs/community/discussions/25678
# https://github.com/apache/flink/blob/02d30ace69dc18555a5085eccf70ee884e73a16e/tools/azure-pipelines/free_disk_space.sh
# Fixes:
# https://github.com/kingdonb/stats-tracker-ghcr/actions/runs/8471469779
# (release System.IO.IOException: No space left on device)
# You are running out of disk space.
- name: Free disk space
shell: bash
run: |
echo "=============================================================================="
echo "Freeing up disk space on CI system"
echo "=============================================================================="
echo "Listing 100 largest packages"
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 100
df -h
echo "Removing large packages"
# sudo apt-get remove -y '^ghc-8.*'
sudo apt-get remove -y '^dotnet-.*'
sudo apt-get remove -y '^llvm-.*'
sudo apt-get remove -y 'php.*'
sudo apt-get remove -y azure-cli google-chrome-stable firefox powershell mono-devel
sudo apt-get autoremove -y
sudo apt-get clean
df -h
echo "Removing large directories"
# deleting 15GB
rm -rf /usr/share/dotnet/
df -h
- name: Build and push tag
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
Expand Down
31 changes: 16 additions & 15 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ env:
BASE_TAG: base
GEMS_TAG: gems
GEM_CACHE_TAG: gem-cache
WABT_VERSION: 1.0.33
BINARYEN_VERSION: "116"
WABT_VERSION: 1.0.34
BINARYEN_VERSION: "117"

jobs:
release:
Expand All @@ -41,24 +41,24 @@ jobs:
packages: write
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Login to GHCR
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@bc1dd263b68cb5626dbb55d5c89777d79372c484
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1.4'
bundler-cache: true
Expand All @@ -68,6 +68,7 @@ jobs:
if: "${{ github.event.inputs.dockerTarget == 'base'}}"
with:
cache: false
toolchain: 1.72.1
target: wasm32-wasi

- name: Set up Rust cache
Expand All @@ -85,23 +86,23 @@ jobs:
echo "${HOME}/.local/bin" >> $GITHUB_PATH
- name: Restore Cache (binaries) wasm-opt, wasm-strip, stat.wasm
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
id: cache-restore
if: "${{ github.event.inputs.dockerTarget != 'base' }}"
with:
path: "/home/runner/.local/bin"
key: ${{ runner.os }}-wabt_${{ env.WABT_VERSION }}-binaryen_${{ env.BINARYEN_VERSION }}

- name: Cache (binaries) wasm-opt, wasm-strip, stat.wasm
uses: actions/cache@v3
uses: actions/cache@v4
id: cache
if: "${{ github.event.inputs.dockerTarget == 'base' }}"
with:
path: "/home/runner/.local/bin"
key: ${{ runner.os }}-wabt_${{ env.WABT_VERSION }}-binaryen_${{ env.BINARYEN_VERSION }}

- name: Install wabt, binaryen
uses: kingdonb/setup-wabt@v1.0.5
uses: kingdonb/setup-wabt@v1.0.6
if: "${{ github.event.inputs.dockerTarget == 'base' && steps.cache.outputs.cache-hit != 'true' }}"
with:
version: ${{ env.WABT_VERSION }}
Expand Down Expand Up @@ -140,7 +141,7 @@ jobs:
cp "${HOME}/.local/bin/stat.wasm" lib/stat.wasm
- name: Build and push base
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
if: "${{ github.event.inputs.dockerTarget == 'base'}}"
with:
context: .
Expand All @@ -155,7 +156,7 @@ jobs:
cache-to: type=gha,mode=max

- name: Build and push gems
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
if: "${{ github.event.inputs.dockerTarget == 'gems'}}"
with:
context: .
Expand All @@ -172,7 +173,7 @@ jobs:
CACHE_IMAGE=${{ env.IMAGE_TAG }}:${{ github.event.inputs.cacheTag }}
- name: Build and push gem-cache
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
if: "${{ github.event.inputs.dockerTarget == 'gem-cache'}}"
with:
context: .
Expand All @@ -189,7 +190,7 @@ jobs:
CACHE_IMAGE=${{ env.IMAGE_TAG }}:${{ github.event.inputs.cacheTag }}
- name: Make clean-cache
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
if: "${{ github.event.inputs.dockerTarget == 'clean-cache'}}"
with:
context: .
Expand All @@ -206,7 +207,7 @@ jobs:
# CACHE_IMAGE=${{ env.IMAGE_TAG }}:${{ github.event.inputs.cacheTag }}

- name: Build and push canary
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
if: "${{ github.event.inputs.dockerTarget == 'deploy'}}"
with:
context: .
Expand Down
Loading

0 comments on commit 040b83d

Please sign in to comment.