Skip to content

Commit

Permalink
Update workflow files for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
matsuo committed Aug 11, 2024
1 parent 2817371 commit 351e215
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 10 deletions.
36 changes: 27 additions & 9 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: build
name: Build

on: [ push, pull_request ]

Expand All @@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners
os: [ ubuntu-20.04, ubuntu-22.04, ubuntu-latest, macos-12, macos-13, macos-14, macos-latest, windows-2019, windows-2022, windows-latest ]
os: [ 'ubuntu-20.04', 'ubuntu-22.04', 'ubuntu-24.04', 'ubuntu-latest', 'macos-12', 'macos-13', 'macos-14', 'macos-latest', 'windows-2019', 'windows-2022', 'windows-latest' ]
go: [ '1.22' ]
steps:

Expand Down Expand Up @@ -44,7 +44,27 @@ jobs:
shell: bash
run: echo "GOSS_USE_ALPHA=1" >> "$GITHUB_ENV"

- if: runner.os == 'Linux' || runner.os == 'macOS'
- if: runner.os == 'Linux'
name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN_202506 }}

- if: runner.os == 'Linux'
name: Pull from GitHub Container Registry
run: |
docker pull --platform=linux/amd64 ghcr.io/matsuo/goss:latest
docker run --platform=linux/amd64 --rm -i -v /$(pwd):/tmp ghcr.io/matsuo/goss:latest bash <<'EOF'
cd /go/src/github.com/goss-org/goss
cp ./release/goss-darwin-amd64 /tmp/goss-darwin-amd64
cp ./release/goss-darwin-arm64 /tmp/goss-darwin-arm64
cp ./release/goss-linux-amd64 /tmp/goss-linux-amd64
cp ./release/goss-linux-arm64 /tmp/goss-linux-arm64
EOF
- if: runner.os == 'macOS'
run: |
curl -L "https://github.com/goss-org/goss/archive/${{ env.goss_commit_hash }}.tar.gz" -o goss.tar.gz
tar xzvf goss.tar.gz
Expand All @@ -65,11 +85,11 @@ jobs:
- if: runner.os == 'Linux'
run: |
OS=linux "./goss-${{ env.goss_commit_hash }}/release/goss-linux-amd64" --gossfile tests/goss.yaml validate --format documentation
OS=linux "./goss-linux-amd64" --gossfile tests/goss.yaml validate --format documentation
- if: runner.os == 'macOS'
run: |
OS=darwin "./goss-${{ env.goss_commit_hash }}/release/goss-darwin-amd64" --gossfile tests/goss.yaml validate --format documentation
OS=darwin "./goss-darwin-amd64" --gossfile tests/goss.yaml validate --format documentation
- if: runner.os == 'Windows'
shell: bash
Expand All @@ -80,15 +100,13 @@ jobs:

- if: runner.os == 'Linux' && matrix.os == 'ubuntu-22.04'
name: Set up QEMU
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0

- if: runner.os == 'Linux' && matrix.os == 'ubuntu-22.04'
run: |
docker run --rm --env GOSS_COMMIT_HASH=${{ env.goss_commit_hash }} -i -v /$(pwd):/tmp arm64v8/ubuntu:22.04 bash <<'EOF'
cd /tmp
cp -p ./dist/linux-arm64/fmcsadmin ./fmcsadmin
"./goss-$GOSS_COMMIT_HASH/release/goss-linux-arm64" --gossfile tests/goss.yaml validate --format documentation
"./goss-linux-arm64" --gossfile tests/goss.yaml validate --format documentation
./fmcsadmin -v
EOF
# based on: github.com/koron-go/_skeleton/.github/workflows/go.yml
3 changes: 2 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: Publish Image

on:
push:
workflow_dispatch:
paths:
- 'Dockerfile'

jobs:
publish:
Expand Down

0 comments on commit 351e215

Please sign in to comment.