Skip to content

Commit 28f6f79

Browse files
Sergei Kuvakinlafin
Sergei Kuvakin
authored andcommitted
feat: gh actions
1 parent 8c126bd commit 28f6f79

File tree

5 files changed

+61
-62
lines changed

5 files changed

+61
-62
lines changed

.dockerignore

+3
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
.git
2+
.github
3+
LICENSE
4+
*.md

.github/workflows/actions.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: actions
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
branches:
8+
- master
9+
jobs:
10+
crossbuild:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Set variables
15+
run: |
16+
echo "DOCKER_REPO=docker.io/$GITHUB_REPOSITORY" >> $GITHUB_ENV
17+
- name: Build
18+
run: docker build -t ${{ env.DOCKER_REPO }} .
19+
- name: Test
20+
run: ./test.sh -d "${{ env.DOCKER_REPO }}"
21+
- name: Publish
22+
if: github.ref == 'refs/heads/master'
23+
run: |
24+
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_TOKEN }}
25+
docker push ${{ env.DOCKER_REPO }}

.travis.yml

-8
This file was deleted.

Makefile

-54
This file was deleted.

test.sh

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
set -xeo pipefail
3+
4+
# A POSIX variable
5+
OPTIND=1 # Reset in case getopts has been used previously in the shell.
6+
7+
while getopts "d:" opt; do
8+
case "$opt" in
9+
d) DOCKER_REPO=$OPTARG
10+
;;
11+
esac
12+
done
13+
14+
shift $((OPTIND-1))
15+
16+
[ "$1" = "--" ] && shift
17+
18+
LINUX_TRIPLES="arm-linux-gnueabihf arm-linux-gnueabi powerpc64le-linux-gnu aarch64-linux-gnu arm-linux-gnueabihf mipsel-linux-gnu"
19+
DARWIN_TRIPLES="x86_64-apple-darwin i386-apple-darwin x86_64h-apple-darwin"
20+
WINDOWS_TRIPLES="x86_64-w64-mingw32 i686-w64-mingw32"
21+
ALIAS_TRIPLES="arm armhf arm64 amd64 x86_64 mips mipsel powerpc powerpc64 powerpc64le osx darwin windows"
22+
DOCKER_TEST_ARGS="--rm -v $(pwd)/test:/test -w /test"
23+
24+
for triple in ${DARWIN_TRIPLES} ${LINUX_TRIPLES} ${WINDOWS_TRIPLES} ${ALIAS_TRIPLES}; do
25+
docker run ${DOCKER_TEST_ARGS} -e CROSS_TRIPLE=${triple} ${DOCKER_REPO} make test;
26+
done
27+
28+
docker run ${DOCKER_TEST_ARGS} -e CROSS_TRIPLE=i386-apple-darwin ${DOCKER_REPO} /usr/osxcross/bin/i386-apple-darwin14-cc helloworld.c -o helloworld
29+
file test/helloworld
30+
docker run ${DOCKER_TEST_ARGS} -e CROSS_TRIPLE=i386-apple-darwin ${DOCKER_REPO} /usr/i386-apple-darwin14/bin/cc helloworld.c -o helloworld
31+
file test/helloworld
32+
docker run ${DOCKER_TEST_ARGS} -e CROSS_TRIPLE=i386-apple-darwin ${DOCKER_REPO} cc helloworld.c -o helloworld
33+
file test/helloworld

0 commit comments

Comments
 (0)