diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index a83e42b..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,35 +0,0 @@ -version: 2.1 -workflows: - version: 2 - test-and-build-image: - jobs: - - test - - build-image: - requires: - - test - filters: - branches: - only: master -jobs: - test: - docker: - - image: haskell:8.8.1 - steps: - - checkout - - restore_cache: - keys: - - libraries-{{ checksum "distance.cabal" }} - - libraries - - run: cabal update - - run: cabal test - - save_cache: - key: libraries-{{ checksum "distance.cabal" }} - paths: - - "~/.cabal" - build-image: - machine: true - steps: - - checkout - - run: echo $KSC_CI_PERSONAL_ACCESS_TOKEN | docker login docker.pkg.github.com --username ksc-ci --password-stdin - - run: docker build --tag docker.pkg.github.com/odt/distance/calculator:$CIRCLE_SHA1 . - - run: docker push docker.pkg.github.com/odt/distance/calculator:$CIRCLE_SHA1 diff --git a/.github/workflows/test-build-push.yml b/.github/workflows/test-build-push.yml new file mode 100644 index 0000000..47b72a7 --- /dev/null +++ b/.github/workflows/test-build-push.yml @@ -0,0 +1,40 @@ +name: Test Build Push + +on: push + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: haskell/actions/setup@v2 + with: + ghc-version: '8.8.1' + - run: cabal update + - run: cabal test + build-push: + runs-on: ubuntu-latest + needs: test + steps: + - name: Setup Docker buildx + uses: docker/setup-buildx-action@v2 + - name: Login to the Container Registry + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + - name: Build and push + uses: docker/build-push-action@v3 + with: + push: true + tags: ${{ steps.meta.outputs.tags }} diff --git a/README.md b/README.md index 588d945..89c8641 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # 距離計算 -[![CircleCI](https://circleci.com/gh/odt/distance.svg?style=svg)](https://circleci.com/gh/odt/distance) - 始点の緯度経度、終点の緯度経度が並んだ CSV があります。 ``` csv @@ -20,4 +18,4 @@ 標準入力から読み込んで標準出力に書き出します。 -[GitHub Package Registry](https://github.com/odt/distance/packages) に Docker イメージがあります。 +Docker イメージが GitHub Packages に置かれている。