Create docker-image.yml (#77) #3
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: Push or PR | |
| on: | |
| push: | |
| branches: ["*"] | |
| pull_request: | |
| branches: ["main"] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.23.x" | |
| - run: go version | |
| - name: Install dependencies | |
| run: go get . | |
| - name: Go Tests | |
| run: go test -v ./... | |
| - name: Build httptest | |
| env: | |
| GOOS: linux | |
| GOARCH: amd64 | |
| run: go build | |
| - name: Test httptest | |
| env: | |
| TEST_DIRECTORY: example-tests | |
| TEST_HOST: httpbin.org | |
| TEST_ENV: dev | |
| run: ./httptest | |
| build: | |
| needs: [test] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Set up Docker | |
| uses: docker/setup-docker-action@v4 | |
| with: | |
| daemon-config: | | |
| { | |
| "debug": true, | |
| "features": { | |
| "containerd-snapshotter": true | |
| } | |
| } | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| platforms: linux/amd64,linux/arm64 | |
| load: true | |
| tags: nytimes/httptest:dev |