Skip to content

Commit

Permalink
github-actions
Browse files Browse the repository at this point in the history
  • Loading branch information
skaji committed Nov 7, 2020
1 parent b8c0aec commit c7f76c1
Show file tree
Hide file tree
Showing 9 changed files with 157 additions and 68 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: build

on:
push:
branches:
- '*'
tags-ignore:
- '*'
pull_request:

jobs:
x86_64-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Docker build
run: docker build -t skaji/relocatable-perl -f build/Dockerfile .
darwin-2level:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v2
- name: Show macOS Version
run: sw_vers
- name: Prepare tools
run: |
set -euxo pipefail
export HOMEBREW_NO_AUTO_UPDATE=1
brew unlink $(brew list --formula)
brew install xz coreutils gnu-tar
brew link --force xz coreutils gnu-tar
- name: Build Perl
run: |
set -euxo pipefail
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
curl -fsSL https://git.io/perl-install | bash -s ~/perl
curl -fsSL --compressed -o ~/cpm https://git.io/cpm
~/perl/bin/perl ~/cpm install -g --cpanfile build/cpanfile
sudo install -m 755 -o $USER -g staff -d /opt/perl
~/perl/bin/perl build/relocatable-perl-build --prefix /opt/perl --perl_version $(cat BUILD_VERSION)
/opt/perl/bin/perl ~/cpm install -g App::cpanminus App::ChangeShebang
/opt/perl/bin/change-shebang -f /opt/perl/bin/*
115 changes: 115 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: release

on:
push:
tags:
- '*'

jobs:
x86_64-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Docker build
run: docker build -t skaji/relocatable-perl -f build/Dockerfile .
- name: Create Artifacts
run: |
set -euxo pipefail
mkdir x86_64-linux
ID=$(docker create skaji/relocatable-perl)
docker cp $ID:/perl-x86_64-linux.tar.gz x86_64-linux/
docker cp $ID:/perl-x86_64-linux.tar.xz x86_64-linux/
docker rm $ID
- uses: actions/upload-artifact@v2
with:
name: x86_64-linux
path: x86_64-linux
darwin-2level:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v2
- name: Show macOS Version
run: sw_vers
- name: Prepare tools
run: |
set -euxo pipefail
export HOMEBREW_NO_AUTO_UPDATE=1
brew unlink $(brew list --formula)
brew install xz coreutils gnu-tar
brew link --force xz coreutils gnu-tar
- name: Build Perl
run: |
set -euxo pipefail
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
curl -fsSL https://git.io/perl-install | bash -s ~/perl
curl -fsSL --compressed -o ~/cpm https://git.io/cpm
~/perl/bin/perl ~/cpm install -g --cpanfile build/cpanfile
sudo install -m 755 -o $USER -g staff -d /opt/perl
~/perl/bin/perl build/relocatable-perl-build --prefix /opt/perl --perl_version $(cat BUILD_VERSION)
/opt/perl/bin/perl ~/cpm install -g App::cpanminus App::ChangeShebang
/opt/perl/bin/change-shebang -f /opt/perl/bin/*
- name: Create Artifacts
run: |
set -euxo pipefail
mkdir darwin-2level
gcp -r /opt/perl ./perl-darwin-2level
gtar cf perl-darwin-2level.tar perl-darwin-2level
gzip -9 --stdout perl-darwin-2level.tar > darwin-2level/perl-darwin-2level.tar.gz
xz -9 --stdout perl-darwin-2level.tar > darwin-2level/perl-darwin-2level.tar.xz
- uses: actions/upload-artifact@v2
with:
name: darwin-2level
path: darwin-2level
release:
runs-on: ubuntu-latest
needs:
- x86_64-linux
- darwin-2level
steps:
- uses: actions/download-artifact@v2
with:
name: x86_64-linux
path: x86_64-linux
- uses: actions/download-artifact@v2
with:
name: darwin-2level
path: darwin-2level
- uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: x86_64-linux/perl-x86_64-linux.tar.gz
asset_name: perl-x86_64-linux.tar.gz
asset_content_type: application/gzip
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: x86_64-linux/perl-x86_64-linux.tar.xz
asset_name: perl-x86_64-linux.tar.xz
asset_content_type: application/x-xz
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: darwin-2level/perl-darwin-2level.tar.gz
asset_name: perl-darwin-2level.tar.gz
asset_content_type: application/gzip
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: darwin-2level/perl-darwin-2level.tar.xz
asset_name: perl-darwin-2level.tar.xz
asset_content_type: application/x-xz
21 changes: 0 additions & 21 deletions .travis.yml

This file was deleted.

3 changes: 0 additions & 3 deletions .travis/before_install_linux.sh

This file was deleted.

9 changes: 0 additions & 9 deletions .travis/before_install_osx.sh

This file was deleted.

10 changes: 0 additions & 10 deletions .travis/script_linux.sh

This file was deleted.

20 changes: 0 additions & 20 deletions .travis/script_osx.sh

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# relocatable perl [![Build Status](https://api.travis-ci.org/skaji/relocatable-perl.svg?branch=master)](https://travis-ci.org/skaji/relocatable-perl)
# relocatable perl [![build](https://github.com/skaji/relocatable-perl/workflows/build/badge.svg)](https://github.com/skaji/relocatable-perl/actions)

Self-contained, portable perl binaries for x86-64 Linux and OS X.
You can download them from [release page](https://github.com/skaji/relocatable-perl/releases).
Expand Down
4 changes: 0 additions & 4 deletions .travis/Dockerfile → build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,3 @@ RUN set -eux; \
gzip -9 --stdout perl-x86_64-linux.tar > /perl-x86_64-linux.tar.gz; \
xz -9 --stdout perl-x86_64-linux.tar > /perl-x86_64-linux.tar.xz; \
true

FROM gcr.io/google_containers/pause
COPY --from=builder /perl-x86_64-linux.tar.gz /perl-x86_64-linux.tar.gz
COPY --from=builder /perl-x86_64-linux.tar.xz /perl-x86_64-linux.tar.xz

0 comments on commit c7f76c1

Please sign in to comment.