diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d16c7a9..658bcb3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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 diff --git a/.github/workflows/develop.yaml b/.github/workflows/develop.yaml index f062da2..cffa491 100644 --- a/.github/workflows/develop.yaml +++ b/.github/workflows/develop.yaml @@ -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 @@ -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) @@ -79,7 +80,7 @@ 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: @@ -87,7 +88,7 @@ jobs: 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: @@ -95,7 +96,7 @@ jobs: 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 }} @@ -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: . diff --git a/.github/workflows/execute.yaml b/.github/workflows/execute.yaml index 6f5c70a..f35b70d 100644 --- a/.github/workflows/execute.yaml +++ b/.github/workflows/execute.yaml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 @@ -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 diff --git a/.github/workflows/publish-tag.yaml b/.github/workflows/publish-tag.yaml index fbef48c..7283c6b 100644 --- a/.github/workflows/publish-tag.yaml +++ b/.github/workflows/publish-tag.yaml @@ -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: @@ -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 }} @@ -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 @@ -55,18 +68,6 @@ 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: | @@ -74,7 +75,7 @@ jobs: 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 }} @@ -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 diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 6a781fa..bb7adec 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -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: @@ -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 @@ -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 @@ -85,7 +86,7 @@ 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: @@ -93,7 +94,7 @@ jobs: 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: @@ -101,7 +102,7 @@ jobs: 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 }} @@ -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: . @@ -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: . @@ -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: . @@ -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: . @@ -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: . diff --git a/Dockerfile b/Dockerfile index 2a1dba2..6058d4f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ RUN echo -n "---\nBUNDLE_PATH: \"/usr/local/bundle\"" > /usr/local/bundle/config FROM $BASE_IMAGE AS base RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y RUN mkdir -p /usr/local/bundle -RUN gem install bundler:2.4.14 && gem install foreman +RUN gem install bundler:2.5.7 && gem install foreman WORKDIR /usr/src/app RUN mkdir -p /usr/src/app/lib diff --git a/Gemfile b/Gemfile index 9e87e09..47e2a16 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,7 @@ source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } +# ruby '3.3.0' # ruby '3.2.2' ruby '3.1.4' # ruby "3.0.6" diff --git a/Gemfile.lock b/Gemfile.lock index 0cd0208..7c06c65 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -402,6 +402,7 @@ GEM PLATFORMS arm64-darwin-22 + arm64-darwin-23 x86_64-linux DEPENDENCIES @@ -453,4 +454,4 @@ RUBY VERSION ruby 3.1.4p223 BUNDLED WITH - 2.4.14 + 2.5.7 diff --git a/config/version.yml b/config/version.yml index d54cd0e..9bed5df 100644 --- a/config/version.yml +++ b/config/version.yml @@ -5,13 +5,13 @@ major: 0 minor: 2 -patch: 1 +patch: 2 # meta: rc.1 # milestone: 4 -build: 304 +build: 308 committer: Kingdon Barrett -build_date: 2023-10-29 +build_date: 2024-03-28 diff --git a/deploy/overlays/production/kustomization.yaml b/deploy/overlays/production/kustomization.yaml index d92bc69..7b85926 100644 --- a/deploy/overlays/production/kustomization.yaml +++ b/deploy/overlays/production/kustomization.yaml @@ -10,5 +10,5 @@ resources: images: - name: ghcr.io/kingdonb/stats-tracker-ghcr newName: ghcr.io/kingdonb/stats-tracker-ghcr - newTag: 0.2.1 + newTag: 0.2.2 patches: [] diff --git a/lib/Makefile b/lib/Makefile index 165bfe7..055cc4b 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -4,7 +4,7 @@ all: stat.wasm test test: stat.wasm ruby test.rb stat.raw.wasm: stat/src/main.rs - cd stat && cargo build --release --target wasm32-wasi && \ + cd stat && cargo +1.72.1 build --release --target wasm32-wasi && \ cp -f target/wasm32-wasi/release/stat.wasm ../stat.raw.wasm wasm-strip stat.raw.wasm diff --git a/lib/stat/lib-stat/Cargo.toml b/lib/stat/lib-stat/Cargo.toml index 5a02b7e..ccd9697 100644 --- a/lib/stat/lib-stat/Cargo.toml +++ b/lib/stat/lib-stat/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" [dependencies] scraper = "0.16.0" wasm-bindgen = "0.2.84" +bumpalo = "=3.14.0" [lib] crate-type = ["lib", "cdylib"] diff --git a/lib/templates/version.yml.erb b/lib/templates/version.yml.erb index b18e0e6..84c319f 100644 --- a/lib/templates/version.yml.erb +++ b/lib/templates/version.yml.erb @@ -5,7 +5,7 @@ major: 0 minor: 2 -patch: 1 +patch: 2 # meta: rc.1 # milestone: 4 build: <%= `git rev-list HEAD|wc -l`.strip %>