[skip-release] Update github-actions #425
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: build | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| lint: | |
| permissions: | |
| contents: read | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | |
| - run: shellcheck *.sh scripts/*.sh tests/*.sh | |
| - run: bash tests/init-firewall_test.sh | |
| - uses: hadolint/hadolint-action@06be81baf89a55ffd0e24b8f04a4185738dd3387 # v3.5.0 | |
| with: | |
| dockerfile: Dockerfile | |
| verbose: true | |
| - uses: hadolint/hadolint-action@06be81baf89a55ffd0e24b8f04a4185738dd3387 # v3.5.0 | |
| with: | |
| dockerfile: tests/Dockerfile.runtime-capabilities | |
| verbose: true | |
| - name: Build sandbox image under test | |
| run: docker build -t cli-sandbox:pr . | |
| - name: Build runtime capability fixture | |
| run: >- | |
| docker build | |
| -f tests/Dockerfile.runtime-capabilities | |
| --build-arg BASE_IMAGE=cli-sandbox:pr | |
| -t cli-sandbox:runtime-capabilities-test | |
| . | |
| - name: Test runtime capability and firewall contract | |
| run: bash tests/runtime-capabilities_test.sh cli-sandbox:runtime-capabilities-test | |
| push: | |
| needs: [lint] | |
| if: >- | |
| (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && | |
| github.ref == 'refs/heads/main' | |
| uses: libops/.github/.github/workflows/build-push.yaml@main | |
| permissions: | |
| contents: read | |
| id-token: write | |
| packages: write | |
| with: | |
| image: cli-sandbox | |
| ref: ${{ github.sha }} | |
| tag: codex | |
| expected-main-sha: ${{ github.sha }} | |
| sign: true | |
| push-cli: | |
| needs: [push] | |
| if: github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: read | |
| packages: write | |
| strategy: | |
| matrix: | |
| cli: [claude, pi] | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | |
| - uses: docker/setup-qemu-action@1f40c72289eff860ee54a304f1438e3cff362e0a # v4 | |
| - uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4 | |
| - name: login | |
| run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin | |
| - uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7 | |
| with: | |
| platforms: linux/amd64,linux/arm64 | |
| build-args: CLI=${{ matrix.cli }} | |
| tags: ghcr.io/libops/cli-sandbox:${{ matrix.cli }} | |
| push: true | |
| cache-from: | | |
| type=registry,ref=ghcr.io/libops/cli-sandbox:cache-${{ matrix.cli }} | |
| type=registry,ref=ghcr.io/libops/cli-sandbox:cache-amd64 | |
| type=registry,ref=ghcr.io/libops/cli-sandbox:cache-arm64 | |
| cache-to: type=registry,ref=ghcr.io/libops/cli-sandbox:cache-${{ matrix.cli }},mode=max |