From 55e0d1f228d900e05ff03c08e7b130c0a1d80019 Mon Sep 17 00:00:00 2001 From: Louis Poinsignon Date: Tue, 24 Nov 2020 14:42:52 -0800 Subject: [PATCH] move from Travis-CI to GitHub Actions --- .github/workflows/go.yml | 48 ++++++++++++++++++++++++++ .github/workflows/release.yml | 65 +++++++++++++++++++++++++++++++++++ .travis.yml | 46 ------------------------- README.md | 2 +- 4 files changed, 114 insertions(+), 47 deletions(-) create mode 100644 .github/workflows/go.yml create mode 100644 .github/workflows/release.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..0fea8c4 --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,48 @@ +name: Go + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + + - name: Set up Go 1.x + uses: actions/setup-go@v2 + with: + go-version: ^1.14 + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + with: + fetch-depth: '0' + + - name: Test & Vet + run: make test vet + + - name: Build + run: | + GOOS=linux make build-octorpki + GOOS=darwin make build-octorpki + GOOS=windows EXTENSION=.exe make build-octorpki + + - name: Install fpm + run: | + sudo apt-get update + sudo apt-get install -y rpm ruby ruby-dev + sudo gem install fpm + + - name: Package + run: make package-deb-octorpki package-rpm-octorpki + + - name: Upload Artifact + uses: actions/upload-artifact@v2 + with: + name: dist + path: dist/* + retention-days: 14 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..d4abe01 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,65 @@ +name: Release + +on: + push: + tags: + - 'v*' + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + + - name: Set up Go 1.x + uses: actions/setup-go@v2 + with: + go-version: ^1.14 + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + with: + fetch-depth: '0' + + - name: Build + run: | + GOOS=linux make build-octorpki + GOOS=darwin make build-octorpki + GOOS=windows EXTENSION=.exe make build-octorpki + + - name: Install fpm + run: | + sudo apt-get update + sudo apt-get install -y rpm ruby ruby-dev + sudo gem install fpm + + - name: Package + run: make package-deb-octorpki package-rpm-octorpki + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false + + - name: Upload Release Asset + uses: actions/github-script@v2 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + const fs = require('fs').promises; + const upload_url = '${{ steps.create_release.outputs.upload_url }}'; + for (let file of await fs.readdir('./dist')) { + console.log('uploading', file); + await github.repos.uploadReleaseAsset({ + url: upload_url, + name: file, + data: await fs.readFile(`./dist/${file}`) + }); + } + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f9075ed..0000000 --- a/.travis.yml +++ /dev/null @@ -1,46 +0,0 @@ -jobs: - include: - # Test - - stage: test - os: linux - language: go - go: - - 1.14.x - env: - GO111MODULE=on - script: - - make vet - - make test - # Compile - - stage: compile - os: linux - language: go - go: - - 1.14.x - env: - GO111MODULE=on - BUILDINFOSDET=-travis - before_install: - - sudo apt-get update - - sudo apt-get install -y rpm ruby ruby-dev - - sudo gem install fpm - script: - - GOOS=linux make build-octorpki - - GOOS=darwin make build-octorpki - - GOOS=windows EXTENSION=.exe make build-octorpki - - make package-deb-octorpki package-rpm-octorpki - deploy: - provider: releases - api_key: - secure: IFZ2c9FkeIiEh2+cWtx4fPWkG3iBeGEWLt7ER6F9C7NqucklWGTtQftoP/72+v5tKV5m+m205pTSuKL63kUWTlSH+zBhYuQCqgpURKJJ0cL+TR8WBYOftB83TG9Yxj2X1hwc2e9QILZvlKS17rycvTDTBOnBEnmM/jIbU4fymx+zcSstL6r/UyjJW5GUCeP6U9CEqrJ0DBnUokvnJk1Om0M/iSWe2Yt8QMxy3jXxEQZlrjzXUCSB6FaFme6t41ZbaYS5FT3uHXHzJUsqg67QshiRTzX1yTBClEnFws9LW/IC7RNnlchf2Ugih5p5X+czO3WWQjrpLyUVdavT5TQGr5GKKVeS/MCE1m/McFMdIOub/D7G307pbv4H0SP5pXAp+eUEoTgP35HcFm9iXLitBVBWlx5pnFheonNOEX42yd3YQ2sa7AC2EGDBIpfNvuuhRWn3P2EHI2lR1T9VkM3TPJLpEM+QSRClu5Fed78CUDYmOl9RRSOCyjGniqRoR8+NHx5plDhMAb3uSf8u1Rp4juFNOJNtKLmWyWHNRjkUhItykOKUdlpy9Czrjw2pmFJoGG0ohSXLgNZe1coI1K0VdevXeR1KaWqg9bllW6Ue3MAmWgeHc+YSJEbZDvls8PNQ1KKs+eMlz5xOiBnYNvKpQe3MwpL4a52whX/wNr6kVf0= - file_glob: true - file: dist/* - skip_cleanup: true - on: - tags: true - repo: cloudflare/cfrpki - - dist: trusty - services: - - docker - script: - - make docker-octorpki diff --git a/README.md b/README.md index bb91ec3..2b37576 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Cloudflare RPKI Validator Tools and Libraries -[![Build Status](https://travis-ci.org/cloudflare/cfrpki.svg?branch=master)](https://travis-ci.org/cloudflare/cfrpki) +[![Build Status](https://github.com/cloudflare/cfrpki/workflows/Go/badge.svg)](https://github.com/cloudflare/cfrpki/actions?query=workflow%3AGo) Cloudflare OctoRPKI logo