diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..09833dd3 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,29 @@ +name: Common Test + +on: + pull_request: + branches: + - 'master' + push: + branches: + - 'master' + +jobs: + build: + name: Test on OTP ${{ matrix.otp_version }} and ${{ matrix.os }} + runs-on: ${{ matrix.os }} + + strategy: + matrix: + otp_version: [19, 20, 21, 22, 23] + os: [ubuntu-latest] + + container: + image: erlang:${{ matrix.otp_version }} + + steps: + - uses: actions/checkout@v1 + - name: Compile + run: ./bootstrap + - name: CT tests + run: ./rebar3 ct diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..5fc43824 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,44 @@ +name: Publish + +on: + release: + types: [published, prereleased] + +jobs: + build: + name: Publish escript to release + runs-on: ubuntu-latest + + container: + image: erlang:19 + + steps: + - uses: actions/checkout@v1 + - name: Compile + run: ./bootstrap + - name: CT tests + run: ./rebar3 ct + + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./rebar3 + asset_name: rebar3 + asset_content_type: application/zip + + - name: Configure AWS credentials + if: "!github.event.release.prerelease" + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-1 + + - name: Copy rebar3 escript to S3 + if: "!github.event.release.prerelease" + run: | + aws s3 sync ./rebar3 s3://rebar3